chore(): Promotion auto managed joiner config (#14115)
* chore(): Promotion auto managed joiner config * Create light-trainers-tie.md * chore(): align tests expectactions
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
import { defineJoinerConfig, Modules } from "@medusajs/framework/utils"
|
||||
import { Campaign, Promotion, PromotionRule } from "@models"
|
||||
import { default as schema } from "./schema"
|
||||
|
||||
export const joinerConfig = defineJoinerConfig(Modules.PROMOTION, {
|
||||
schema,
|
||||
models: [Promotion, Campaign, PromotionRule],
|
||||
})
|
||||
@@ -1,97 +0,0 @@
|
||||
export default `
|
||||
enum PromotionTypeValues {
|
||||
standard
|
||||
buyget
|
||||
}
|
||||
|
||||
enum PromotionRuleOperatorValues {
|
||||
gt
|
||||
lt
|
||||
eq
|
||||
ne
|
||||
in
|
||||
lte
|
||||
gte
|
||||
}
|
||||
|
||||
enum CampaignBudgetTypeValues {
|
||||
spend
|
||||
usage
|
||||
}
|
||||
|
||||
enum ApplicationMethodTypeValues {
|
||||
fixed
|
||||
percentage
|
||||
}
|
||||
|
||||
enum ApplicationMethodTargetTypeValues {
|
||||
order
|
||||
shipping_methods
|
||||
items
|
||||
}
|
||||
|
||||
enum ApplicationMethodAllocationValues {
|
||||
each
|
||||
across
|
||||
once
|
||||
}
|
||||
|
||||
type Promotion {
|
||||
id: ID!
|
||||
code: String
|
||||
type: PromotionTypeValues
|
||||
is_automatic: Boolean
|
||||
application_method: ApplicationMethod
|
||||
rules: [PromotionRule]
|
||||
campaign_id: String
|
||||
campaign: Campaign
|
||||
}
|
||||
|
||||
type PromotionRule {
|
||||
id: ID!
|
||||
description: String
|
||||
attribute: String
|
||||
operator: PromotionRuleOperatorValues
|
||||
values: [PromotionRuleValue!]!
|
||||
}
|
||||
|
||||
type PromotionRuleValue {
|
||||
id: ID!
|
||||
value: String
|
||||
}
|
||||
|
||||
type Campaign {
|
||||
id: ID!
|
||||
name: String
|
||||
description: String
|
||||
campaign_identifier: String
|
||||
starts_at: DateTime
|
||||
ends_at: DateTime
|
||||
budget: CampaignBudget
|
||||
promotions: [Promotion]
|
||||
}
|
||||
|
||||
type CampaignBudget {
|
||||
id: ID!
|
||||
type: CampaignBudgetTypeValues
|
||||
limit: Int
|
||||
used: Int
|
||||
currency_code: String
|
||||
}
|
||||
|
||||
type ApplicationMethod {
|
||||
id: ID!
|
||||
type: ApplicationMethodTypeValues
|
||||
target_type: ApplicationMethodTargetTypeValues
|
||||
allocation: ApplicationMethodAllocationValues
|
||||
value: Float
|
||||
currency_code: String
|
||||
max_quantity: Int
|
||||
buy_rules_min_quantity: Int
|
||||
apply_to_quantity: Int
|
||||
promotion: Promotion
|
||||
target_rules: [PromotionRule]
|
||||
buy_rules: [PromotionRule]
|
||||
}
|
||||
|
||||
`
|
||||
@@ -7,7 +7,6 @@ import {
|
||||
FindConfig,
|
||||
InferEntityType,
|
||||
InternalModuleDeclaration,
|
||||
ModuleJoinerConfig,
|
||||
ModulesSdkTypes,
|
||||
PromotionDTO,
|
||||
PromotionTypes,
|
||||
@@ -62,7 +61,6 @@ import {
|
||||
validateApplicationMethodAttributes,
|
||||
validatePromotionRuleAttributes,
|
||||
} from "@utils"
|
||||
import { joinerConfig } from "../joiner-config"
|
||||
import { CreatePromotionRuleValueDTO } from "../types/promotion-rule-value"
|
||||
import { buildPromotionRuleQueryFilterFromContext } from "../utils/compute-actions/build-promotion-rule-query-filter-from-context"
|
||||
|
||||
@@ -147,10 +145,6 @@ export default class PromotionModuleService
|
||||
this.campaignBudgetUsageService_ = campaignBudgetUsageService
|
||||
}
|
||||
|
||||
__joinerConfig(): ModuleJoinerConfig {
|
||||
return joinerConfig
|
||||
}
|
||||
|
||||
@InjectManager()
|
||||
async listActivePromotions(
|
||||
filters?: FilterablePromotionProps,
|
||||
|
||||
Reference in New Issue
Block a user