feat(promotion,dashboard,types,utils,medusa): Add statuses to promotions (#10950)
what: - adds a status column to promotion table - introduce active promotion query - scope revert, register and compute actions to active promotions - admin to create and update promotion with statuses RESOLVES CMRC-845 RESOLVES CMRC-846 RESOLVES CMRC-847 RESOLVES CMRC-848 RESOLVES CMRC-849 RESOLVES CMRC-850
This commit is contained in:
@@ -3,6 +3,7 @@ export const defaultAdminPromotionFields = [
|
||||
"code",
|
||||
"is_automatic",
|
||||
"type",
|
||||
"status",
|
||||
"created_at",
|
||||
"updated_at",
|
||||
"deleted_at",
|
||||
|
||||
@@ -3,9 +3,11 @@ import {
|
||||
ApplicationMethodTargetType,
|
||||
ApplicationMethodType,
|
||||
PromotionRuleOperator,
|
||||
PromotionStatus,
|
||||
PromotionType,
|
||||
} from "@medusajs/framework/utils"
|
||||
import { z } from "zod"
|
||||
import { applyAndAndOrOperators } from "../../utils/common-validators"
|
||||
import {
|
||||
createFindParams,
|
||||
createOperatorMap,
|
||||
@@ -13,7 +15,6 @@ import {
|
||||
WithAdditionalData,
|
||||
} from "../../utils/validators"
|
||||
import { CreateCampaign } from "../campaigns/validators"
|
||||
import { applyAndAndOrOperators } from "../../utils/common-validators"
|
||||
|
||||
export type AdminGetPromotionParamsType = z.infer<
|
||||
typeof AdminGetPromotionParams
|
||||
@@ -160,6 +161,7 @@ export const CreatePromotion = z
|
||||
code: z.string(),
|
||||
is_automatic: z.boolean().optional(),
|
||||
type: z.nativeEnum(PromotionType),
|
||||
status: z.nativeEnum(PromotionStatus).default(PromotionStatus.DRAFT),
|
||||
campaign_id: z.string().nullish(),
|
||||
campaign: CreateCampaign.optional(),
|
||||
application_method: AdminCreateApplicationMethod,
|
||||
@@ -183,6 +185,7 @@ export const UpdatePromotion = z
|
||||
code: z.string().optional(),
|
||||
is_automatic: z.boolean().optional(),
|
||||
type: z.nativeEnum(PromotionType).optional(),
|
||||
status: z.nativeEnum(PromotionStatus).optional(),
|
||||
campaign_id: z.string().nullish(),
|
||||
application_method: AdminUpdateApplicationMethod.optional(),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user