feat(core-flows,types,medusa): API to add promotions to campaign (#7277)
what: - adds an API to add promotions to campaign - reworks module to perform atomic actions
This commit is contained in:
@@ -70,9 +70,7 @@ export default class Campaign {
|
||||
})
|
||||
budget: CampaignBudget | null = null
|
||||
|
||||
@OneToMany(() => Promotion, (promotion) => promotion.campaign, {
|
||||
orphanRemoval: true,
|
||||
})
|
||||
@OneToMany(() => Promotion, (promotion) => promotion.campaign)
|
||||
promotions = new Collection<Promotion>(this)
|
||||
|
||||
@Property({
|
||||
|
||||
@@ -45,13 +45,17 @@ export default class Promotion {
|
||||
})
|
||||
code: string
|
||||
|
||||
@Searchable()
|
||||
@ManyToOne(() => Campaign, {
|
||||
columnType: "text",
|
||||
fieldName: "campaign_id",
|
||||
nullable: true,
|
||||
cascade: ["soft-remove"] as any,
|
||||
mapToPk: true,
|
||||
onDelete: "set null",
|
||||
})
|
||||
campaign: Campaign | null = null
|
||||
campaign_id: string | null = null
|
||||
|
||||
@ManyToOne(() => Campaign, { persist: false })
|
||||
campaign: Campaign | null
|
||||
|
||||
@Property({ columnType: "boolean", default: false })
|
||||
is_automatic: boolean = false
|
||||
|
||||
Reference in New Issue
Block a user