Skip to content

Commit

Permalink
Feat/add discount condition batch (medusajs#2430)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
adrien2p authored and ymaheshwari1 committed Oct 26, 2022
1 parent 2a8d03b commit 28fd105
Show file tree
Hide file tree
Showing 36 changed files with 1,217 additions and 1,272 deletions.
7 changes: 7 additions & 0 deletions .changeset/fast-suns-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@medusajs/medusa-js": patch
"medusa-react": patch
"@medusajs/medusa": patch
---

Feat(medusa, medusa-js, medusa-react): add resources to discount condition by batch
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ Object {
}
`;
exports[`/admin/discounts GET /admin/discounts/:id/conditions/:condition_id throws if condition does not belong to discount: DiscountCondition with id test-condition was not found for Discount test-discount-2 1`] = `"Request failed with status code 404"`;
exports[`/admin/discounts GET /admin/discounts/:id/conditions/:condition_id throws if condition does not exist: DiscountCondition with id test-condition was not found 1`] = `"Request failed with status code 404"`;
exports[`/admin/discounts POST /admin/discounts fails if multiple types of resources are provided on update 1`] = `
Object {
"message": "Only one of products, product_types is allowed, Only one of product_types, products is allowed",
Expand All @@ -77,8 +73,6 @@ Object {
}
`;
exports[`/admin/discounts POST /admin/discounts/:id/conditions fails if more than one condition type is provided: Only one of products, customer_groups is allowed, Only one of customer_groups, products is allowed 1`] = `"Request failed with status code 400"`;
exports[`/admin/discounts POST /admin/discounts/:id/conditions should create a condition 1`] = `
Object {
"code": "TEST",
Expand Down Expand Up @@ -124,8 +118,6 @@ Object {
}
`;
exports[`/admin/discounts POST /admin/discounts/:id/conditions throws if discount does not exist: Discount with id does-not-exist was not found 1`] = `"Request failed with status code 404"`;
exports[`/admin/discounts POST /admin/discounts/:id/conditions/:condition_id should update a condition 1`] = `
Object {
"code": "TEST",
Expand Down Expand Up @@ -197,7 +189,3 @@ Object {
"valid_duration": null,
}
`;
exports[`/admin/discounts POST /admin/discounts/:id/conditions/:condition_id throws if condition does not exist: DiscountCondition with id does-not-exist was not found for Discount test-discount 1`] = `"Request failed with status code 404"`;
exports[`/admin/discounts POST /admin/discounts/:id/conditions/:condition_id throws if discount does not exist: Discount with id does-not-exist was not found 1`] = `"Request failed with status code 404"`;
Loading

0 comments on commit 28fd105

Please sign in to comment.