feat(core-flows,medusa,types,utils): add rules to promotion endpoints + workflow (#6692)

* feat(core-flows,medusa,types,utils): add rules to promotion endpoints + workflow

* chore: fix specs

* chore: move input type to types package
This commit is contained in:
Riqwan Thamir
2024-03-13 21:19:24 +01:00
committed by GitHub
parent 02e784ce78
commit 640eccd5dd
23 changed files with 777 additions and 179 deletions
@@ -38,3 +38,5 @@ export interface FilterablePromotionRuleProps
id?: string[]
code?: string[]
}
export type PromotionRuleTypes = "buy_rules" | "target_rules" | "rules"
+1
View File
@@ -1,3 +1,4 @@
export * from "./common"
export * from "./mutations"
export * from "./service"
export * from "./workflows"
+7 -6
View File
@@ -11,6 +11,7 @@ import {
FilterableCampaignProps,
FilterablePromotionProps,
PromotionDTO,
PromotionRuleDTO,
RemovePromotionRuleDTO,
UpdatePromotionDTO,
} from "./common"
@@ -82,37 +83,37 @@ export interface IPromotionModuleService extends IModuleService {
promotionId: string,
rulesData: CreatePromotionRuleDTO[],
sharedContext?: Context
): Promise<PromotionDTO>
): Promise<PromotionRuleDTO[]>
addPromotionTargetRules(
promotionId: string,
rulesData: CreatePromotionRuleDTO[],
sharedContext?: Context
): Promise<PromotionDTO>
): Promise<PromotionRuleDTO[]>
addPromotionBuyRules(
promotionId: string,
rulesData: CreatePromotionRuleDTO[],
sharedContext?: Context
): Promise<PromotionDTO>
): Promise<PromotionRuleDTO[]>
removePromotionRules(
promotionId: string,
rulesData: RemovePromotionRuleDTO[],
sharedContext?: Context
): Promise<PromotionDTO>
): Promise<void>
removePromotionTargetRules(
promotionId: string,
rulesData: RemovePromotionRuleDTO[],
sharedContext?: Context
): Promise<PromotionDTO>
): Promise<void>
removePromotionBuyRules(
promotionId: string,
rulesData: RemovePromotionRuleDTO[],
sharedContext?: Context
): Promise<PromotionDTO>
): Promise<void>
createCampaigns(
data: CreateCampaignDTO,
@@ -0,0 +1,9 @@
import { CreatePromotionRuleDTO, PromotionRuleTypes } from "./common"
export type AddPromotionRulesWorkflowDTO = {
rule_type: PromotionRuleTypes
data: {
id: string
rules: CreatePromotionRuleDTO[]
}
}