feat(medusa): Modules initializer (#3352)

This commit is contained in:
Carlos R. L. Rodrigues
2023-03-17 12:18:52 -03:00
committed by GitHub
parent 8a7421db5b
commit aa690beed7
51 changed files with 1290 additions and 715 deletions
@@ -153,11 +153,9 @@ export default class StockLocationService {
}
const result = await locationRepo.save(loc)
await this.eventBusService_
.withTransaction(manager)
.emit(StockLocationService.Events.CREATED, {
id: result.id,
})
await this.eventBusService_?.emit?.(StockLocationService.Events.CREATED, {
id: result.id,
})
return result
}
@@ -201,11 +199,9 @@ export default class StockLocationService {
await locationRepo.save(toSave)
await this.eventBusService_
.withTransaction(manager)
.emit(StockLocationService.Events.UPDATED, {
id: stockLocationId,
})
await this.eventBusService_?.emit?.(StockLocationService.Events.UPDATED, {
id: stockLocationId,
})
return item
}
@@ -267,10 +263,8 @@ export default class StockLocationService {
await locationRepo.softRemove({ id })
await this.eventBusService_
.withTransaction(manager)
.emit(StockLocationService.Events.DELETED, {
id,
})
await this.eventBusService_?.emit?.(StockLocationService.Events.DELETED, {
id,
})
}
}