Skip to content

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

Add changelog, migration and graphql schema

fowczarekc4b9d27e0e0c
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 26e618e34b..cdf96e5c24 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,7 @@ All notable, unreleased changes to this project will be documented in this file.
- Fix product type taxes select - #4453 by @benekex2
- Fix form reloading - #4467 by @dominik-zeglen
- Fix time zone based tests - #4468 by @fowczarek
+- Add voucher once per customer - #4442 by @fowczarek
## 2.8.0
diff --git a/saleor/discount/migrations/0016_auto_20190716_0330.py b/saleor/discount/migrations/0016_auto_20190716_0330.py
new file mode 100644
index 0000000000..c4bc5d3cfe
--- /dev/null
+++ b/saleor/discount/migrations/0016_auto_20190716_0330.py
@@ -0,0 +1,41 @@
+# Generated by Django 2.2.3 on 2019-07-16 08:30
+
+import django.db.models.deletion
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [("discount", "0015_voucher_min_quantity_of_products")]
+
+ operations = [
+ migrations.AddField(
+ model_name="voucher",
+ name="apply_once_per_customer",
+ field=models.BooleanField(default=False),
+ ),
+ migrations.CreateModel(
+ name="VoucherCustomer",
+ fields=[
+ (
+ "id",
+ models.AutoField(
+ auto_created=True,
+ primary_key=True,
+ serialize=False,
+ verbose_name="ID",
+ ),
+ ),
+ ("customer_email", models.EmailField(max_length=254)),
+ (
+ "voucher",
+ models.ForeignKey(
+ on_delete=django.db.models.deletion.CASCADE,
+ related_name="customers",
+ to="discount.Voucher",
+ ),
+ ),
+ ],
+ options={"unique_together": {("voucher", "customer_email")}},
+ ),
+ ]
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index 3c05b4c190..61e1acebf8 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -3135,6 +3135,7 @@ type Voucher implements Node {
startDate: DateTime!
endDate: DateTime
applyOncePerOrder: Boolean!
+ applyOncePerCustomer: Boolean!
discountValueType: DiscountValueTypeEnum!
discountValue: Float!
minAmountSpent: Money
@@ -3206,6 +3207,7 @@ input VoucherInput {
minCheckoutItemsQuantity: Int
countries: [String]
applyOncePerOrder: Boolean
+ applyOncePerCustomer: Boolean
usageLimit: Int
}