Skip to content

Commit

Permalink
feat(core): Track stock allocations
Browse files Browse the repository at this point in the history
Relates to #319.

BREAKING CHANGE: The internal handling of stock movements has been refined,
which required changes to the DB schema. This will require a migration.
  • Loading branch information
michaelbromley committed Oct 19, 2020
1 parent b825df1 commit 75e3f9c
Show file tree
Hide file tree
Showing 29 changed files with 823 additions and 383 deletions.
31 changes: 29 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 @@ -1636,6 +1636,7 @@ export type ProductVariant = Node & {
__typename?: 'ProductVariant';
enabled: Scalars['Boolean'];
stockOnHand: Scalars['Int'];
stockAllocated: Scalars['Int'];
trackInventory: GlobalFlag;
stockMovements: StockMovementList;
id: Scalars['ID'];
Expand Down Expand Up @@ -3521,6 +3522,8 @@ export type ShippingMethodList = PaginatedList & {

export enum StockMovementType {
ADJUSTMENT = 'ADJUSTMENT',
ALLOCATION = 'ALLOCATION',
RELEASE = 'RELEASE',
SALE = 'SALE',
CANCELLATION = 'CANCELLATION',
RETURN = 'RETURN'
Expand All @@ -3545,6 +3548,17 @@ export type StockAdjustment = Node & StockMovement & {
quantity: Scalars['Int'];
};

export type Allocation = Node & StockMovement & {
__typename?: 'Allocation';
id: Scalars['ID'];
createdAt: Scalars['DateTime'];
updatedAt: Scalars['DateTime'];
productVariant: ProductVariant;
type: StockMovementType;
quantity: Scalars['Int'];
orderLine: OrderLine;
};

export type Sale = Node & StockMovement & {
__typename?: 'Sale';
id: Scalars['ID'];
Expand All @@ -3553,7 +3567,7 @@ export type Sale = Node & StockMovement & {
productVariant: ProductVariant;
type: StockMovementType;
quantity: Scalars['Int'];
orderLine: OrderLine;
orderItem: OrderItem;
};

export type Cancellation = Node & StockMovement & {
Expand All @@ -3578,7 +3592,18 @@ export type Return = Node & StockMovement & {
orderItem: OrderItem;
};

export type StockMovementItem = StockAdjustment | Sale | Cancellation | Return;
export type Release = Node & StockMovement & {
__typename?: 'Release';
id: Scalars['ID'];
createdAt: Scalars['DateTime'];
updatedAt: Scalars['DateTime'];
productVariant: ProductVariant;
type: StockMovementType;
quantity: Scalars['Int'];
orderItem: OrderItem;
};

export type StockMovementItem = StockAdjustment | Allocation | Sale | Cancellation | Return | Release;

export type StockMovementList = {
__typename?: 'StockMovementList';
Expand Down Expand Up @@ -4050,6 +4075,7 @@ export type TaxRateSortParameter = {
export type ProductVariantFilterParameter = {
enabled?: Maybe<BooleanOperators>;
stockOnHand?: Maybe<NumberOperators>;
stockAllocated?: Maybe<NumberOperators>;
trackInventory?: Maybe<StringOperators>;
createdAt?: Maybe<DateOperators>;
updatedAt?: Maybe<DateOperators>;
Expand All @@ -4064,6 +4090,7 @@ export type ProductVariantFilterParameter = {

export type ProductVariantSortParameter = {
stockOnHand?: Maybe<SortOrder>;
stockAllocated?: Maybe<SortOrder>;
id?: Maybe<SortOrder>;
productId?: Maybe<SortOrder>;
createdAt?: Maybe<SortOrder>;
Expand Down
Loading

0 comments on commit 75e3f9c

Please sign in to comment.