feat: Add support for exporting products in backend (#8214)
CLOSES CC-221 CLOSES CC-223 CLOSES CC-224
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
NotificationTypes,
|
||||
} from "@medusajs/types"
|
||||
import {
|
||||
EmitEvents,
|
||||
InjectManager,
|
||||
InjectTransactionManager,
|
||||
MedusaContext,
|
||||
@@ -17,6 +18,7 @@ import {
|
||||
} from "@medusajs/utils"
|
||||
import { Notification } from "@models"
|
||||
import NotificationProviderService from "./notification-provider"
|
||||
import { eventBuilders } from "@utils"
|
||||
|
||||
type InjectedDependencies = {
|
||||
baseRepository: DAL.RepositoryService
|
||||
@@ -64,6 +66,7 @@ export default class NotificationModuleService
|
||||
): Promise<NotificationTypes.NotificationDTO>
|
||||
|
||||
@InjectManager("baseRepository_")
|
||||
@EmitEvents()
|
||||
async createNotifications(
|
||||
data:
|
||||
| NotificationTypes.CreateNotificationDTO
|
||||
@@ -83,6 +86,11 @@ export default class NotificationModuleService
|
||||
NotificationTypes.NotificationDTO[]
|
||||
>(createdNotifications)
|
||||
|
||||
eventBuilders.createdNotification({
|
||||
data: serialized,
|
||||
sharedContext,
|
||||
})
|
||||
|
||||
return Array.isArray(data) ? serialized : serialized[0]
|
||||
}
|
||||
|
||||
|
||||
15
packages/modules/notification/src/utils/events.ts
Normal file
15
packages/modules/notification/src/utils/events.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import {
|
||||
CommonEvents,
|
||||
eventBuilderFactory,
|
||||
Modules,
|
||||
NotificationEvents,
|
||||
} from "@medusajs/utils"
|
||||
|
||||
export const eventBuilders = {
|
||||
createdNotification: eventBuilderFactory({
|
||||
source: Modules.NOTIFICATION,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "notification",
|
||||
eventsEnum: NotificationEvents,
|
||||
}),
|
||||
}
|
||||
1
packages/modules/notification/src/utils/index.ts
Normal file
1
packages/modules/notification/src/utils/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./events"
|
||||
Reference in New Issue
Block a user