feat(types): promotion delete / update / retrieve / add/remove-rules (#5988)
This commit is contained in:
@@ -1,33 +1,46 @@
|
||||
import { BaseFilterable } from "../../dal"
|
||||
import { PromotionDTO } from "./promotion"
|
||||
import { CreatePromotionRuleDTO } from "./promotion-rule"
|
||||
import { CreatePromotionRuleDTO, PromotionRuleDTO } from "./promotion-rule"
|
||||
|
||||
export type ApplicationMethodType = "fixed" | "percentage"
|
||||
export type ApplicationMethodTargetType = "order" | "shipping" | "item"
|
||||
export type ApplicationMethodAllocation = "each" | "across"
|
||||
export type ApplicationMethodTypeValues = "fixed" | "percentage"
|
||||
export type ApplicationMethodTargetTypeValues = "order" | "shipping" | "item"
|
||||
export type ApplicationMethodAllocationValues = "each" | "across"
|
||||
|
||||
export interface ApplicationMethodDTO {
|
||||
id: string
|
||||
type?: ApplicationMethodTypeValues
|
||||
target_type?: ApplicationMethodTargetTypeValues
|
||||
allocation?: ApplicationMethodAllocationValues
|
||||
value?: string | null
|
||||
max_quantity?: number | null
|
||||
promotion?: PromotionDTO | string
|
||||
target_rules?: PromotionRuleDTO[]
|
||||
}
|
||||
|
||||
export interface CreateApplicationMethodDTO {
|
||||
type: ApplicationMethodType
|
||||
target_type: ApplicationMethodTargetType
|
||||
allocation?: ApplicationMethodAllocation
|
||||
value?: number
|
||||
max_quantity?: number
|
||||
type: ApplicationMethodTypeValues
|
||||
target_type: ApplicationMethodTargetTypeValues
|
||||
allocation?: ApplicationMethodAllocationValues
|
||||
value?: string | null
|
||||
max_quantity?: number | null
|
||||
promotion?: PromotionDTO | string
|
||||
target_rules?: CreatePromotionRuleDTO[]
|
||||
}
|
||||
|
||||
export interface UpdateApplicationMethodDTO {
|
||||
id: string
|
||||
type?: ApplicationMethodTypeValues
|
||||
target_type?: ApplicationMethodTargetTypeValues
|
||||
allocation?: ApplicationMethodAllocationValues
|
||||
value?: string | null
|
||||
max_quantity?: number | null
|
||||
promotion?: PromotionDTO | string
|
||||
}
|
||||
|
||||
export interface FilterableApplicationMethodProps
|
||||
extends BaseFilterable<FilterableApplicationMethodProps> {
|
||||
id?: string[]
|
||||
type?: ApplicationMethodType[]
|
||||
target_type?: ApplicationMethodTargetType[]
|
||||
allocation?: ApplicationMethodAllocation[]
|
||||
type?: ApplicationMethodTypeValues[]
|
||||
target_type?: ApplicationMethodTargetTypeValues[]
|
||||
allocation?: ApplicationMethodAllocationValues[]
|
||||
}
|
||||
|
||||
@@ -24,6 +24,10 @@ export interface UpdatePromotionRuleDTO {
|
||||
id: string
|
||||
}
|
||||
|
||||
export interface RemovePromotionRuleDTO {
|
||||
id: string
|
||||
}
|
||||
|
||||
export interface FilterablePromotionRuleProps
|
||||
extends BaseFilterable<FilterablePromotionRuleProps> {
|
||||
id?: string[]
|
||||
|
||||
@@ -1,11 +1,19 @@
|
||||
import { BaseFilterable } from "../../dal"
|
||||
import { CreateApplicationMethodDTO } from "./application-method"
|
||||
import {
|
||||
ApplicationMethodDTO,
|
||||
CreateApplicationMethodDTO,
|
||||
UpdateApplicationMethodDTO,
|
||||
} from "./application-method"
|
||||
import { CreatePromotionRuleDTO } from "./promotion-rule"
|
||||
|
||||
export type PromotionType = "standard" | "buyget"
|
||||
|
||||
export interface PromotionDTO {
|
||||
id: string
|
||||
code?: string
|
||||
type?: PromotionType
|
||||
is_automatic?: boolean
|
||||
application_method?: ApplicationMethodDTO
|
||||
}
|
||||
|
||||
export interface CreatePromotionDTO {
|
||||
@@ -18,6 +26,10 @@ export interface CreatePromotionDTO {
|
||||
|
||||
export interface UpdatePromotionDTO {
|
||||
id: string
|
||||
is_automatic?: boolean
|
||||
code?: string
|
||||
type?: PromotionType
|
||||
application_method?: UpdateApplicationMethodDTO
|
||||
}
|
||||
|
||||
export interface FilterablePromotionProps
|
||||
|
||||
@@ -3,8 +3,11 @@ import { IModuleService } from "../modules-sdk"
|
||||
import { Context } from "../shared-context"
|
||||
import {
|
||||
CreatePromotionDTO,
|
||||
CreatePromotionRuleDTO,
|
||||
FilterablePromotionProps,
|
||||
PromotionDTO,
|
||||
RemovePromotionRuleDTO,
|
||||
UpdatePromotionDTO,
|
||||
} from "./common"
|
||||
|
||||
export interface IPromotionModuleService extends IModuleService {
|
||||
@@ -13,9 +16,46 @@ export interface IPromotionModuleService extends IModuleService {
|
||||
sharedContext?: Context
|
||||
): Promise<PromotionDTO[]>
|
||||
|
||||
update(
|
||||
data: UpdatePromotionDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<PromotionDTO[]>
|
||||
|
||||
list(
|
||||
filters?: FilterablePromotionProps,
|
||||
config?: FindConfig<PromotionDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<PromotionDTO[]>
|
||||
|
||||
retrieve(
|
||||
id: string,
|
||||
config?: FindConfig<PromotionDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<PromotionDTO>
|
||||
|
||||
delete(ids: string[], sharedContext?: Context): Promise<void>
|
||||
|
||||
addPromotionRules(
|
||||
promotionId: string,
|
||||
rulesData: CreatePromotionRuleDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<PromotionDTO>
|
||||
|
||||
addPromotionTargetRules(
|
||||
promotionId: string,
|
||||
rulesData: CreatePromotionRuleDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<PromotionDTO>
|
||||
|
||||
removePromotionRules(
|
||||
promotionId: string,
|
||||
rulesData: RemovePromotionRuleDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<PromotionDTO>
|
||||
|
||||
removePromotionTargetRules(
|
||||
promotionId: string,
|
||||
rulesData: RemovePromotionRuleDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<PromotionDTO>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user