chore(): Handle medusa service base methods events (#9179)

* chore(): Handle medusa service base methods events

* cleanup

* cleanup

* fix import

* fix decorator order

* fixes

* apply default event emition

* fix binding

* fix binding

* align tests with new event emition
This commit is contained in:
Adrien de Peretti authored and GitHub committed 2024-09-18 17:57:00 +02:00
1 parent 81d3ae01c7
commit a734184538
13 files changed
+290 -116

No files matched your search

@@ -692,11 +692,11 @@ moduleIntegrationTestRunner<IProductModuleService>({
[
expect.objectContaining({
data: { id: productCategoryOne.id },
name: "product-category.deleted",
name: "Product.product-category.deleted",
metadata: {
action: "",
object: "",
source: "",
action: CommonEvents.DELETED,
object: "product_category",
source: Modules.PRODUCT,
},
}),
],
@@ -1,5 +1,5 @@
import { IProductModuleService } from "@medusajs/types"
import { Modules, ProductStatus } from "@medusajs/utils"
import { CommonEvents, Modules, ProductStatus } from "@medusajs/utils"
import { Product, ProductCollection } from "@models"
import {
MockEventBusService,
@@ -281,12 +281,12 @@ moduleIntegrationTestRunner<IProductModuleService>({
expect(eventBusSpy).toHaveBeenCalledWith(
[
{
name: "product-collection.deleted",
name: "Product.product-collection.deleted",
data: { id: collectionId },
metadata: {
action: "",
object: "",
source: "",
action: CommonEvents.DELETED,
object: "product_collection",
source: Modules.PRODUCT,
},
},
],