Skip to content

Commit

Permalink
feat(core): Make ShippingMethod translatable
Browse files Browse the repository at this point in the history
Relates to #530

BREAKING CHANGE: The `ShippingMethod` entity is now translatable. This change will require a DB
migration to be performed, including custom queries to migrate any existing ShippingMethods
to the new table structure (see release blog post for details).
  • Loading branch information
michaelbromley committed Nov 10, 2020
1 parent 739e56c commit c7418d1
Show file tree
Hide file tree
Showing 27 changed files with 317 additions and 92 deletions.
16 changes: 14 additions & 2 deletions packages/admin-ui/src/lib/core/src/common/generated-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1839,20 +1839,28 @@ export type UpdateRoleInput = {
channelIds?: Maybe<Array<Scalars['ID']>>;
};

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

export type CreateShippingMethodInput = {
code: Scalars['String'];
description: Scalars['String'];
checker: ConfigurableOperationInput;
calculator: ConfigurableOperationInput;
translations: Array<ShippingMethodTranslationInput>;
customFields?: Maybe<Scalars['JSON']>;
};

export type UpdateShippingMethodInput = {
id: Scalars['ID'];
code?: Maybe<Scalars['String']>;
description?: Maybe<Scalars['String']>;
checker?: Maybe<ConfigurableOperationInput>;
calculator?: Maybe<ConfigurableOperationInput>;
translations: Array<ShippingMethodTranslationInput>;
customFields?: Maybe<Scalars['JSON']>;
};

