feat(utils): add campaign + promotion create / update (#6077)
* chore: add campaign + promotion operations * chore: update type * chore: added validation for campaign_id and campaign * chore: added update promotions for campaigns * chore: update campaign on promotion * chore: fix lint * chore: add test to remove promotions
This commit is contained in:
@@ -31,25 +31,25 @@ export interface RemoveShippingMethodAdjustment {
|
||||
adjustment_id: string
|
||||
}
|
||||
|
||||
export interface ComputeActionAdjustmentLine {
|
||||
export interface ComputeActionAdjustmentLine extends Record<string, unknown> {
|
||||
id: string
|
||||
code: string
|
||||
}
|
||||
|
||||
export interface ComputeActionItemLine {
|
||||
export interface ComputeActionItemLine extends Record<string, unknown> {
|
||||
id: string
|
||||
quantity: number
|
||||
unit_price: number
|
||||
adjustments?: ComputeActionAdjustmentLine[]
|
||||
}
|
||||
|
||||
export interface ComputeActionShippingLine {
|
||||
export interface ComputeActionShippingLine extends Record<string, unknown> {
|
||||
id: string
|
||||
unit_price: number
|
||||
adjustments?: ComputeActionAdjustmentLine[]
|
||||
}
|
||||
|
||||
export interface ComputeActionContext {
|
||||
export interface ComputeActionContext extends Record<string, unknown> {
|
||||
items?: ComputeActionItemLine[]
|
||||
shipping_methods?: ComputeActionShippingLine[]
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { BaseFilterable } from "../../dal"
|
||||
import { CreateCampaignDTO } from "../mutations"
|
||||
import {
|
||||
ApplicationMethodDTO,
|
||||
CreateApplicationMethodDTO,
|
||||
@@ -23,6 +24,8 @@ export interface CreatePromotionDTO {
|
||||
is_automatic?: boolean
|
||||
application_method?: CreateApplicationMethodDTO
|
||||
rules?: CreatePromotionRuleDTO[]
|
||||
campaign?: CreateCampaignDTO
|
||||
campaign_id?: string
|
||||
}
|
||||
|
||||
export interface UpdatePromotionDTO {
|
||||
@@ -31,6 +34,7 @@ export interface UpdatePromotionDTO {
|
||||
code?: string
|
||||
type?: PromotionType
|
||||
application_method?: UpdateApplicationMethodDTO
|
||||
campaign_id?: string
|
||||
}
|
||||
|
||||
export interface FilterablePromotionProps
|
||||
@@ -39,4 +43,5 @@ export interface FilterablePromotionProps
|
||||
code?: string[]
|
||||
is_automatic?: boolean
|
||||
type?: PromotionType[]
|
||||
budget_id?: string[]
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CampaignBudgetTypeValues } from "./common"
|
||||
import { CampaignBudgetTypeValues, PromotionDTO } from "./common"
|
||||
|
||||
export interface CreateCampaignBudgetDTO {
|
||||
type: CampaignBudgetTypeValues
|
||||
@@ -21,6 +21,7 @@ export interface CreateCampaignDTO {
|
||||
starts_at: Date
|
||||
ends_at: Date
|
||||
budget?: CreateCampaignBudgetDTO
|
||||
promotions?: Pick<PromotionDTO, "id">[]
|
||||
}
|
||||
|
||||
export interface UpdateCampaignDTO {
|
||||
@@ -32,4 +33,5 @@ export interface UpdateCampaignDTO {
|
||||
starts_at?: Date
|
||||
ends_at?: Date
|
||||
budget?: Omit<UpdateCampaignBudgetDTO, "id">
|
||||
promotions?: Pick<PromotionDTO, "id">[]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user