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:
Riqwan Thamir
2024-05-10 09:53:56 +02:00
committed by GitHub
parent 489a54e1fb
commit 9a14aeebcf
31 changed files with 1033 additions and 939 deletions

View File

@@ -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({

View File

@@ -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