Skip to content

Commit

Permalink
feat(core): Allow custom fields to be set on OrderLine
Browse files Browse the repository at this point in the history
BREAKING CHANGE: This change allows custom fields to be defined on the OrderLine entity. When they are, then the "addItemToOrder" mutation will accept a third argument - "customFields", which matches the fields specified in the config. Additionally, a couple of mutations have been renamed: "removeItemFromOrder" -> "removeOrderLine", "adjustItemQuantity" -> "adjustOrderLine" and their "orderItemId" argument has been renamed to "orderLineId".

Closes #109
  • Loading branch information
michaelbromley committed May 31, 2019
1 parent a2d847d commit a4b7e07
Show file tree
Hide file tree
Showing 20 changed files with 647 additions and 512 deletions.
254 changes: 130 additions & 124 deletions admin-ui/src/app/common/generated-types.ts

Large diffs are not rendered by default.

26 changes: 19 additions & 7 deletions packages/common/src/generated-shop-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1105,8 +1105,8 @@ export type LoginResult = {

export type Mutation = {
addItemToOrder?: Maybe<Order>;
removeItemFromOrder?: Maybe<Order>;
adjustItemQuantity?: Maybe<Order>;
removeOrderLine?: Maybe<Order>;
adjustOrderLine?: Maybe<Order>;
transitionOrderToState?: Maybe<Order>;
setOrderShippingAddress?: Maybe<Order>;
setOrderShippingMethod?: Maybe<Order>;
Expand Down Expand Up @@ -1153,15 +1153,17 @@ export type Mutation = {
export type MutationAddItemToOrderArgs = {
productVariantId: Scalars['ID'];
quantity: Scalars['Int'];
customFields?: Maybe<OrderLineCustomFieldsInput>;
};

export type MutationRemoveItemFromOrderArgs = {
orderItemId: Scalars['ID'];
export type MutationRemoveOrderLineArgs = {
orderLineId: Scalars['ID'];
};

export type MutationAdjustItemQuantityArgs = {
orderItemId: Scalars['ID'];
quantity: Scalars['Int'];
export type MutationAdjustOrderLineArgs = {
orderLineId: Scalars['ID'];
quantity?: Maybe<Scalars['Int']>;
customFields?: Maybe<OrderLineCustomFieldsInput>;
};

export type MutationTransitionOrderToStateArgs = {
Expand Down Expand Up @@ -1335,6 +1337,15 @@ export type OrderLine = Node & {
totalPrice: Scalars['Int'];
adjustments: Array<Adjustment>;
order: Order;
customFields?: Maybe<OrderLineCustomFields>;
};

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

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

export type OrderList = PaginatedList & {
Expand Down Expand Up @@ -1620,6 +1631,7 @@ export type Query = {
nextOrderStates: Array<Scalars['String']>;
order?: Maybe<Order>;
orderByCode?: Maybe<Order>;
/** Get a Product either by id or slug. If neither id nor slug is speicified, an error will result. */
product?: Maybe<Product>;
products: ProductList;
search: SearchResponse;
Expand Down
Loading

0 comments on commit a4b7e07

Please sign in to comment.