From 576c7e1b35724816cb19c737fa1a967b95f57d32 Mon Sep 17 00:00:00 2001 From: Dawid Tarasiuk Date: Wed, 17 Jun 2020 10:31:33 +0200 Subject: [PATCH] Update queries types --- src/categories/fixtures.ts | 20 +++++++ src/categories/queries.ts | 1 + src/categories/types/CategoryDetails.ts | 1 + src/products/fixtures.ts | 60 +++++++++++++++++++ src/products/queries.ts | 10 ++-- .../types/CreateMultipleVariantsData.ts | 1 + src/products/types/Product.ts | 2 +- src/products/types/ProductCreate.ts | 2 +- src/products/types/ProductDetails.ts | 2 +- src/products/types/ProductImageCreate.ts | 2 +- src/products/types/ProductImageUpdate.ts | 2 +- src/products/types/ProductList.ts | 1 + src/products/types/ProductUpdate.ts | 2 +- .../types/ProductVariantAttributesFragment.ts | 1 + src/products/types/SimpleProductUpdate.ts | 2 +- 15 files changed, 98 insertions(+), 11 deletions(-) diff --git a/src/categories/fixtures.ts b/src/categories/fixtures.ts index c4317e829..6e680a223 100644 --- a/src/categories/fixtures.ts +++ b/src/categories/fixtures.ts @@ -129,6 +129,7 @@ export const category: ( variants: [ { __typename: "ProductVariant" as "ProductVariant", + id: "pv70010", price: { __typename: "Money" as "Money", amount: 5, @@ -137,6 +138,7 @@ export const category: ( }, { __typename: "ProductVariant" as "ProductVariant", + id: "pv70010", price: { __typename: "Money" as "Money", amount: 10, @@ -163,6 +165,7 @@ export const category: ( variants: [ { __typename: "ProductVariant" as "ProductVariant", + id: "pv70010", price: { __typename: "Money" as "Money", amount: 5, @@ -171,6 +174,7 @@ export const category: ( }, { __typename: "ProductVariant" as "ProductVariant", + id: "pv70010", price: { __typename: "Money" as "Money", amount: 10, @@ -197,6 +201,7 @@ export const category: ( variants: [ { __typename: "ProductVariant" as "ProductVariant", + id: "pv70010", price: { __typename: "Money" as "Money", amount: 5, @@ -205,6 +210,7 @@ export const category: ( }, { __typename: "ProductVariant" as "ProductVariant", + id: "pv70010", price: { __typename: "Money" as "Money", amount: 10, @@ -231,6 +237,7 @@ export const category: ( variants: [ { __typename: "ProductVariant" as "ProductVariant", + id: "pv70010", price: { __typename: "Money" as "Money", amount: 5, @@ -239,6 +246,7 @@ export const category: ( }, { __typename: "ProductVariant" as "ProductVariant", + id: "pv70010", price: { __typename: "Money" as "Money", amount: 10, @@ -265,6 +273,7 @@ export const category: ( variants: [ { __typename: "ProductVariant" as "ProductVariant", + id: "pv70010", price: { __typename: "Money" as "Money", amount: 5, @@ -273,6 +282,7 @@ export const category: ( }, { __typename: "ProductVariant" as "ProductVariant", + id: "pv70010", price: { __typename: "Money" as "Money", amount: 10, @@ -299,6 +309,7 @@ export const category: ( variants: [ { __typename: "ProductVariant" as "ProductVariant", + id: "pv70010", price: { __typename: "Money" as "Money", amount: 5, @@ -307,6 +318,7 @@ export const category: ( }, { __typename: "ProductVariant" as "ProductVariant", + id: "pv70010", price: { __typename: "Money" as "Money", amount: 10, @@ -333,6 +345,7 @@ export const category: ( variants: [ { __typename: "ProductVariant" as "ProductVariant", + id: "pv70010", price: { __typename: "Money" as "Money", amount: 5, @@ -341,6 +354,7 @@ export const category: ( }, { __typename: "ProductVariant" as "ProductVariant", + id: "pv70010", price: { __typename: "Money" as "Money", amount: 10, @@ -367,6 +381,7 @@ export const category: ( variants: [ { __typename: "ProductVariant" as "ProductVariant", + id: "pv70010", price: { __typename: "Money" as "Money", amount: 5, @@ -375,6 +390,7 @@ export const category: ( }, { __typename: "ProductVariant" as "ProductVariant", + id: "pv70010", price: { __typename: "Money" as "Money", amount: 10, @@ -401,6 +417,7 @@ export const category: ( variants: [ { __typename: "ProductVariant" as "ProductVariant", + id: "pv70010", price: { __typename: "Money" as "Money", amount: 5, @@ -409,6 +426,7 @@ export const category: ( }, { __typename: "ProductVariant" as "ProductVariant", + id: "pv70010", price: { __typename: "Money" as "Money", amount: 10, @@ -435,6 +453,7 @@ export const category: ( variants: [ { __typename: "ProductVariant" as "ProductVariant", + id: "pv70010", price: { __typename: "Money" as "Money", amount: 5, @@ -443,6 +462,7 @@ export const category: ( }, { __typename: "ProductVariant" as "ProductVariant", + id: "pv70010", price: { __typename: "Money" as "Money", amount: 10, diff --git a/src/categories/queries.ts b/src/categories/queries.ts index e89afa141..0d90be86e 100644 --- a/src/categories/queries.ts +++ b/src/categories/queries.ts @@ -113,6 +113,7 @@ export const categoryDetails = gql` name } variants { + id price { amount currency diff --git a/src/categories/types/CategoryDetails.ts b/src/categories/types/CategoryDetails.ts index 8be554dc3..43f1daf35 100644 --- a/src/categories/types/CategoryDetails.ts +++ b/src/categories/types/CategoryDetails.ts @@ -81,6 +81,7 @@ export interface CategoryDetails_category_products_edges_node_variants_price { export interface CategoryDetails_category_products_edges_node_variants { __typename: "ProductVariant"; + id: string; price: CategoryDetails_category_products_edges_node_variants_price | null; } diff --git a/src/products/fixtures.ts b/src/products/fixtures.ts index aed113474..6cc5b351c 100644 --- a/src/products/fixtures.ts +++ b/src/products/fixtures.ts @@ -335,6 +335,7 @@ export const products = ( variants: [ { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 15, @@ -343,6 +344,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 35, @@ -351,6 +353,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 49, @@ -379,6 +382,7 @@ export const products = ( variants: [ { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 15, @@ -387,6 +391,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 30, @@ -395,6 +400,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 49, @@ -423,6 +429,7 @@ export const products = ( variants: [ { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 15, @@ -431,6 +438,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 30, @@ -439,6 +447,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 49, @@ -482,6 +491,7 @@ export const products = ( variants: [ { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 3, @@ -490,6 +500,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 7, @@ -498,6 +509,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 5, @@ -541,6 +553,7 @@ export const products = ( variants: [ { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 3, @@ -549,6 +562,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 5, @@ -557,6 +571,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 7, @@ -600,6 +615,7 @@ export const products = ( variants: [ { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 5, @@ -608,6 +624,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 7, @@ -616,6 +633,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 3, @@ -659,6 +677,7 @@ export const products = ( variants: [ { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 5, @@ -667,6 +686,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 7, @@ -675,6 +695,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 3, @@ -718,6 +739,7 @@ export const products = ( variants: [ { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 5, @@ -726,6 +748,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 7, @@ -734,6 +757,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 3, @@ -777,6 +801,7 @@ export const products = ( variants: [ { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 7, @@ -785,6 +810,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 3, @@ -793,6 +819,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 5, @@ -836,6 +863,7 @@ export const products = ( variants: [ { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 5, @@ -844,6 +872,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 7, @@ -852,6 +881,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 3, @@ -895,6 +925,7 @@ export const products = ( variants: [ { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 5, @@ -903,6 +934,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 7, @@ -911,6 +943,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 3, @@ -954,6 +987,7 @@ export const products = ( variants: [ { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 5, @@ -962,6 +996,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 7, @@ -970,6 +1005,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 3, @@ -1013,6 +1049,7 @@ export const products = ( variants: [ { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 5, @@ -1021,6 +1058,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 7, @@ -1029,6 +1067,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 3, @@ -1072,6 +1111,7 @@ export const products = ( variants: [ { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 5, @@ -1080,6 +1120,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 7, @@ -1088,6 +1129,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 3, @@ -1131,6 +1173,7 @@ export const products = ( variants: [ { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 5, @@ -1139,6 +1182,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 7, @@ -1147,6 +1191,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 3, @@ -1190,6 +1235,7 @@ export const products = ( variants: [ { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 5, @@ -1198,6 +1244,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 7, @@ -1206,6 +1253,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 3, @@ -1249,6 +1297,7 @@ export const products = ( variants: [ { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 5, @@ -1257,6 +1306,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 7, @@ -1265,6 +1315,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 3, @@ -1308,6 +1359,7 @@ export const products = ( variants: [ { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 5, @@ -1316,6 +1368,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 7, @@ -1324,6 +1377,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 3, @@ -1367,6 +1421,7 @@ export const products = ( variants: [ { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 5, @@ -1375,6 +1430,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 7, @@ -1383,6 +1439,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 3, @@ -1426,6 +1483,7 @@ export const products = ( variants: [ { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 5, @@ -1434,6 +1492,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 7, @@ -1442,6 +1501,7 @@ export const products = ( }, { __typename: "ProductVariant", + id: "pv70010", price: { __typename: "Money", amount: 3, diff --git a/src/products/queries.ts b/src/products/queries.ts index 32945bdd0..a98bedbc3 100644 --- a/src/products/queries.ts +++ b/src/products/queries.ts @@ -79,6 +79,7 @@ export const productFragment = gql` `; const productVariantAttributesFragment = gql` + ${fragmentMoney} fragment ProductVariantAttributesFragment on Product { id attributes { @@ -113,9 +114,9 @@ const productVariantAttributesFragment = gql` } } variants { + id price { - amount - currency + ...Money } } } @@ -308,6 +309,7 @@ export const useInitialProductFilterDataQuery = makeQuery< >(initialProductFilterDataQuery); const productListQuery = gql` + ${fragmentMoney} ${productFragment} query ProductList( $first: Int @@ -338,9 +340,9 @@ const productListQuery = gql` } } variants { + id price { - amount - currency + ...Money } } } diff --git a/src/products/types/CreateMultipleVariantsData.ts b/src/products/types/CreateMultipleVariantsData.ts index 183a294eb..5654a5d23 100644 --- a/src/products/types/CreateMultipleVariantsData.ts +++ b/src/products/types/CreateMultipleVariantsData.ts @@ -66,6 +66,7 @@ export interface CreateMultipleVariantsData_product_variants_price { export interface CreateMultipleVariantsData_product_variants { __typename: "ProductVariant"; + id: string; price: CreateMultipleVariantsData_product_variants_price | null; } diff --git a/src/products/types/Product.ts b/src/products/types/Product.ts index 7c7424d58..d1e6f806b 100644 --- a/src/products/types/Product.ts +++ b/src/products/types/Product.ts @@ -82,8 +82,8 @@ export interface Product_variants_stocks { export interface Product_variants { __typename: "ProductVariant"; - price: Product_variants_price | null; id: string; + price: Product_variants_price | null; sku: string; name: string; margin: number | null; diff --git a/src/products/types/ProductCreate.ts b/src/products/types/ProductCreate.ts index 97e1b0976..9ec93107a 100644 --- a/src/products/types/ProductCreate.ts +++ b/src/products/types/ProductCreate.ts @@ -88,8 +88,8 @@ export interface ProductCreate_productCreate_product_variants_stocks { export interface ProductCreate_productCreate_product_variants { __typename: "ProductVariant"; - price: ProductCreate_productCreate_product_variants_price | null; id: string; + price: ProductCreate_productCreate_product_variants_price | null; sku: string; name: string; margin: number | null; diff --git a/src/products/types/ProductDetails.ts b/src/products/types/ProductDetails.ts index d4e71183c..28469777d 100644 --- a/src/products/types/ProductDetails.ts +++ b/src/products/types/ProductDetails.ts @@ -82,8 +82,8 @@ export interface ProductDetails_product_variants_stocks { export interface ProductDetails_product_variants { __typename: "ProductVariant"; - price: ProductDetails_product_variants_price | null; id: string; + price: ProductDetails_product_variants_price | null; sku: string; name: string; margin: number | null; diff --git a/src/products/types/ProductImageCreate.ts b/src/products/types/ProductImageCreate.ts index 60386f6c7..dcd9ecca8 100644 --- a/src/products/types/ProductImageCreate.ts +++ b/src/products/types/ProductImageCreate.ts @@ -88,8 +88,8 @@ export interface ProductImageCreate_productImageCreate_product_variants_stocks { export interface ProductImageCreate_productImageCreate_product_variants { __typename: "ProductVariant"; - price: ProductImageCreate_productImageCreate_product_variants_price | null; id: string; + price: ProductImageCreate_productImageCreate_product_variants_price | null; sku: string; name: string; margin: number | null; diff --git a/src/products/types/ProductImageUpdate.ts b/src/products/types/ProductImageUpdate.ts index d78778fa7..7d5e39197 100644 --- a/src/products/types/ProductImageUpdate.ts +++ b/src/products/types/ProductImageUpdate.ts @@ -88,8 +88,8 @@ export interface ProductImageUpdate_productImageUpdate_product_variants_stocks { export interface ProductImageUpdate_productImageUpdate_product_variants { __typename: "ProductVariant"; - price: ProductImageUpdate_productImageUpdate_product_variants_price | null; id: string; + price: ProductImageUpdate_productImageUpdate_product_variants_price | null; sku: string; name: string; margin: number | null; diff --git a/src/products/types/ProductList.ts b/src/products/types/ProductList.ts index 61bcdb103..002a38712 100644 --- a/src/products/types/ProductList.ts +++ b/src/products/types/ProductList.ts @@ -45,6 +45,7 @@ export interface ProductList_products_edges_node_variants_price { export interface ProductList_products_edges_node_variants { __typename: "ProductVariant"; + id: string; price: ProductList_products_edges_node_variants_price | null; } diff --git a/src/products/types/ProductUpdate.ts b/src/products/types/ProductUpdate.ts index 76a64660d..0bf0f7184 100644 --- a/src/products/types/ProductUpdate.ts +++ b/src/products/types/ProductUpdate.ts @@ -88,8 +88,8 @@ export interface ProductUpdate_productUpdate_product_variants_stocks { export interface ProductUpdate_productUpdate_product_variants { __typename: "ProductVariant"; - price: ProductUpdate_productUpdate_product_variants_price | null; id: string; + price: ProductUpdate_productUpdate_product_variants_price | null; sku: string; name: string; margin: number | null; diff --git a/src/products/types/ProductVariantAttributesFragment.ts b/src/products/types/ProductVariantAttributesFragment.ts index 5a07c9b09..334fa66fd 100644 --- a/src/products/types/ProductVariantAttributesFragment.ts +++ b/src/products/types/ProductVariantAttributesFragment.ts @@ -66,6 +66,7 @@ export interface ProductVariantAttributesFragment_variants_price { export interface ProductVariantAttributesFragment_variants { __typename: "ProductVariant"; + id: string; price: ProductVariantAttributesFragment_variants_price | null; } diff --git a/src/products/types/SimpleProductUpdate.ts b/src/products/types/SimpleProductUpdate.ts index d1320f6c9..b745c08f9 100644 --- a/src/products/types/SimpleProductUpdate.ts +++ b/src/products/types/SimpleProductUpdate.ts @@ -88,8 +88,8 @@ export interface SimpleProductUpdate_productUpdate_product_variants_stocks { export interface SimpleProductUpdate_productUpdate_product_variants { __typename: "ProductVariant"; - price: SimpleProductUpdate_productUpdate_product_variants_price | null; id: string; + price: SimpleProductUpdate_productUpdate_product_variants_price | null; sku: string; name: string; margin: number | null;