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:
@@ -873,7 +873,7 @@ export default class ProductModuleService
|
||||
|
||||
await this.eventBusModuleService_?.emit<ProductCollectionEventData>(
|
||||
collections.map(({ id }) => ({
|
||||
eventName: ProductCollectionEvents.COLLECTION_CREATED,
|
||||
name: ProductCollectionEvents.COLLECTION_CREATED,
|
||||
data: { id },
|
||||
}))
|
||||
)
|
||||
@@ -946,7 +946,7 @@ export default class ProductModuleService
|
||||
if (created.length) {
|
||||
await this.eventBusModuleService_?.emit<ProductCollectionEventData>(
|
||||
created.map(({ id }) => ({
|
||||
eventName: ProductCollectionEvents.COLLECTION_CREATED,
|
||||
name: ProductCollectionEvents.COLLECTION_CREATED,
|
||||
data: { id },
|
||||
}))
|
||||
)
|
||||
@@ -955,7 +955,7 @@ export default class ProductModuleService
|
||||
if (updated.length) {
|
||||
await this.eventBusModuleService_?.emit<ProductCollectionEventData>(
|
||||
updated.map(({ id }) => ({
|
||||
eventName: ProductCollectionEvents.COLLECTION_UPDATED,
|
||||
name: ProductCollectionEvents.COLLECTION_UPDATED,
|
||||
data: { id },
|
||||
}))
|
||||
)
|
||||
@@ -1016,7 +1016,7 @@ export default class ProductModuleService
|
||||
|
||||
await this.eventBusModuleService_?.emit<ProductCollectionEventData>(
|
||||
updatedCollections.map(({ id }) => ({
|
||||
eventName: ProductCollectionEvents.COLLECTION_UPDATED,
|
||||
name: ProductCollectionEvents.COLLECTION_UPDATED,
|
||||
data: { id },
|
||||
}))
|
||||
)
|
||||
@@ -1279,7 +1279,7 @@ export default class ProductModuleService
|
||||
|
||||
await this.eventBusModuleService_?.emit<ProductEventData>(
|
||||
createdProducts.map(({ id }) => ({
|
||||
eventName: ProductEvents.PRODUCT_CREATED,
|
||||
name: ProductEvents.PRODUCT_CREATED,
|
||||
data: { id },
|
||||
}))
|
||||
)
|
||||
@@ -1327,7 +1327,7 @@ export default class ProductModuleService
|
||||
if (created.length) {
|
||||
await this.eventBusModuleService_?.emit<ProductEventData>(
|
||||
created.map(({ id }) => ({
|
||||
eventName: ProductEvents.PRODUCT_CREATED,
|
||||
name: ProductEvents.PRODUCT_CREATED,
|
||||
data: { id },
|
||||
}))
|
||||
)
|
||||
@@ -1336,7 +1336,7 @@ export default class ProductModuleService
|
||||
if (updated.length) {
|
||||
await this.eventBusModuleService_?.emit<ProductEventData>(
|
||||
updated.map(({ id }) => ({
|
||||
eventName: ProductEvents.PRODUCT_UPDATED,
|
||||
name: ProductEvents.PRODUCT_UPDATED,
|
||||
data: { id },
|
||||
}))
|
||||
)
|
||||
@@ -1390,7 +1390,7 @@ export default class ProductModuleService
|
||||
|
||||
await this.eventBusModuleService_?.emit<ProductEventData>(
|
||||
updatedProducts.map(({ id }) => ({
|
||||
eventName: ProductEvents.PRODUCT_UPDATED,
|
||||
name: ProductEvents.PRODUCT_UPDATED,
|
||||
data: { id },
|
||||
}))
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user