Expand Down Expand Up @@ -3346,6 +3354,7 @@ export type ShippingMethodQuote = {
id: Scalars['ID'];
price: Scalars['Int'];
priceWithTax: Scalars['Int'];
name: Scalars['String'];
description: Scalars['String'];
metadata?: Maybe<Scalars['JSON']>;
};
Expand Down Expand Up @@ -3596,6 +3605,7 @@ export type ShippingMethod = Node & {
createdAt: Scalars['DateTime'];
updatedAt: Scalars['DateTime'];
code: Scalars['String'];
name: Scalars['String'];
description: Scalars['String'];
checker: ConfigurableOperation;
calculator: ConfigurableOperation;
Expand Down Expand Up @@ -4135,6 +4145,7 @@ export type ShippingMethodFilterParameter = {
createdAt?: Maybe<DateOperators>;
updatedAt?: Maybe<DateOperators>;
code?: Maybe<StringOperators>;
name?: Maybe<StringOperators>;
description?: Maybe<StringOperators>;
};

Expand All @@ -4143,6 +4154,7 @@ export type ShippingMethodSortParameter = {
createdAt?: Maybe<SortOrder>;
updatedAt?: Maybe<SortOrder>;
code?: Maybe<SortOrder>;
name?: Maybe<SortOrder>;
description?: Maybe<SortOrder>;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1663,20 +1663,28 @@ export type UpdateRoleInput = {
channelIds?: Maybe<Array<Scalars['ID']>>;
};

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

export type CreateShippingMethodInput = {
code: Scalars['String'];
description: Scalars['String'];
checker: ConfigurableOperationInput;
calculator: ConfigurableOperationInput;
translations: Array<ShippingMethodTranslationInput>;
customFields?: Maybe<Scalars['JSON']>;
};

export type UpdateShippingMethodInput = {
id: Scalars['ID'];
code?: Maybe<Scalars['String']>;
description?: Maybe<Scalars['String']>;
checker?: Maybe<ConfigurableOperationInput>;
calculator?: Maybe<ConfigurableOperationInput>;
translations: Array<ShippingMethodTranslationInput>;
customFields?: Maybe<Scalars['JSON']>;
};

Expand Down Expand Up @@ -1705,7 +1713,6 @@ export type TestShippingMethodResult = {
export type TestShippingMethodQuote = {
price: Scalars['Int'];
priceWithTax: Scalars['Int'];
description: Scalars['String'];
metadata?: Maybe<Scalars['JSON']>;
};

Expand Down Expand Up @@ -3117,6 +3124,7 @@ export type ShippingMethodQuote = {
id: Scalars['ID'];
price: Scalars['Int'];
priceWithTax: Scalars['Int'];
name: Scalars['String'];
description: Scalars['String'];
metadata?: Maybe<Scalars['JSON']>;
};
Expand Down Expand Up @@ -3344,12 +3352,23 @@ export type ShippingMethod = Node & {
createdAt: Scalars['DateTime'];
updatedAt: Scalars['DateTime'];
code: Scalars['String'];
name: Scalars['String'];
description: Scalars['String'];
checker: ConfigurableOperation;
calculator: ConfigurableOperation;
translations: Array<ShippingMethodTranslation>;
customFields?: Maybe<Scalars['JSON']>;
};

export type ShippingMethodTranslation = {
id: Scalars['ID'];
createdAt: Scalars['DateTime'];
updatedAt: Scalars['DateTime'];
languageCode: LanguageCode;
name: Scalars['String'];
description: Scalars['String'];
};

export type ShippingMethodList = PaginatedList & {
items: Array<ShippingMethod>;
totalItems: Scalars['Int'];
Expand Down Expand Up @@ -3875,6 +3894,7 @@ export type ShippingMethodFilterParameter = {
createdAt?: Maybe<DateOperators>;
updatedAt?: Maybe<DateOperators>;
code?: Maybe<StringOperators>;
name?: Maybe<StringOperators>;
description?: Maybe<StringOperators>;
};

Expand All @@ -3883,6 +3903,7 @@ export type ShippingMethodSortParameter = {
createdAt?: Maybe<SortOrder>;
updatedAt?: Maybe<SortOrder>;
code?: Maybe<SortOrder>;
name?: Maybe<SortOrder>;
description?: Maybe<SortOrder>;
};

Expand Down
13 changes: 13 additions & 0 deletions packages/common/src/generated-shop-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2094,6 +2094,7 @@ export type ShippingMethodQuote = {
id: Scalars['ID'];
price: Scalars['Int'];
priceWithTax: Scalars['Int'];
name: Scalars['String'];
description: Scalars['String'];
metadata?: Maybe<Scalars['JSON']>;
};
Expand Down Expand Up @@ -2425,12 +2426,24 @@ export type ShippingMethod = Node & {
createdAt: Scalars['DateTime'];
updatedAt: Scalars['DateTime'];
code: Scalars['String'];
name: Scalars['String'];
description: Scalars['String'];
checker: ConfigurableOperation;
calculator: ConfigurableOperation;
translations: Array<ShippingMethodTranslation>;
customFields?: Maybe<Scalars['JSON']>;
};

export type ShippingMethodTranslation = {
__typename?: 'ShippingMethodTranslation';
id: Scalars['ID'];
createdAt: Scalars['DateTime'];
updatedAt: Scalars['DateTime'];
languageCode: LanguageCode;
name: Scalars['String'];
description: Scalars['String'];
};

export type ShippingMethodList = PaginatedList & {
__typename?: 'ShippingMethodList';
items: Array<ShippingMethod>;
Expand Down
28 changes: 25 additions & 3 deletions packages/common/src/generated-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1808,20 +1808,28 @@ export type UpdateRoleInput = {
channelIds?: Maybe<Array<Scalars['ID']>>;
};

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

export type CreateShippingMethodInput = {
code: Scalars['String'];
description: Scalars['String'];
checker: ConfigurableOperationInput;
calculator: ConfigurableOperationInput;
translations: Array<ShippingMethodTranslationInput>;
customFields?: Maybe<Scalars['JSON']>;
};

export type UpdateShippingMethodInput = {
id: Scalars['ID'];
code?: Maybe<Scalars['String']>;
description?: Maybe<Scalars['String']>;
checker?: Maybe<ConfigurableOperationInput>;
calculator?: Maybe<ConfigurableOperationInput>;
translations: Array<ShippingMethodTranslationInput>;
customFields?: Maybe<Scalars['JSON']>;
};

Expand Down Expand Up @@ -1852,7 +1860,6 @@ export type TestShippingMethodQuote = {
__typename?: 'TestShippingMethodQuote';
price: Scalars['Int'];
priceWithTax: Scalars['Int'];
description: Scalars['String'];
metadata?: Maybe<Scalars['JSON']>;
};

Expand Down Expand Up @@ -3314,6 +3321,7 @@ export type ShippingMethodQuote = {
id: Scalars['ID'];
price: Scalars['Int'];
priceWithTax: Scalars['Int'];
name: Scalars['String'];
description: Scalars['String'];
metadata?: Maybe<Scalars['JSON']>;
};
Expand Down Expand Up @@ -3564,12 +3572,24 @@ export type ShippingMethod = Node & {
createdAt: Scalars['DateTime'];
updatedAt: Scalars['DateTime'];
code: Scalars['String'];
name: Scalars['String'];
description: Scalars['String'];
checker: ConfigurableOperation;
calculator: ConfigurableOperation;
translations: Array<ShippingMethodTranslation>;
customFields?: Maybe<Scalars['JSON']>;
};

export type ShippingMethodTranslation = {
__typename?: 'ShippingMethodTranslation';
id: Scalars['ID'];
createdAt: Scalars['DateTime'];
updatedAt: Scalars['DateTime'];
languageCode: LanguageCode;
name: Scalars['String'];
description: Scalars['String'];
};

export type ShippingMethodList = PaginatedList & {
__typename?: 'ShippingMethodList';
items: Array<ShippingMethod>;
Expand Down Expand Up @@ -4103,6 +4123,7 @@ export type ShippingMethodFilterParameter = {
createdAt?: Maybe<DateOperators>;
updatedAt?: Maybe<DateOperators>;
code?: Maybe<StringOperators>;
name?: Maybe<StringOperators>;
description?: Maybe<StringOperators>;
};

Expand All @@ -4111,6 +4132,7 @@ export type ShippingMethodSortParameter = {
createdAt?: Maybe<SortOrder>;
updatedAt?: Maybe<SortOrder>;
code?: Maybe<SortOrder>;
name?: Maybe<SortOrder>;
description?: Maybe<SortOrder>;
};

Expand Down
1 change: 1 addition & 0 deletions packages/core/e2e/graphql/fragments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@ export const SHIPPING_METHOD_FRAGMENT = gql`
fragment ShippingMethod on ShippingMethod {
id
code
name
description
calculator {
code
Expand Down
Loading

0 comments on commit c7418d1

Please sign in to comment.