chore(): upgrade mikro orm (#13450)
This commit is contained in:
@@ -690,7 +690,9 @@ export default class PromotionModuleService
|
||||
sharedContext
|
||||
)
|
||||
|
||||
return Array.isArray(data) ? promotions : promotions[0]
|
||||
return await this.baseRepository_.serialize<
|
||||
PromotionTypes.PromotionDTO | PromotionTypes.PromotionDTO[]
|
||||
>(Array.isArray(data) ? promotions : promotions[0])
|
||||
}
|
||||
|
||||
@InjectTransactionManager()
|
||||
@@ -949,6 +951,7 @@ export default class PromotionModuleService
|
||||
): Promise<PromotionTypes.PromotionDTO[]>
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async updatePromotions(
|
||||
data:
|
||||
@@ -1165,6 +1168,7 @@ export default class PromotionModuleService
|
||||
}
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
async addPromotionRules(
|
||||
promotionId: string,
|
||||
rulesData: PromotionTypes.CreatePromotionRuleDTO[],
|
||||
@@ -1288,6 +1292,8 @@ export default class PromotionModuleService
|
||||
|
||||
validatePromotionRuleAttributes(rulesData)
|
||||
|
||||
const promotionRuleValuesDataToCreate: CreatePromotionRuleValueDTO[] = []
|
||||
|
||||
for (const ruleData of rulesData) {
|
||||
const { values, ...rest } = ruleData
|
||||
const promotionRuleData: CreatePromotionRuleDTO = {
|
||||
@@ -1308,12 +1314,14 @@ export default class PromotionModuleService
|
||||
promotion_rule: createdPromotionRule,
|
||||
}))
|
||||
|
||||
await this.promotionRuleValueService_.create(
|
||||
promotionRuleValuesData,
|
||||
sharedContext
|
||||
)
|
||||
promotionRuleValuesDataToCreate.push(...promotionRuleValuesData)
|
||||
}
|
||||
|
||||
await this.promotionRuleValueService_.create(
|
||||
promotionRuleValuesDataToCreate,
|
||||
sharedContext
|
||||
)
|
||||
|
||||
return createdPromotionRules
|
||||
}
|
||||
|
||||
@@ -1630,7 +1638,7 @@ export default class PromotionModuleService
|
||||
@EmitEvents()
|
||||
async addPromotionsToCampaign(
|
||||
data: PromotionTypes.AddPromotionsToCampaignDTO,
|
||||
@MedusaContext() sharedContext?: Context
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
): Promise<{ ids: string[] }> {
|
||||
const ids = await this.addPromotionsToCampaign_(data, sharedContext)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user