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
+2 -5
View File
@@ -48,12 +48,9 @@ class OrderSubscriber {
await Promise.all(
order.discounts.map(async d => {
const usageCount = d.rule?.usage_count || 0
const usageCount = d?.usage_count || 0
return this.discountService_.update(d.id, {
rule: {
...d.rule,
usage_count: usageCount + 1,
},
usage_count: usageCount + 1,
})
})
)