Feat/bulk operations for inventory service (#4503)
* initial push * bulk delete reservations by location ids * add method to interface (not implemented yet) * bulk update * delete reservations by location id bulk * add create bulk for inventory item * refactor attach inventory item method * add changeset * verbose false * method override instead of multiple methods * change up method signature * redo changes when updating interface * update createInventoryLevel method * rename variables * fix feedback * return correct string array when emitting event * refactor inventory service * redo order changes * snapshot * move prep methods
This commit is contained in:
1 parent
d440c834d3
commit
d184d23c63
20 files changed
+1194
-228
No files matched your search
@@ -1,8 +1,8 @@
|
||||
import { humanizeAmount, MedusaError } from "medusa-core-utils"
|
||||
import { updateInventoryAndReservations } from "@medusajs/medusa"
|
||||
import { MedusaError, humanizeAmount } from "medusa-core-utils"
|
||||
|
||||
import { BaseService } from "medusa-interfaces"
|
||||
import Brightpearl from "../utils/brightpearl"
|
||||
import { updateInventoryAndReservations } from "@medusajs/medusa"
|
||||
|
||||
class BrightpearlService extends BaseService {
|
||||
constructor(
|
||||
@@ -117,7 +117,7 @@ class BrightpearlService extends BaseService {
|
||||
httpMethod: "POST",
|
||||
uriTemplate: `${this.options.backend_url}/brightpearl/inventory-update`,
|
||||
bodyTemplate:
|
||||
'{"account": "${account-code}", "lifecycle_event": "${lifecycle-event}", "resource_type": "${resource-type}", "id": "${resource-id}" }',
|
||||
"{\"account\": \"${account-code}\", \"lifecycle_event\": \"${lifecycle-event}\", \"resource_type\": \"${resource-type}\", \"id\": \"${resource-id}\" }",
|
||||
contentType: "application/json",
|
||||
idSetAccepted: false,
|
||||
},
|
||||
@@ -760,8 +760,14 @@ class BrightpearlService extends BaseService {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* create reservation based on reservation created event
|
||||
* @param {{ ids: string[] }} eventData Event data from reservation created
|
||||
*/
|
||||
async createReservation(eventData) {
|
||||
const { id } = eventData
|
||||
const { ids } = eventData
|
||||
|
||||
const [id] = ids
|
||||
|
||||
if (!id) {
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user