chore: ability to group events on redis event bus (#7655)

* chore: ability to group events on redis event bus

* chore: fix tests

* Update packages/modules/event-bus-redis/src/services/event-bus-redis.ts

Co-authored-by: Adrien de Peretti <adrien.deperetti@gmail.com>

* chore: change shape of input and body data

* chore: fix builds

* chore: address comments

* chore: fix unit test

---------

Co-authored-by: Adrien de Peretti <adrien.deperetti@gmail.com>
This commit is contained in:
Riqwan Thamir
2024-06-10 22:15:43 +02:00
committed by GitHub
parent 3b8160b564
commit 39ddba2491
24 changed files with 924 additions and 732 deletions
@@ -51,8 +51,8 @@ import {
UpdateTagInput,
UpdateTypeInput,
} from "../types"
import { entityNameToLinkableKeysMap, joinerConfig } from "./../joiner-config"
import { eventBuilders } from "../utils"
import { entityNameToLinkableKeysMap, joinerConfig } from "./../joiner-config"
type InjectedDependencies = {
baseRepository: DAL.RepositoryService
@@ -1134,10 +1134,10 @@ export default class ProductModuleService<
sharedContext
)
await this.eventBusModuleService_?.emit<ProductCategoryEventData>(
ProductCategoryEvents.CATEGORY_CREATED,
{ id: productCategory.id }
)
await this.eventBusModuleService_?.emit<ProductCategoryEventData>({
eventName: ProductCategoryEvents.CATEGORY_CREATED,
data: { id: productCategory.id },
})
return productCategory
}
@@ -1154,10 +1154,10 @@ export default class ProductModuleService<
sharedContext
)
await this.eventBusModuleService_?.emit<ProductCategoryEventData>(
ProductCategoryEvents.CATEGORY_UPDATED,
{ id: productCategory.id }
)
await this.eventBusModuleService_?.emit<ProductCategoryEventData>({
eventName: ProductCategoryEvents.CATEGORY_UPDATED,
data: { id: productCategory.id },
})
return await this.baseRepository_.serialize(productCategory, {
populate: true,
@@ -1171,10 +1171,10 @@ export default class ProductModuleService<
): Promise<void> {
await this.productCategoryService_.delete(categoryId, sharedContext)
await this.eventBusModuleService_?.emit<ProductCategoryEventData>(
ProductCategoryEvents.CATEGORY_DELETED,
{ id: categoryId }
)
await this.eventBusModuleService_?.emit<ProductCategoryEventData>({
eventName: ProductCategoryEvents.CATEGORY_DELETED,
data: { id: categoryId },
})
}
create(