Feat/add discount condition batch (#2430)

* feat(medusa): Allow to add items to a discount condition by batch + cleanup of discounts and discount conditions end points

* style(medusa): cleanup catch and log

* feat(medusa-react, medusa-js): Add support to add item batch to discount condition

* cleanup

* cleanup

* rename items to resources

* fix(medusa-js): url

* Create fast-suns-repair.md

* update naming

* tests(integration): Update tests to reflect API changes

* feat(medusa): Delete a condition should be idempotent on discount and condition

* revert
This commit is contained in:
Adrien de Peretti authored and GitHub committed 2022-10-13 16:34:06 +02:00
1 parent 143f8543e5
commit 765a2cccda
36 files changed
+1217 -1272

No files matched your search

@@ -912,6 +912,33 @@ export const adminHandlers = [
}
),
rest.post(
"/admin/discounts/:id/conditions/:conditionId/batch",
(req, res, ctx) => {
return res(
ctx.status(200),
ctx.json({
discount: {
...fixtures.get("discount"),
rule: {
...fixtures.get("discount").rule,
conditions: [
{
...fixtures.get("discount").rule.conditions[0],
products: [
...(fixtures.get("discount").rule.conditions[0]?.products ??
[]),
...(req.body as any).resources,
],
},
],
},
},
})
)
}
),
rest.get("/admin/draft-orders/", (req, res, ctx) => {
return res(
ctx.status(200),