feat(pricing): add price rule entity (#5050)
**What** - add price-rule entity to pricing module blocked by #4977 Fixes CORE-1497 Co-authored-by: Riqwan Thamir <5105988+riqwan@users.noreply.github.com> Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
This commit is contained in:
co-authored by
Riqwan Thamir
Adrien de Peretti
parent
b3f1135fba
commit
bc42b201ea
@@ -2,3 +2,4 @@ export * from "./currency"
|
||||
export * from "./money-amount"
|
||||
export * from "./price-set"
|
||||
export * from "./rule-type"
|
||||
export * from './price-rule'
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
import { BaseFilterable } from "../../dal"
|
||||
import { PriceSetDTO } from "./price-set"
|
||||
import { RuleTypeDTO } from "./rule-type"
|
||||
|
||||
export interface PriceRuleDTO {
|
||||
id: string
|
||||
price_set_id: string
|
||||
price_set: PriceSetDTO
|
||||
rule_type_id: string
|
||||
rule_type: RuleTypeDTO
|
||||
is_dynamic: boolean
|
||||
value: string
|
||||
priority: number
|
||||
price_set_money_amount_id: string
|
||||
price_list_id: string
|
||||
}
|
||||
|
||||
export interface CreatePriceRuleDTO {
|
||||
id: string
|
||||
price_set_id: string
|
||||
rule_type_id: string
|
||||
is_dynamic?: boolean
|
||||
value: string
|
||||
priority?: number
|
||||
price_set_money_amount_id: string
|
||||
price_list_id: string
|
||||
}
|
||||
|
||||
export interface UpdatePriceRuleDTO {
|
||||
id: string
|
||||
price_set_id?: string
|
||||
rule_type_id?: string
|
||||
is_dynamic?: boolean
|
||||
value?: string
|
||||
priority?: number
|
||||
price_set_money_amount_id?: string
|
||||
price_list_id?: string
|
||||
}
|
||||
|
||||
export interface FilterablePriceRuleProps
|
||||
extends BaseFilterable<FilterablePriceRuleProps> {
|
||||
id?: string[]
|
||||
name?: string[]
|
||||
}
|
||||
@@ -1,2 +1,2 @@
|
||||
export * from "./common"
|
||||
export * from "./service"
|
||||
export * from "./service"
|
||||
|
||||
@@ -1,28 +1,33 @@
|
||||
import { FindConfig } from "../common"
|
||||
import { ModuleJoinerConfig } from "../modules-sdk"
|
||||
import { Context } from "../shared-context"
|
||||
import {
|
||||
CalculatedPriceSetDTO,
|
||||
CreateCurrencyDTO,
|
||||
CreateMoneyAmountDTO,
|
||||
CreatePriceRuleDTO,
|
||||
CreatePriceSetDTO,
|
||||
CreateRuleTypeDTO,
|
||||
CurrencyDTO,
|
||||
FilterableCurrencyProps,
|
||||
FilterableMoneyAmountProps,
|
||||
FilterablePriceRuleProps,
|
||||
FilterablePriceSetProps,
|
||||
FilterableRuleTypeProps,
|
||||
MoneyAmountDTO,
|
||||
PriceRuleDTO,
|
||||
PriceSetDTO,
|
||||
PricingContext,
|
||||
PricingFilters,
|
||||
RuleTypeDTO,
|
||||
UpdateCurrencyDTO,
|
||||
UpdateMoneyAmountDTO,
|
||||
UpdatePriceRuleDTO,
|
||||
UpdatePriceSetDTO,
|
||||
UpdateRuleTypeDTO,
|
||||
} from "./common"
|
||||
|
||||
import { Context } from "../shared-context"
|
||||
import { FindConfig } from "../common"
|
||||
import { ModuleJoinerConfig } from "../modules-sdk"
|
||||
|
||||
export interface IPricingModuleService {
|
||||
__joinerConfig(): ModuleJoinerConfig
|
||||
|
||||
@@ -124,7 +129,6 @@ export interface IPricingModuleService {
|
||||
currencyCodes: string[],
|
||||
sharedContext?: Context
|
||||
): Promise<void>
|
||||
|
||||
retrieveRuleType(
|
||||
code: string,
|
||||
config?: FindConfig<RuleTypeDTO>,
|
||||
@@ -153,5 +157,41 @@ export interface IPricingModuleService {
|
||||
sharedContext?: Context
|
||||
): Promise<RuleTypeDTO[]>
|
||||
|
||||
deleteRuleTypes(ruleTypes: string[], sharedContext?: Context): Promise<void>
|
||||
deleteRuleTypes(
|
||||
ruleTypeIds: string[],
|
||||
sharedContext?: Context
|
||||
): Promise<void>
|
||||
|
||||
retrievePriceRule(
|
||||
id: string,
|
||||
config?: FindConfig<PriceRuleDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<PriceRuleDTO>
|
||||
|
||||
listPriceRules(
|
||||
filters?: FilterablePriceRuleProps,
|
||||
config?: FindConfig<PriceRuleDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<PriceRuleDTO[]>
|
||||
|
||||
listAndCountPriceRules(
|
||||
filters?: FilterablePriceRuleProps,
|
||||
config?: FindConfig<PriceRuleDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<[PriceRuleDTO[], number]>
|
||||
|
||||
createPriceRules(
|
||||
data: CreatePriceRuleDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<PriceRuleDTO[]>
|
||||
|
||||
updatePriceRules(
|
||||
data: UpdatePriceRuleDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<PriceRuleDTO[]>
|
||||
|
||||
deletePriceRules(
|
||||
priceRuleIds: string[],
|
||||
sharedContext?: Context
|
||||
): Promise<void>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user