Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add missing description for discount types. (#13261)

Bhuvnesh51ce0f66c2fe
diff --git a/CHANGELOG.md b/CHANGELOG.md
index dd4ec334d7..1c59a0f217 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -94,6 +94,7 @@ All notable, unreleased changes to this project will be documented in this file.
- Add missing descriptions to Warehouse module. - #13264 by @Smit-Parmar
- Add missing descriptions to Product module. - #13259 by @FremahA
- Add missing description for Invoice module - #13265 by @DevilsAutumn
+- Add missing descriptions to Discount module - #13261 by @devilsautumn
# 3.14.0
diff --git a/saleor/graphql/discount/types/discounts.py b/saleor/graphql/discount/types/discounts.py
index 9e861db797..ab49c670ec 100644
--- a/saleor/graphql/discount/types/discounts.py
+++ b/saleor/graphql/discount/types/discounts.py
@@ -11,10 +11,15 @@ from ..enums import DiscountValueTypeEnum, OrderDiscountTypeEnum
class OrderDiscount(ModelObjectType[models.OrderDiscount]):
- id = graphene.GlobalID(required=True)
- type = OrderDiscountTypeEnum(required=True)
- name = graphene.String()
- translated_name = graphene.String()
+ id = graphene.GlobalID(required=True, description="The ID of discount applied.")
+ type = OrderDiscountTypeEnum(
+ required=True,
+ description="The type of applied discount: Sale, Voucher or Manual.",
+ )
+ name = graphene.String(description="The name of applied discount.")
+ translated_name = graphene.String(
+ description="Translated name of the applied discount."
+ )
value_type = graphene.Field(
DiscountValueTypeEnum,
required=True,
diff --git a/saleor/graphql/discount/types/sales.py b/saleor/graphql/discount/types/sales.py
index 80429dda96..6a9f96d563 100644
--- a/saleor/graphql/discount/types/sales.py
+++ b/saleor/graphql/discount/types/sales.py
@@ -35,10 +35,20 @@ from ..enums import SaleType
class SaleChannelListing(ModelObjectType[models.SaleChannelListing]):
- id = graphene.GlobalID(required=True)
- channel = graphene.Field(Channel, required=True)
- discount_value = graphene.Float(required=True)
- currency = graphene.String(required=True)
+ id = graphene.GlobalID(required=True, description="The ID of the channel listing.")
+ channel = graphene.Field(
+ Channel,
+ required=True,
+ description="The channel in which the sale is available.",
+ )
+ discount_value = graphene.Float(
+ required=True,
+ description="The value of the discount applied to the sale in the channel.",
+ )
+ currency = graphene.String(
+ required=True,
+ description="The currency in which the discount value is specified.",
+ )
class Meta:
description = "Represents sale channel listing."
@@ -51,13 +61,19 @@ class SaleChannelListing(ModelObjectType[models.SaleChannelListing]):
class Sale(ChannelContextTypeWithMetadata, ModelObjectType[models.Sale]):
- id = graphene.GlobalID(required=True)
- name = graphene.String(required=True)
- type = SaleType(required=True)
- start_date = graphene.DateTime(required=True)
- end_date = graphene.DateTime()
- created = graphene.DateTime(required=True)
- updated_at = graphene.DateTime(required=True)
+ id = graphene.GlobalID(required=True, description="The ID of the sale.")
+ name = graphene.String(required=True, description="The name of the sale.")
+ type = SaleType(required=True, description="Type of the sale, fixed or percentage.")
+ start_date = graphene.DateTime(
+ required=True, description="The start date and time of the sale."
+ )
+ end_date = graphene.DateTime(description="The end date and time of the sale.")
+ created = graphene.DateTime(
+ required=True, description="The date and time when the sale was created."
+ )
+ updated_at = graphene.DateTime(
+ required=True, description="The date and time when the sale was updated."
+ )
categories = ConnectionField(
CategoryCountableConnection,
description="List of categories this sale applies to.",
diff --git a/saleor/graphql/discount/types/vouchers.py b/saleor/graphql/discount/types/vouchers.py
index 370fc228e7..bb5301cd7b 100644
--- a/saleor/graphql/discount/types/vouchers.py
+++ b/saleor/graphql/discount/types/vouchers.py
@@ -34,11 +34,21 @@ from ..enums import DiscountValueTypeEnum, VoucherTypeEnum
class VoucherChannelListing(ModelObjectType[models.VoucherChannelListing]):
- id = graphene.GlobalID(required=True)
- channel = graphene.Field(Channel, required=True)
- discount_value = graphene.Float(required=True)
- currency = graphene.String(required=True)
- min_spent = graphene.Field(Money)
+ id = graphene.GlobalID(required=True, description="The ID of channel listing.")
+ channel = graphene.Field(
+ Channel,
+ required=True,
+ description="The channel in which voucher can be applied.",
+ )
+ discount_value = graphene.Float(
+ required=True, description="The value of the discount on voucher in a channel."
+ )
+ currency = graphene.String(
+ required=True, description="Currency code for voucher in a channel."
+ )
+ min_spent = graphene.Field(
+ Money, description="Minimum order value for voucher to apply in channel."
+ )
class Meta:
description = "Represents voucher channel listing."
@@ -51,17 +61,33 @@ class VoucherChannelListing(ModelObjectType[models.VoucherChannelListing]):
class Voucher(ChannelContextTypeWithMetadata[models.Voucher]):
- id = graphene.GlobalID(required=True)
- name = graphene.String()
- code = graphene.String(required=True)
- usage_limit = graphene.Int()
- used = graphene.Int(required=True)
- start_date = graphene.DateTime(required=True)
- end_date = graphene.DateTime()
- apply_once_per_order = graphene.Boolean(required=True)
- apply_once_per_customer = graphene.Boolean(required=True)
- only_for_staff = graphene.Boolean(required=True)
- min_checkout_items_quantity = graphene.Int()
+ id = graphene.GlobalID(required=True, description="The ID of the voucher.")
+ name = graphene.String(description="The name of the voucher.")
+ code = graphene.String(required=True, description="The code of the voucher.")
+ usage_limit = graphene.Int(description="The number of times a voucher can be used.")
+ used = graphene.Int(required=True, description="Usage count of the voucher.")
+ start_date = graphene.DateTime(
+ required=True, description="The start date and time of voucher."
+ )
+ end_date = graphene.DateTime(description="The end date and time of voucher.")
+ apply_once_per_order = graphene.Boolean(
+ required=True,
+ description="Determine if the voucher should be applied once per order. If set "
+ "to True, the voucher is applied to a single cheapest eligible product in "
+ "checkout.",
+ )
+ apply_once_per_customer = graphene.Boolean(
+ required=True,
+ description="Determine if the voucher usage should be limited to one use per "
+ "customer.",
+ )
+ only_for_staff = graphene.Boolean(
+ required=True,
+ description="Determine if the voucher is available only for staff members.",
+ )
+ min_checkout_items_quantity = graphene.Int(
+ description="Determine minimum quantity of items for checkout."
+ )
categories = ConnectionField(
CategoryCountableConnection,
description="List of categories this voucher applies to.",
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index 716e554c6a..75bb88c952 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -8331,6 +8331,7 @@ type SaleTranslation implements Node @doc(category: "Discounts") {
Sales allow creating discounts for categories, collections or products and are visible to all the customers.
"""
type Sale implements Node & ObjectWithMetadata @doc(category: "Discounts") {
+ """The ID of the sale."""
id: ID!
"""List of private metadata items. Requires staff permissions to access."""
@@ -8370,11 +8371,23 @@ type Sale implements Node & ObjectWithMetadata @doc(category: "Discounts") {
Added in Saleor 3.3.
"""
metafields(keys: [String!]): Metadata
+
+ """The name of the sale."""
name: String!
+
+ """Type of the sale, fixed or percentage."""
type: SaleType!
+
+ """The start date and time of the sale."""
startDate: DateTime!
+
+ """The end date and time of the sale."""
endDate: DateTime
+
+ """The date and time when the sale was created."""
created: DateTime!
+
+ """The date and time when the sale was updated."""
updatedAt: DateTime!
"""List of categories this sale applies to."""
@@ -8529,9 +8542,16 @@ type ProductVariantCountableEdge @doc(category: "Products") {
"""Represents sale channel listing."""
type SaleChannelListing implements Node @doc(category: "Discounts") {
+ """The ID of the channel listing."""
id: ID!
+
+ """The channel in which the sale is available."""
channel: Channel!
+
+ """The value of the discount applied to the sale in the channel."""
discountValue: Float!
+
+ """The currency in which the discount value is specified."""
currency: String!
}
@@ -8565,6 +8585,7 @@ type VoucherTranslation implements Node @doc(category: "Discounts") {
Vouchers allow giving discounts to particular customers on categories, collections or specific products. They can be used during checkout by providing valid voucher codes.
"""
type Voucher implements Node & ObjectWithMetadata @doc(category: "Discounts") {
+ """The ID of the voucher."""
id: ID!
"""List of private metadata items. Requires staff permissions to access."""
@@ -8604,15 +8625,39 @@ type Voucher implements Node & ObjectWithMetadata @doc(category: "Discounts") {
Added in Saleor 3.3.
"""
metafields(keys: [String!]): Metadata
+
+ """The name of the voucher."""
name: String
+
+ """The code of the voucher."""
code: String!
+
+ """The number of times a voucher can be used."""
usageLimit: Int
+
+ """Usage count of the voucher."""
used: Int!
+
+ """The start date and time of voucher."""
startDate: DateTime!
+
+ """The end date and time of voucher."""
endDate: DateTime
+
+ """
+ Determine if the voucher should be applied once per order. If set to True, the voucher is applied to a single cheapest eligible product in checkout.
+ """
applyOncePerOrder: Boolean!
+
+ """
+ Determine if the voucher usage should be limited to one use per customer.
+ """
applyOncePerCustomer: Boolean!
+
+ """Determine if the voucher is available only for staff members."""
onlyForStaff: Boolean!
+
+ """Determine minimum quantity of items for checkout."""
minCheckoutItemsQuantity: Int
"""List of categories this voucher applies to."""
@@ -8750,10 +8795,19 @@ enum VoucherTypeEnum @doc(category: "Discounts") {
"""Represents voucher channel listing."""
type VoucherChannelListing implements Node @doc(category: "Discounts") {
+ """The ID of channel listing."""
id: ID!
+
+ """The channel in which voucher can be applied."""
channel: Channel!
+
+ """The value of the discount on voucher in a channel."""
discountValue: Float!
+
+ """Currency code for voucher in a channel."""
currency: String!
+
+ """Minimum order value for voucher to apply in channel."""
minSpent: Money
}
@@ -11560,9 +11614,16 @@ type OrderEventDiscountObject @doc(category: "Orders") {
"""Contains all details related to the applied discount to the order."""
type OrderDiscount implements Node @doc(category: "Discounts") {
+ """The ID of discount applied."""
id: ID!
+
+ """The type of applied discount: Sale, Voucher or Manual."""
type: OrderDiscountType!
+
+ """The name of applied discount."""
name: String
+
+ """Translated name of the applied discount."""
translatedName: String
"""Type of the discount: fixed or percent"""