From fd6c77adf7e52b1aa695d0a3417390dcd8e544a7 Mon Sep 17 00:00:00 2001 From: AlicjaSzu Date: Mon, 7 Sep 2020 12:48:19 +0200 Subject: [PATCH 1/2] update schema and types --- schema.graphql | 55 +++++++++++++++++++++------------------ src/orders/mutations.ts | 4 +-- src/products/mutations.ts | 10 +++---- src/types/globalTypes.ts | 2 ++ 4 files changed, 38 insertions(+), 33 deletions(-) diff --git a/schema.graphql b/schema.graphql index 065f5abf0..e2953571b 100644 --- a/schema.graphql +++ b/schema.graphql @@ -1072,7 +1072,7 @@ type Collection implements Node & ObjectWithMetadata { metadata: [MetadataItem]! privateMeta: [MetaStore]! @deprecated(reason: "Use the `privetaMetadata` field. This field will be removed after 2020-07-31.") meta: [MetaStore]! @deprecated(reason: "Use the `metadata` field. This field will be removed after 2020-07-31.") - products(filter: ProductFilterInput, before: String, after: String, first: Int, last: Int): ProductCountableConnection + products(filter: ProductFilterInput, sortBy: ProductOrder, before: String, after: String, first: Int, last: Int): ProductCountableConnection backgroundImage(size: Int): Image translation(languageCode: LanguageCodeEnum!): CollectionTranslation } @@ -1630,8 +1630,6 @@ type DeactivateAllUserTokens { accountErrors: [AccountError!]! } -scalar Decimal - type DeleteMetadata { errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") metadataErrors: [MetadataError!]! @@ -1778,7 +1776,7 @@ input DraftOrderCreateInput { billingAddress: AddressInput user: ID userEmail: String - discount: Decimal + discount: PositiveDecimal shippingAddress: AddressInput shippingMethod: ID voucher: ID @@ -1796,7 +1794,7 @@ input DraftOrderInput { billingAddress: AddressInput user: ID userEmail: String - discount: Decimal + discount: PositiveDecimal shippingAddress: AddressInput shippingMethod: ID voucher: ID @@ -2064,7 +2062,7 @@ type GiftCardCreate { input GiftCardCreateInput { startDate: Date endDate: Date - balance: Decimal + balance: PositiveDecimal userEmail: String code: String } @@ -2099,7 +2097,7 @@ type GiftCardUpdate { input GiftCardUpdateInput { startDate: Date endDate: Date - balance: Decimal + balance: PositiveDecimal userEmail: String } @@ -2251,9 +2249,11 @@ enum LanguageCodeEnum { IS IT JA + KM KO LT MN + MY NB NL PL @@ -2672,8 +2672,8 @@ type Mutation { productVariantClearPrivateMetadata(id: ID!, input: MetaPath!): ProductVariantClearPrivateMeta @deprecated(reason: "Use the `deletePrivateMetadata` mutation instead. This field will be removed after 2020-07-31.") variantImageAssign(imageId: ID!, variantId: ID!): VariantImageAssign variantImageUnassign(imageId: ID!, variantId: ID!): VariantImageUnassign - paymentCapture(amount: Decimal, paymentId: ID!): PaymentCapture - paymentRefund(amount: Decimal, paymentId: ID!): PaymentRefund + paymentCapture(amount: PositiveDecimal, paymentId: ID!): PaymentCapture + paymentRefund(amount: PositiveDecimal, paymentId: ID!): PaymentRefund paymentVoid(paymentId: ID!): PaymentVoid pageCreate(input: PageInput!): PageCreate pageDelete(id: ID!): PageDelete @@ -2692,7 +2692,7 @@ type Mutation { draftOrderUpdate(id: ID!, input: DraftOrderInput!): DraftOrderUpdate orderAddNote(order: ID!, input: OrderAddNoteInput!): OrderAddNote orderCancel(id: ID!): OrderCancel - orderCapture(amount: Decimal!, id: ID!): OrderCapture + orderCapture(amount: PositiveDecimal!, id: ID!): OrderCapture orderClearPrivateMeta(id: ID!, input: MetaPath!): OrderClearPrivateMeta @deprecated(reason: "Use the `deletePrivateMetadata` mutation instead. This field will be removed after 2020-07-31.") orderClearMeta(input: MetaPath!, token: UUID!): OrderClearMeta @deprecated(reason: "Use the `deleteMetadata` mutation instead. This field will be removed after 2020-07-31.") orderFulfill(input: OrderFulfillInput!, order: ID): OrderFulfill @@ -2703,7 +2703,7 @@ type Mutation { orderFulfillmentUpdateMeta(id: ID!, input: MetaInput!): FulfillmentUpdateMeta @deprecated(reason: "Use the `updateMetadata` mutation instead. This field will be removed after 2020-07-31.") orderFulfillmentUpdatePrivateMeta(id: ID!, input: MetaInput!): FulfillmentUpdatePrivateMeta @deprecated(reason: "Use the `updatePrivateMetadata` mutation instead. This field will be removed after 2020-07-31.") orderMarkAsPaid(id: ID!): OrderMarkAsPaid - orderRefund(amount: Decimal!, id: ID!): OrderRefund + orderRefund(amount: PositiveDecimal!, id: ID!): OrderRefund orderUpdate(id: ID!, input: OrderUpdateInput!): OrderUpdate orderUpdateMeta(input: MetaInput!, token: UUID!): OrderUpdateMeta @deprecated(reason: "Use the `updateMetadata` mutation instead. This field will be removed after 2020-07-31.") orderUpdatePrivateMeta(id: ID!, input: MetaInput!): OrderUpdatePrivateMeta @deprecated(reason: "Use the `updatePrivateMetadata` mutation instead. This field will be removed after 2020-07-31.") @@ -3127,6 +3127,7 @@ type OrderLine implements Node { digitalContentUrl: DigitalContentUrl thumbnail(size: Int): Image unitPrice: TaxedMoney + totalPrice: TaxedMoney variant: ProductVariant translatedProductName: String! translatedVariantName: String! @@ -3445,7 +3446,7 @@ type PaymentGateway { input PaymentInput { gateway: String! token: String - amount: Decimal + amount: PositiveDecimal billingAddress: AddressInput returnUrl: String } @@ -3614,6 +3615,8 @@ input PluginUpdateInput { configuration: [ConfigurationItemInput] } +scalar PositiveDecimal + input PriceRangeInput { gte: Float lte: Float @@ -3721,7 +3724,7 @@ input ProductCreateInput { weight: WeightScalar sku: String trackInventory: Boolean - basePrice: Decimal + basePrice: PositiveDecimal visibleInListings: Boolean productType: ID! stocks: [StockInput!] @@ -3855,7 +3858,7 @@ input ProductInput { weight: WeightScalar sku: String trackInventory: Boolean - basePrice: Decimal + basePrice: PositiveDecimal visibleInListings: Boolean } @@ -4102,8 +4105,8 @@ type ProductVariantBulkCreate { input ProductVariantBulkCreateInput { attributes: [AttributeValueInput]! - costPrice: Decimal - price: Decimal + costPrice: PositiveDecimal + price: PositiveDecimal sku: String! trackInventory: Boolean weight: WeightScalar @@ -4147,8 +4150,8 @@ type ProductVariantCreate { input ProductVariantCreateInput { attributes: [AttributeValueInput]! - costPrice: Decimal - price: Decimal + costPrice: PositiveDecimal + price: PositiveDecimal sku: String trackInventory: Boolean weight: WeightScalar @@ -4164,8 +4167,8 @@ type ProductVariantDelete { input ProductVariantInput { attributes: [AttributeValueInput] - costPrice: Decimal - price: Decimal + costPrice: PositiveDecimal + price: PositiveDecimal sku: String trackInventory: Boolean weight: WeightScalar @@ -4392,7 +4395,7 @@ input SaleFilterInput { input SaleInput { name: String type: DiscountValueTypeEnum - value: Decimal + value: PositiveDecimal products: [ID] categories: [ID] collections: [ID] @@ -4638,9 +4641,9 @@ type ShippingPriceDelete { input ShippingPriceInput { name: String - price: Decimal - minimumOrderPrice: Decimal - maximumOrderPrice: Decimal + price: PositiveDecimal + minimumOrderPrice: PositiveDecimal + maximumOrderPrice: PositiveDecimal minimumOrderWeight: WeightScalar maximumOrderWeight: WeightScalar type: ShippingMethodTypeEnum @@ -5350,11 +5353,11 @@ input VoucherInput { startDate: DateTime endDate: DateTime discountValueType: DiscountValueTypeEnum - discountValue: Decimal + discountValue: PositiveDecimal products: [ID] collections: [ID] categories: [ID] - minAmountSpent: Decimal + minAmountSpent: PositiveDecimal minCheckoutItemsQuantity: Int countries: [String] applyOncePerOrder: Boolean diff --git a/src/orders/mutations.ts b/src/orders/mutations.ts index 70253553d..29a907ff2 100644 --- a/src/orders/mutations.ts +++ b/src/orders/mutations.ts @@ -145,7 +145,7 @@ export const TypedOrderDraftFinalizeMutation = TypedMutation< const orderRefundMutation = gql` ${fragmentOrderDetails} ${orderErrorFragment} - mutation OrderRefund($id: ID!, $amount: Decimal!) { + mutation OrderRefund($id: ID!, $amount: PositiveDecimal!) { orderRefund(id: $id, amount: $amount) { errors: orderErrors { ...OrderErrorFragment @@ -202,7 +202,7 @@ export const TypedOrderMarkAsPaidMutation = TypedMutation< const orderCaptureMutation = gql` ${fragmentOrderDetails} ${orderErrorFragment} - mutation OrderCapture($id: ID!, $amount: Decimal!) { + mutation OrderCapture($id: ID!, $amount: PositiveDecimal!) { orderCapture(id: $id, amount: $amount) { errors: orderErrors { ...OrderErrorFragment diff --git a/src/products/mutations.ts b/src/products/mutations.ts index 4a641b5f6..c0544ebdb 100644 --- a/src/products/mutations.ts +++ b/src/products/mutations.ts @@ -143,7 +143,7 @@ export const productUpdateMutation = gql` $descriptionJson: JSONString $isPublished: Boolean! $name: String - $basePrice: Decimal + $basePrice: PositiveDecimal $seo: SeoInput $visibleInListings: Boolean ) { @@ -193,7 +193,7 @@ export const simpleProductUpdateMutation = gql` $descriptionJson: JSONString $isPublished: Boolean! $name: String - $basePrice: Decimal + $basePrice: PositiveDecimal $productVariantId: ID! $productVariantInput: ProductVariantInput! $seo: SeoInput @@ -285,7 +285,7 @@ export const productCreateMutation = gql` $descriptionJson: JSONString $isPublished: Boolean! $name: String! - $basePrice: Decimal + $basePrice: PositiveDecimal $productType: ID! $sku: String $seo: SeoInput @@ -355,8 +355,8 @@ export const variantUpdateMutation = gql` $removeStocks: [ID!]! $id: ID! $attributes: [AttributeValueInput] - $costPrice: Decimal - $price: Decimal + $costPrice: PositiveDecimal + $price: PositiveDecimal $sku: String $trackInventory: Boolean! $stocks: [StockInput!]! diff --git a/src/types/globalTypes.ts b/src/types/globalTypes.ts index d19661ac3..7430a65da 100644 --- a/src/types/globalTypes.ts +++ b/src/types/globalTypes.ts @@ -464,9 +464,11 @@ export enum LanguageCodeEnum { IS = "IS", IT = "IT", JA = "JA", + KM = "KM", KO = "KO", LT = "LT", MN = "MN", + MY = "MY", NB = "NB", NL = "NL", PL = "PL", From 90057a953665a8f1fff109c460745ee8d0a48d96 Mon Sep 17 00:00:00 2001 From: AlicjaSzu Date: Mon, 7 Sep 2020 13:06:00 +0200 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6709a37ef..547cf801d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ All notable, unreleased changes to this project will be documented in this file. - Update savebar design - #690 by @dominik-zeglen - Add metadata to orders - #688 by @dominik-zeglen - Add lazyload to locales - #692 by @eaglesemanation +- Update schema with PositiveDecimal type - #695 by @AlicjaSzu ## 2.10.1