Skip to content

Commit

Permalink
feat: new stock update mutations
Browse files Browse the repository at this point in the history
  • Loading branch information
JannikZed committed Aug 5, 2024
1 parent 49c6257 commit d7f0803
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 8 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
"@chronark/prefixed-id": "^0.4.1",
"@elastic/ecs-winston-format": "^1.5.3",
"@elastic/elasticsearch": "^8.14.0",
"@esbuild/darwin-arm64": "^0.23.0",
"@geist-ui/react": "^2.2.5",
"@paljs/plugins": "^6.0.7",
"@prisma/client": "^5.17.0",
Expand Down
52 changes: 49 additions & 3 deletions pkg/saleor/src/api/generated/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16358,6 +16358,7 @@ export type OrderFilterInput = {
channels?: InputMaybe<Array<Scalars["ID"]>>;
chargeStatus?: InputMaybe<Array<OrderChargeStatusEnum>>;
checkoutIds?: InputMaybe<Array<Scalars["ID"]>>;
checkoutTokens?: InputMaybe<Array<Scalars["UUID"]>>;
created?: InputMaybe<DateRangeInput>;
customer?: InputMaybe<Scalars["String"]>;
giftCardBought?: InputMaybe<Scalars["Boolean"]>;
Expand Down Expand Up @@ -33165,6 +33166,24 @@ export type ProductVariantStockEntryUpdateMutation = {
} | null;
};

export type BulkVariantStockUpdateMutationVariables = Exact<{
stocks: Array<StockBulkUpdateInput> | StockBulkUpdateInput;
}>;

export type BulkVariantStockUpdateMutation = {
__typename?: "Mutation";
stockBulkUpdate?: {
__typename?: "StockBulkUpdate";
count: number;
errors: Array<{
__typename?: "StockBulkUpdateError";
field?: string | null;
message?: string | null;
code: StockBulkUpdateErrorCode;
}>;
} | null;
};

export type ProductVariantBulkUpdateMutationVariables = Exact<{
variants:
| Array<ProductVariantBulkUpdateInput>
Expand Down Expand Up @@ -34631,7 +34650,7 @@ export type SaleorEntitySyncProductsQuery = {
};

export type SaleorProductVariantsBasicDataQueryVariables = Exact<{
ids: Array<Scalars["ID"]> | Scalars["ID"];
ids?: InputMaybe<Array<Scalars["ID"]> | Scalars["ID"]>;
first?: InputMaybe<Scalars["Int"]>;
after?: InputMaybe<Scalars["String"]>;
}>;
Expand All @@ -34653,6 +34672,7 @@ export type SaleorProductVariantsBasicDataQuery = {
__typename?: "ProductVariant";
id: string;
name: string;
sku?: string | null;
product: { __typename?: "Product"; id: string; name: string };
metadata: Array<{
__typename?: "MetadataItem";
Expand Down Expand Up @@ -35511,6 +35531,18 @@ export const ProductVariantStockEntryUpdateDocument = gql`
}
}
`;
export const BulkVariantStockUpdateDocument = gql`
mutation bulkVariantStockUpdate($stocks: [StockBulkUpdateInput!]!) {
stockBulkUpdate(stocks: $stocks) {
count
errors {
field
message
code
}
}
}
`;
export const ProductVariantBulkUpdateDocument = gql`
mutation productVariantBulkUpdate(
$variants: [ProductVariantBulkUpdateInput!]!
Expand Down Expand Up @@ -36198,7 +36230,7 @@ export const SaleorEntitySyncProductsDocument = gql`
`;
export const SaleorProductVariantsBasicDataDocument = gql`
query saleorProductVariantsBasicData(
$ids: [ID!]!
$ids: [ID!]
$first: Int
$after: String
) {
Expand All @@ -36213,6 +36245,7 @@ export const SaleorProductVariantsBasicDataDocument = gql`
node {
id
name
sku
product {
id
name
Expand Down Expand Up @@ -36725,6 +36758,19 @@ export function getSdk<C, E>(requester: Requester<C, E>) {
options,
) as Promise<ProductVariantStockEntryUpdateMutation>;
},
bulkVariantStockUpdate(
variables: BulkVariantStockUpdateMutationVariables,
options?: C,
): Promise<BulkVariantStockUpdateMutation> {
return requester<
BulkVariantStockUpdateMutation,
BulkVariantStockUpdateMutationVariables
>(
BulkVariantStockUpdateDocument,
variables,
options,
) as Promise<BulkVariantStockUpdateMutation>;
},
productVariantBulkUpdate(
variables: ProductVariantBulkUpdateMutationVariables,
options?: C,
Expand Down Expand Up @@ -37017,7 +37063,7 @@ export function getSdk<C, E>(requester: Requester<C, E>) {
) as Promise<SaleorEntitySyncProductsQuery>;
},
saleorProductVariantsBasicData(
variables: SaleorProductVariantsBasicDataQueryVariables,
variables?: SaleorProductVariantsBasicDataQueryVariables,
options?: C,
): Promise<SaleorProductVariantsBasicDataQuery> {
return requester<
Expand Down
11 changes: 11 additions & 0 deletions pkg/saleor/src/api/mutations/productVariantStocks.gql
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,14 @@ mutation productVariantStockEntryUpdate(
}
}
}

mutation bulkVariantStockUpdate($stocks: [StockBulkUpdateInput!]!) {
stockBulkUpdate(stocks: $stocks) {
count
errors {
field
message
code
}
}
}
7 changes: 2 additions & 5 deletions pkg/saleor/src/api/queries/products.gql
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,7 @@ query saleorEntitySyncProducts(
}
}

query saleorProductVariantsBasicData(
$ids: [ID!]!
$first: Int
$after: String
) {
query saleorProductVariantsBasicData($ids: [ID!], $first: Int, $after: String) {
productVariants(ids: $ids, first: $first, after: $after) {
pageInfo {
hasNextPage
Expand All @@ -183,6 +179,7 @@ query saleorProductVariantsBasicData(
node {
id
name
sku
product {
id
name
Expand Down
10 changes: 10 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d7f0803

Please sign in to comment.