feat: restructure events payload (#8143)
* refactor: restructure events payload Breaking change: This PR changes the event payload accepted by the event listeners * refactor: fix failing tests and implement feedback * add integration tests * fix timeout --------- Co-authored-by: Adrien de Peretti <adrien.deperetti@gmail.com>
This commit is contained in:
@@ -261,7 +261,7 @@ export function MedusaService<
|
||||
|
||||
await this.eventBusModuleService_?.emit(
|
||||
primaryKeyValues_.map((primaryKeyValue) => ({
|
||||
eventName: `${kebabCase(modelName)}.deleted`,
|
||||
name: `${kebabCase(modelName)}.deleted`,
|
||||
data: isString(primaryKeyValue)
|
||||
? { id: primaryKeyValue }
|
||||
: primaryKeyValue,
|
||||
@@ -294,7 +294,7 @@ export function MedusaService<
|
||||
|
||||
await this.eventBusModuleService_?.emit(
|
||||
softDeletedModels.map(({ id }) => ({
|
||||
eventName: `${kebabCase(modelName)}.deleted`,
|
||||
name: `${kebabCase(modelName)}.deleted`,
|
||||
metadata: { source: "", action: "", object: "" },
|
||||
data: { id },
|
||||
}))
|
||||
|
||||
Reference in New Issue
Block a user