Skip to content

Commit

Permalink
feat(core): Add "slug" field to Collection entity
Browse files Browse the repository at this point in the history
Relates to #335

BREAKING CHANGE: A new "slug" field has been added to the CollectionTranslation entity, requiring a DB migration. Also, when creating a new Collection via the `createCollection` mutation, each translation must include a slug.
  • Loading branch information
michaelbromley committed Jun 4, 2020
1 parent a07382b commit 5b4d3db
Show file tree
Hide file tree
Showing 28 changed files with 435 additions and 167 deletions.
31 changes: 21 additions & 10 deletions packages/admin-ui/src/lib/core/src/common/generated-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ export type Collection = Node & {
updatedAt: Scalars['DateTime'];
languageCode?: Maybe<LanguageCode>;
name: Scalars['String'];
slug: Scalars['String'];
breadcrumbs: Array<CollectionBreadcrumb>;
position: Scalars['Int'];
description: Scalars['String'];
Expand Down Expand Up @@ -256,6 +257,7 @@ export type CollectionFilterParameter = {
updatedAt?: Maybe<DateOperators>;
languageCode?: Maybe<StringOperators>;
name?: Maybe<StringOperators>;
slug?: Maybe<StringOperators>;
position?: Maybe<NumberOperators>;
description?: Maybe<StringOperators>;
};
Expand All @@ -278,6 +280,7 @@ export type CollectionSortParameter = {
createdAt?: Maybe<SortOrder>;
updatedAt?: Maybe<SortOrder>;
name?: Maybe<SortOrder>;
slug?: Maybe<SortOrder>;
position?: Maybe<SortOrder>;
description?: Maybe<SortOrder>;
};
Expand All @@ -289,17 +292,10 @@ export type CollectionTranslation = {
updatedAt: Scalars['DateTime'];
languageCode: LanguageCode;
name: Scalars['String'];
slug: Scalars['String'];
description: Scalars['String'];
};

export type CollectionTranslationInput = {
id?: Maybe<Scalars['ID']>;
languageCode: LanguageCode;
name?: Maybe<Scalars['String']>;
description?: Maybe<Scalars['String']>;
customFields?: Maybe<Scalars['JSON']>;
};

export type ConfigArg = {
__typename?: 'ConfigArg';
name: Scalars['String'];
Expand Down Expand Up @@ -451,10 +447,17 @@ export type CreateCollectionInput = {
assetIds?: Maybe<Array<Scalars['ID']>>;
parentId?: Maybe<Scalars['ID']>;
filters: Array<ConfigurableOperationInput>;
translations: Array<CollectionTranslationInput>;
translations: Array<CreateCollectionTranslationInput>;
customFields?: Maybe<Scalars['JSON']>;
};

export type CreateCollectionTranslationInput = {
languageCode: LanguageCode;
name: Scalars['String'];
slug: Scalars['String'];
description: Scalars['String'];
};

export type CreateCountryInput = {
code: Scalars['String'];
translations: Array<CountryTranslationInput>;
Expand Down Expand Up @@ -3574,10 +3577,18 @@ export type UpdateCollectionInput = {
parentId?: Maybe<Scalars['ID']>;
assetIds?: Maybe<Array<Scalars['ID']>>;
filters?: Maybe<Array<ConfigurableOperationInput>>;
translations?: Maybe<Array<CollectionTranslationInput>>;
translations?: Maybe<Array<UpdateCollectionTranslationInput>>;
customFields?: Maybe<Scalars['JSON']>;
};

export type UpdateCollectionTranslationInput = {
id?: Maybe<Scalars['ID']>;
languageCode: LanguageCode;
name?: Maybe<Scalars['String']>;
slug?: Maybe<Scalars['String']>;
description?: Maybe<Scalars['String']>;
};

export type UpdateCountryInput = {
id: Scalars['ID'];
code?: Maybe<Scalars['String']>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ export type Collection = Node & {
updatedAt: Scalars['DateTime'];
languageCode?: Maybe<LanguageCode>;
name: Scalars['String'];
slug: Scalars['String'];
breadcrumbs: Array<CollectionBreadcrumb>;
position: Scalars['Int'];
description: Scalars['String'];
Expand Down Expand Up @@ -255,6 +256,7 @@ export type CollectionFilterParameter = {
updatedAt?: Maybe<DateOperators>;
languageCode?: Maybe<StringOperators>;
name?: Maybe<StringOperators>;
slug?: Maybe<StringOperators>;
position?: Maybe<NumberOperators>;
description?: Maybe<StringOperators>;
};
Expand All @@ -277,6 +279,7 @@ export type CollectionSortParameter = {
createdAt?: Maybe<SortOrder>;
updatedAt?: Maybe<SortOrder>;
name?: Maybe<SortOrder>;
slug?: Maybe<SortOrder>;
position?: Maybe<SortOrder>;
description?: Maybe<SortOrder>;
};
Expand All @@ -288,17 +291,10 @@ export type CollectionTranslation = {
updatedAt: Scalars['DateTime'];
languageCode: LanguageCode;
name: Scalars['String'];
slug: Scalars['String'];
description: Scalars['String'];
};

export type CollectionTranslationInput = {
id?: Maybe<Scalars['ID']>;
languageCode: LanguageCode;
name?: Maybe<Scalars['String']>;
description?: Maybe<Scalars['String']>;
customFields?: Maybe<Scalars['JSON']>;
};

export type ConfigArg = {
__typename?: 'ConfigArg';
name: Scalars['String'];
Expand Down Expand Up @@ -450,10 +446,17 @@ export type CreateCollectionInput = {
assetIds?: Maybe<Array<Scalars['ID']>>;
parentId?: Maybe<Scalars['ID']>;
filters: Array<ConfigurableOperationInput>;
translations: Array<CollectionTranslationInput>;
translations: Array<CreateCollectionTranslationInput>;
customFields?: Maybe<Scalars['JSON']>;
};

export type CreateCollectionTranslationInput = {
languageCode: LanguageCode;
name: Scalars['String'];
slug: Scalars['String'];
description: Scalars['String'];
};

export type CreateCountryInput = {
code: Scalars['String'];
translations: Array<CountryTranslationInput>;
Expand Down Expand Up @@ -3406,10 +3409,18 @@ export type UpdateCollectionInput = {
parentId?: Maybe<Scalars['ID']>;
assetIds?: Maybe<Array<Scalars['ID']>>;
filters?: Maybe<Array<ConfigurableOperationInput>>;
translations?: Maybe<Array<CollectionTranslationInput>>;
translations?: Maybe<Array<UpdateCollectionTranslationInput>>;
customFields?: Maybe<Scalars['JSON']>;
};

export type UpdateCollectionTranslationInput = {
id?: Maybe<Scalars['ID']>;
languageCode: LanguageCode;
name?: Maybe<Scalars['String']>;
slug?: Maybe<Scalars['String']>;
description?: Maybe<Scalars['String']>;
};

export type UpdateCountryInput = {
id: Scalars['ID'];
code?: Maybe<Scalars['String']>;
Expand Down
4 changes: 4 additions & 0 deletions packages/common/src/generated-shop-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ export type Collection = Node & {
updatedAt: Scalars['DateTime'];
languageCode?: Maybe<LanguageCode>;
name: Scalars['String'];
slug: Scalars['String'];
breadcrumbs: Array<CollectionBreadcrumb>;
position: Scalars['Int'];
description: Scalars['String'];
Expand Down Expand Up @@ -170,6 +171,7 @@ export type CollectionFilterParameter = {
updatedAt?: Maybe<DateOperators>;
languageCode?: Maybe<StringOperators>;
name?: Maybe<StringOperators>;
slug?: Maybe<StringOperators>;
position?: Maybe<NumberOperators>;
description?: Maybe<StringOperators>;
};
Expand All @@ -192,6 +194,7 @@ export type CollectionSortParameter = {
createdAt?: Maybe<SortOrder>;
updatedAt?: Maybe<SortOrder>;
name?: Maybe<SortOrder>;
slug?: Maybe<SortOrder>;
position?: Maybe<SortOrder>;
description?: Maybe<SortOrder>;
};
Expand All @@ -203,6 +206,7 @@ export type CollectionTranslation = {
updatedAt: Scalars['DateTime'];
languageCode: LanguageCode;
name: Scalars['String'];
slug: Scalars['String'];
description: Scalars['String'];
};

Expand Down
31 changes: 21 additions & 10 deletions packages/common/src/generated-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ export type Collection = Node & {
updatedAt: Scalars['DateTime'];
languageCode?: Maybe<LanguageCode>;
name: Scalars['String'];
slug: Scalars['String'];
breadcrumbs: Array<CollectionBreadcrumb>;
position: Scalars['Int'];
description: Scalars['String'];
Expand Down Expand Up @@ -255,6 +256,7 @@ export type CollectionFilterParameter = {
updatedAt?: Maybe<DateOperators>;
languageCode?: Maybe<StringOperators>;
name?: Maybe<StringOperators>;
slug?: Maybe<StringOperators>;
position?: Maybe<NumberOperators>;
description?: Maybe<StringOperators>;
};
Expand All @@ -277,6 +279,7 @@ export type CollectionSortParameter = {
createdAt?: Maybe<SortOrder>;
updatedAt?: Maybe<SortOrder>;
name?: Maybe<SortOrder>;
slug?: Maybe<SortOrder>;
position?: Maybe<SortOrder>;
description?: Maybe<SortOrder>;
};
Expand All @@ -288,17 +291,10 @@ export type CollectionTranslation = {
updatedAt: Scalars['DateTime'];
languageCode: LanguageCode;
name: Scalars['String'];
slug: Scalars['String'];
description: Scalars['String'];
};

export type CollectionTranslationInput = {
id?: Maybe<Scalars['ID']>;
languageCode: LanguageCode;
name?: Maybe<Scalars['String']>;
description?: Maybe<Scalars['String']>;
customFields?: Maybe<Scalars['JSON']>;
};

export type ConfigArg = {
__typename?: 'ConfigArg';
name: Scalars['String'];
Expand Down Expand Up @@ -450,10 +446,17 @@ export type CreateCollectionInput = {
assetIds?: Maybe<Array<Scalars['ID']>>;
parentId?: Maybe<Scalars['ID']>;
filters: Array<ConfigurableOperationInput>;
translations: Array<CollectionTranslationInput>;
translations: Array<CreateCollectionTranslationInput>;
customFields?: Maybe<Scalars['JSON']>;
};

export type CreateCollectionTranslationInput = {
languageCode: LanguageCode;
name: Scalars['String'];
slug: Scalars['String'];
description: Scalars['String'];
};

export type CreateCountryInput = {
code: Scalars['String'];
translations: Array<CountryTranslationInput>;
Expand Down Expand Up @@ -3526,10 +3529,18 @@ export type UpdateCollectionInput = {
parentId?: Maybe<Scalars['ID']>;
assetIds?: Maybe<Array<Scalars['ID']>>;
filters?: Maybe<Array<ConfigurableOperationInput>>;
translations?: Maybe<Array<CollectionTranslationInput>>;
translations?: Maybe<Array<UpdateCollectionTranslationInput>>;
customFields?: Maybe<Scalars['JSON']>;
};

export type UpdateCollectionTranslationInput = {
id?: Maybe<Scalars['ID']>;
languageCode: LanguageCode;
name?: Maybe<Scalars['String']>;
slug?: Maybe<Scalars['String']>;
description?: Maybe<Scalars['String']>;
};

export type UpdateCountryInput = {
id: Scalars['ID'];
code?: Maybe<Scalars['String']>;
Expand Down
4 changes: 4 additions & 0 deletions packages/core/e2e/__snapshots__/collection.e2e-spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,14 @@ Object {
"id": "T_1",
"name": "__root_collection__",
},
"slug": "electronics",
"translations": Array [
Object {
"description": "",
"id": "T_3",
"languageCode": "en",
"name": "Electronics",
"slug": "electronics",
},
],
}
Expand Down Expand Up @@ -127,12 +129,14 @@ Object {
"id": "T_4",
"name": "Computers",
},
"slug": "apple-stuff",
"translations": Array [
Object {
"description": "Apple stuff ",
"id": "T_5",
"languageCode": "en",
"name": "Pear",
"slug": "apple-stuff",
},
],
}
Expand Down
Loading

0 comments on commit 5b4d3db

Please sign in to comment.