fix(medusa): Move discount usage from rule to discount

This commit is contained in:
olivermrbl
2021-03-29 10:15:41 +02:00
parent 08bb111e29
commit d9cd52a177
17 changed files with 188 additions and 59 deletions
+18 -2
View File
@@ -16,6 +16,24 @@ module.exports = async (connection, data = {}) => {
tax_rate: 0,
});
await manager.insert(DiscountRule, {
id: "test-discount-rule",
description: "Dynamic rule",
type: "percentage",
value: 10,
allocation: "total",
});
await manager.insert(Discount, {
id: "test-discount",
code: "DYNAMIC",
rule_id: "test-discount-rule",
is_dynamic: true,
usage_count: 0,
usage_limit: 1,
is_disabled: false,
});
const d = await manager.create(Discount, {
id: "test-discount",
code: "CREATED",
@@ -29,8 +47,6 @@ module.exports = async (connection, data = {}) => {
type: "fixed",
value: 10000,
allocation: "total",
usage_limit: 2,
usage_count: 2,
});
d.rule = dr;