feat(medusa,core-flows,types): adds update promotion rule endpoint + workflow (#6702)

what:

- adds endpoint + workflow to update promotion rule
- adds method in promotion to update promotion rules
This commit is contained in:
Riqwan Thamir authored and GitHub committed 2024-03-14 20:04:53 +00:00
1 parent 7be0a2cf6d
commit e5945479e0
13 files changed
+366 -2

No files matched your search

@@ -27,6 +27,10 @@ export interface CreatePromotionRuleDTO {
export interface UpdatePromotionRuleDTO {
id: string
description?: string | null
attribute?: string
operator?: PromotionRuleOperatorValues
values?: string[] | string
}
export interface RemovePromotionRuleDTO {
@@ -36,7 +40,6 @@ export interface RemovePromotionRuleDTO {
export interface FilterablePromotionRuleProps
extends BaseFilterable<FilterablePromotionRuleProps> {
id?: string[]
code?: string[]
}
export type PromotionRuleTypes = "buy_rules" | "target_rules" | "rules"
+13
View File
@@ -10,9 +10,11 @@ import {
CreatePromotionRuleDTO,
FilterableCampaignProps,
FilterablePromotionProps,
FilterablePromotionRuleProps,
PromotionDTO,
PromotionRuleDTO,
UpdatePromotionDTO,
UpdatePromotionRuleDTO,
} from "./common"
import { CreateCampaignDTO, UpdateCampaignDTO } from "./mutations"
@@ -134,6 +136,17 @@ export interface IPromotionModuleService extends IModuleService {
sharedContext?: Context
): Promise<CampaignDTO>
listPromotionRules(
filters?: FilterablePromotionRuleProps,
config?: FindConfig<PromotionRuleDTO>,
sharedContext?: Context
): Promise<PromotionRuleDTO[]>
updatePromotionRules(
data: UpdatePromotionRuleDTO[],
sharedContext?: Context
): Promise<PromotionRuleDTO[]>
listCampaigns(
filters?: FilterableCampaignProps,
config?: FindConfig<CampaignDTO>,
+9 -1
View File
@@ -1,4 +1,8 @@
import { CreatePromotionRuleDTO, PromotionRuleTypes } from "./common"
import {
CreatePromotionRuleDTO,
PromotionRuleTypes,
UpdatePromotionRuleDTO,
} from "./common"
export type AddPromotionRulesWorkflowDTO = {
rule_type: PromotionRuleTypes
@@ -15,3 +19,7 @@ export type RemovePromotionRulesWorkflowDTO = {
rule_ids: string[]
}
}
export type UpdatePromotionRulesWorkflowDTO = {
data: UpdatePromotionRuleDTO[]
}