Skip to content

Commit

Permalink
feat(core): Implement data model & APIs for multi-location stock
Browse files Browse the repository at this point in the history
Relates to #1545
  • Loading branch information
michaelbromley committed Jan 31, 2023
1 parent 883e2db commit 905c1df
Show file tree
Hide file tree
Showing 40 changed files with 899 additions and 296 deletions.
44 changes: 15 additions & 29 deletions packages/admin-ui/src/lib/core/src/common/generated-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,7 @@ export type CreateProductVariantInput = {
price?: InputMaybe<Scalars['Int']>;
productId: Scalars['ID'];
sku: Scalars['String'];
stockLevels?: InputMaybe<Array<StockLevelInput>>;
stockOnHand?: InputMaybe<Scalars['Int']>;
taxCategoryId?: InputMaybe<Scalars['ID']>;
trackInventory?: InputMaybe<GlobalFlag>;
Expand Down Expand Up @@ -816,12 +817,8 @@ export type CreateRoleInput = {
permissions: Array<Permission>;
};

export type CreateSellerCustomFieldsInput = {
connectedAccountId?: InputMaybe<Scalars['String']>;
};

export type CreateSellerInput = {
customFields?: InputMaybe<CreateSellerCustomFieldsInput>;
customFields?: InputMaybe<Scalars['JSON']>;
name: Scalars['String'];
};

Expand Down Expand Up @@ -1243,6 +1240,7 @@ export type CustomFields = {
Promotion: Array<CustomFieldConfig>;
Seller: Array<CustomFieldConfig>;
ShippingMethod: Array<CustomFieldConfig>;
StockLocation: Array<CustomFieldConfig>;
TaxCategory: Array<CustomFieldConfig>;
TaxRate: Array<CustomFieldConfig>;
User: Array<CustomFieldConfig>;
Expand Down Expand Up @@ -2579,7 +2577,6 @@ export type Mutation = {
/** Move a Collection to a different parent or index */
moveCollection: Collection;
refundOrder: RefundOrderResult;
registerNewSeller?: Maybe<Channel>;
reindex: Job;
/** Removes Collections from the specified Channel */
removeCollectionsFromChannel: Array<Collection>;
Expand Down Expand Up @@ -3101,11 +3098,6 @@ export type MutationRefundOrderArgs = {
};


export type MutationRegisterNewSellerArgs = {
input: RegisterSellerInput;
};


export type MutationRemoveCollectionsFromChannelArgs = {
input: RemoveCollectionsFromChannelInput;
};
Expand Down Expand Up @@ -4336,9 +4328,12 @@ export type ProductVariant = Node & {
product: Product;
productId: Scalars['ID'];
sku: Scalars['String'];
/** @deprecated use stockLevels */
stockAllocated: Scalars['Int'];
stockLevel: Scalars['String'];
stockLevels: Array<StockLevel>;
stockMovements: StockMovementList;
/** @deprecated use stockLevels */
stockOnHand: Scalars['Int'];
taxCategory: TaxCategory;
taxRateApplied: TaxRate;
Expand Down Expand Up @@ -4884,11 +4879,6 @@ export type RefundStateTransitionError = ErrorResult & {
transitionError: Scalars['String'];
};

export type RegisterSellerInput = {
administrator: CreateAdministratorInput;
shopName: Scalars['String'];
};

export type RelationCustomFieldConfig = CustomField & {
__typename?: 'RelationCustomFieldConfig';
description?: Maybe<Array<LocalizedString>>;
Expand Down Expand Up @@ -5084,19 +5074,13 @@ export type SearchResultSortParameter = {
export type Seller = Node & {
__typename?: 'Seller';
createdAt: Scalars['DateTime'];
customFields?: Maybe<SellerCustomFields>;
customFields?: Maybe<Scalars['JSON']>;
id: Scalars['ID'];
name: Scalars['String'];
updatedAt: Scalars['DateTime'];
};

export type SellerCustomFields = {
__typename?: 'SellerCustomFields';
connectedAccountId?: Maybe<Scalars['String']>;
};

export type SellerFilterParameter = {
connectedAccountId?: InputMaybe<StringOperators>;
createdAt?: InputMaybe<DateOperators>;
id?: InputMaybe<IdOperators>;
name?: InputMaybe<StringOperators>;
Expand All @@ -5123,7 +5107,6 @@ export type SellerListOptions = {
};

export type SellerSortParameter = {
connectedAccountId?: InputMaybe<SortOrder>;
createdAt?: InputMaybe<SortOrder>;
id?: InputMaybe<SortOrder>;
name?: InputMaybe<SortOrder>;
Expand Down Expand Up @@ -5289,9 +5272,15 @@ export type StockLevel = Node & {
updatedAt: Scalars['DateTime'];
};

export type StockLevelInput = {
stockLocationId: Scalars['ID'];
stockOnHand: Scalars['Int'];
};

export type StockLocation = Node & {
__typename?: 'StockLocation';
createdAt: Scalars['DateTime'];
customFields?: Maybe<Scalars['JSON']>;
description: Scalars['String'];
id: Scalars['ID'];
name: Scalars['String'];
Expand Down Expand Up @@ -5765,6 +5754,7 @@ export type UpdateProductVariantInput = {
outOfStockThreshold?: InputMaybe<Scalars['Int']>;
price?: InputMaybe<Scalars['Int']>;
sku?: InputMaybe<Scalars['String']>;
stockLevels?: InputMaybe<Array<StockLevelInput>>;
stockOnHand?: InputMaybe<Scalars['Int']>;
taxCategoryId?: InputMaybe<Scalars['ID']>;
trackInventory?: InputMaybe<GlobalFlag>;
Expand Down Expand Up @@ -5795,12 +5785,8 @@ export type UpdateRoleInput = {
permissions?: InputMaybe<Array<Permission>>;
};

export type UpdateSellerCustomFieldsInput = {
connectedAccountId?: InputMaybe<Scalars['String']>;
};

export type UpdateSellerInput = {
customFields?: InputMaybe<UpdateSellerCustomFieldsInput>;
customFields?: InputMaybe<Scalars['JSON']>;
id: Scalars['ID'];
name?: InputMaybe<Scalars['String']>;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,7 @@ export type CreateProductVariantInput = {
price?: InputMaybe<Scalars['Int']>;
productId: Scalars['ID'];
sku: Scalars['String'];
stockLevels?: InputMaybe<Array<StockLevelInput>>;
stockOnHand?: InputMaybe<Scalars['Int']>;
taxCategoryId?: InputMaybe<Scalars['ID']>;
trackInventory?: InputMaybe<GlobalFlag>;
Expand Down Expand Up @@ -802,12 +803,8 @@ export type CreateRoleInput = {
permissions: Array<Permission>;
};

export type CreateSellerCustomFieldsInput = {
connectedAccountId?: InputMaybe<Scalars['String']>;
};

export type CreateSellerInput = {
customFields?: InputMaybe<CreateSellerCustomFieldsInput>;
customFields?: InputMaybe<Scalars['JSON']>;
name: Scalars['String'];
};

Expand Down Expand Up @@ -1227,6 +1224,7 @@ export type CustomFields = {
Promotion: Array<CustomFieldConfig>;
Seller: Array<CustomFieldConfig>;
ShippingMethod: Array<CustomFieldConfig>;
StockLocation: Array<CustomFieldConfig>;
TaxCategory: Array<CustomFieldConfig>;
TaxRate: Array<CustomFieldConfig>;
User: Array<CustomFieldConfig>;
Expand Down Expand Up @@ -2527,7 +2525,6 @@ export type Mutation = {
/** Move a Collection to a different parent or index */
moveCollection: Collection;
refundOrder: RefundOrderResult;
registerNewSeller?: Maybe<Channel>;
reindex: Job;
/** Removes Collections from the specified Channel */
removeCollectionsFromChannel: Array<Collection>;
Expand Down Expand Up @@ -2957,10 +2954,6 @@ export type MutationRefundOrderArgs = {
input: RefundOrderInput;
};

export type MutationRegisterNewSellerArgs = {
input: RegisterSellerInput;
};

export type MutationRemoveCollectionsFromChannelArgs = {
input: RemoveCollectionsFromChannelInput;
};
Expand Down Expand Up @@ -4058,9 +4051,12 @@ export type ProductVariant = Node & {
product: Product;
productId: Scalars['ID'];
sku: Scalars['String'];
/** @deprecated use stockLevels */
stockAllocated: Scalars['Int'];
stockLevel: Scalars['String'];
stockLevels: Array<StockLevel>;
stockMovements: StockMovementList;
/** @deprecated use stockLevels */
stockOnHand: Scalars['Int'];
taxCategory: TaxCategory;
taxRateApplied: TaxRate;
Expand Down Expand Up @@ -4551,11 +4547,6 @@ export type RefundStateTransitionError = ErrorResult & {
transitionError: Scalars['String'];
};

export type RegisterSellerInput = {
administrator: CreateAdministratorInput;
shopName: Scalars['String'];
};

export type RelationCustomFieldConfig = CustomField & {
description?: Maybe<Array<LocalizedString>>;
entity: Scalars['String'];
Expand Down Expand Up @@ -4743,18 +4734,13 @@ export type SearchResultSortParameter = {

export type Seller = Node & {
createdAt: Scalars['DateTime'];
customFields?: Maybe<SellerCustomFields>;
customFields?: Maybe<Scalars['JSON']>;
id: Scalars['ID'];
name: Scalars['String'];
updatedAt: Scalars['DateTime'];
};

export type SellerCustomFields = {
connectedAccountId?: Maybe<Scalars['String']>;
};

export type SellerFilterParameter = {
connectedAccountId?: InputMaybe<StringOperators>;
createdAt?: InputMaybe<DateOperators>;
id?: InputMaybe<IdOperators>;
name?: InputMaybe<StringOperators>;
Expand All @@ -4780,7 +4766,6 @@ export type SellerListOptions = {
};

export type SellerSortParameter = {
connectedAccountId?: InputMaybe<SortOrder>;
createdAt?: InputMaybe<SortOrder>;
id?: InputMaybe<SortOrder>;
name?: InputMaybe<SortOrder>;
Expand Down Expand Up @@ -4945,8 +4930,14 @@ export type StockLevel = Node & {
updatedAt: Scalars['DateTime'];
};

export type StockLevelInput = {
stockLocationId: Scalars['ID'];
stockOnHand: Scalars['Int'];
};

export type StockLocation = Node & {
createdAt: Scalars['DateTime'];
customFields?: Maybe<Scalars['JSON']>;
description: Scalars['String'];
id: Scalars['ID'];
name: Scalars['String'];
Expand Down Expand Up @@ -5402,6 +5393,7 @@ export type UpdateProductVariantInput = {
outOfStockThreshold?: InputMaybe<Scalars['Int']>;
price?: InputMaybe<Scalars['Int']>;
sku?: InputMaybe<Scalars['String']>;
stockLevels?: InputMaybe<Array<StockLevelInput>>;
stockOnHand?: InputMaybe<Scalars['Int']>;
taxCategoryId?: InputMaybe<Scalars['ID']>;
trackInventory?: InputMaybe<GlobalFlag>;
Expand Down Expand Up @@ -5432,12 +5424,8 @@ export type UpdateRoleInput = {
permissions?: InputMaybe<Array<Permission>>;
};

export type UpdateSellerCustomFieldsInput = {
connectedAccountId?: InputMaybe<Scalars['String']>;
};

export type UpdateSellerInput = {
customFields?: InputMaybe<UpdateSellerCustomFieldsInput>;
customFields?: InputMaybe<Scalars['JSON']>;
id: Scalars['ID'];
name?: InputMaybe<Scalars['String']>;
};
Expand Down
Loading

0 comments on commit 905c1df

Please sign in to comment.