fix: Disallow creating duplicate prices (#7866)

* fix: Disallow creating duplicate prices

* fix: Don't pass id to manager create in upsertWithReplace
This commit is contained in:
Stevche Radevski
2024-07-02 17:06:58 +02:00
committed by GitHub
parent 87375db9ef
commit b4aa7fb9a7
12 changed files with 560 additions and 350 deletions
@@ -163,6 +163,9 @@ export class PricingRepository
pl_rules_count: "price.pl_rules_count",
price_list_type: "price.pl_type",
price_list_id: "price.price_list_id",
all_rules_count: knex.raw(
"COALESCE(price.rules_count, 0) + COALESCE(price.pl_rules_count, 0)"
),
})
.join(priceSubQueryKnex.as("price"), "price.price_set_id", "ps.id")
.leftJoin("price_rule as pr", "pr.price_id", "price.id")
@@ -171,8 +174,8 @@ export class PricingRepository
.orderBy([
{ column: "price.has_price_list", order: "asc" },
{ column: "all_rules_count", order: "desc" },
{ column: "amount", order: "asc" },
{ column: "rules_count", order: "desc" },
])
if (quantity) {