feat: Add batch method to collection and clean up some batch implementations (#7102)

This commit is contained in:
Stevche Radevski
2024-04-22 10:36:22 +02:00
committed by GitHub
parent 0f5b015df0
commit 89143e1032
26 changed files with 425 additions and 123 deletions
@@ -334,7 +334,7 @@ medusaIntegrationTestRunner({
it("should delete an inventory location level and create a new one", async () => {
const result = await api.post(
`/admin/inventory-items/${inventoryItem.id}/location-levels/op/batch`,
`/admin/inventory-items/${inventoryItem.id}/location-levels/batch`,
{
create: [
{
@@ -618,23 +618,21 @@ medusaIntegrationTestRunner({
{ relations: ["prices"] }
)
const data = { product_id: [product.id] }
const data = { remove: [product.id] }
const response = await api.post(
`admin/price-lists/${priceList.id}/prices/batch`,
`admin/price-lists/${priceList.id}/products`,
data,
adminHeaders
)
expect(response.status).toEqual(200)
expect(response.data).toEqual({
created: [],
updated: [],
deleted: {
ids: ["price-to-delete-1", "price-to-delete-2"],
object: "price",
deleted: true,
},
})
expect(response.data.price_list).toEqual(
expect.objectContaining({
id: expect.any(String),
title: "test price list",
description: "test",
})
)
})
})
})