feat(medusa): Support batch remove resources on discount condition (#2444)

**what**
- Add support to remove resources by batch on discount conditions
- Add support on medusa-js and medusa-react

**Tests**
- Add integration tests to validate that the resources have been deleted and the length is the one expected
- Add unit tests on medusa react

FIXES CORE-609
This commit is contained in:
Adrien de Peretti
2022-10-17 09:03:38 +00:00
committed by GitHub
parent 765a2cccda
commit 48411157b1
12 changed files with 432 additions and 12 deletions
@@ -1,4 +1,5 @@
import {
AdminDeleteDiscountsDiscountConditionsConditionBatchReq,
AdminDiscountConditionsRes,
AdminDiscountsDeleteRes,
AdminDiscountsListRes,
@@ -230,6 +231,19 @@ class AdminDiscountsResource extends BaseResource {
return this.client.request("POST", path, payload, {}, customHeaders)
}
/**
* @description Delete a batch of items from a discount condition
*/
deleteConditionResourceBatch(
discountId: string,
conditionId: string,
payload: AdminDeleteDiscountsDiscountConditionsConditionBatchReq,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminDiscountsRes> {
const path = `/admin/discounts/${discountId}/conditions/${conditionId}/batch`
return this.client.request("DELETE", path, payload, {}, customHeaders)
}
}
export default AdminDiscountsResource