@medusajs/pricing 0.1.10 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/joiner-config.d.ts +1 -2
- package/dist/joiner-config.js +1 -9
- package/dist/migrations/Migration20230929122253.js +60 -29
- package/dist/migrations/Migration20240322094407.d.ts +5 -0
- package/dist/migrations/Migration20240322094407.js +15 -0
- package/dist/migrations/{Migration20231101232834.d.ts → Migration20240322113359.d.ts} +1 -1
- package/dist/migrations/Migration20240322113359.js +19 -0
- package/dist/migrations/{Migration20240103140327.d.ts → Migration20240322120125.d.ts} +1 -1
- package/dist/migrations/Migration20240322120125.js +15 -0
- package/dist/models/index.d.ts +1 -3
- package/dist/models/index.js +3 -7
- package/dist/models/price-list-rule-value.d.ts +9 -0
- package/dist/models/price-list-rule-value.js +49 -4
- package/dist/models/price-list-rule.d.ts +8 -3
- package/dist/models/price-list-rule.js +65 -15
- package/dist/models/price-list.d.ts +7 -6
- package/dist/models/price-list.js +23 -11
- package/dist/models/price-rule.d.ts +8 -5
- package/dist/models/price-rule.js +63 -19
- package/dist/models/price-set-rule-type.d.ts +5 -4
- package/dist/models/price-set-rule-type.js +57 -8
- package/dist/models/price-set.d.ts +7 -6
- package/dist/models/price-set.js +42 -19
- package/dist/models/price.d.ts +27 -0
- package/dist/models/price.js +167 -0
- package/dist/models/rule-type.d.ts +1 -0
- package/dist/models/rule-type.js +21 -2
- package/dist/repositories/pricing.js +40 -38
- package/dist/scripts/seed.js +9 -17
- package/dist/services/index.d.ts +0 -3
- package/dist/services/index.js +1 -7
- package/dist/services/pricing-module.d.ts +19 -33
- package/dist/services/pricing-module.js +163 -348
- package/dist/services/rule-type.d.ts +5 -6
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.js +1 -2
- package/dist/types/services/index.d.ts +0 -10
- package/dist/types/services/index.js +0 -10
- package/dist/types/services/price-list.d.ts +0 -21
- package/package.json +5 -5
- package/dist/migrations/Migration20231101232834.js +0 -50
- package/dist/migrations/Migration20240103140327.js +0 -29
- package/dist/models/money-amount.d.ts +0 -19
- package/dist/models/money-amount.js +0 -111
- package/dist/models/price-set-money-amount-rules.d.ts +0 -10
- package/dist/models/price-set-money-amount-rules.js +0 -63
- package/dist/models/price-set-money-amount.d.ts +0 -24
- package/dist/models/price-set-money-amount.js +0 -128
- package/dist/services/price-list-rule-value.d.ts +0 -13
- package/dist/services/price-list-rule-value.js +0 -22
- package/dist/services/price-list-rule.d.ts +0 -15
- package/dist/services/price-list-rule.js +0 -41
- package/dist/services/price-rule.d.ts +0 -13
- package/dist/services/price-rule.js +0 -22
- package/dist/types/repositories/index.d.ts +0 -10
- package/dist/types/repositories/index.js +0 -26
- package/dist/types/repositories/money-amount.d.ts +0 -14
- package/dist/types/repositories/money-amount.js +0 -2
- package/dist/types/repositories/price-list-rule-value.d.ts +0 -10
- package/dist/types/repositories/price-list-rule-value.js +0 -2
- package/dist/types/repositories/price-list-rule.d.ts +0 -14
- package/dist/types/repositories/price-list-rule.js +0 -2
- package/dist/types/repositories/price-list.d.ts +0 -18
- package/dist/types/repositories/price-list.js +0 -2
- package/dist/types/repositories/price-rule.d.ts +0 -21
- package/dist/types/repositories/price-rule.js +0 -2
- package/dist/types/repositories/price-set-money-amount-rules.d.ts +0 -11
- package/dist/types/repositories/price-set-money-amount-rules.js +0 -2
- package/dist/types/repositories/price-set-money-amount.d.ts +0 -13
- package/dist/types/repositories/price-set-money-amount.js +0 -2
- package/dist/types/repositories/price-set-rule-type.d.ts +0 -10
- package/dist/types/repositories/price-set-rule-type.js +0 -2
- package/dist/types/repositories/price-set.d.ts +0 -5
- package/dist/types/repositories/price-set.js +0 -2
- package/dist/types/repositories/rule-type.d.ts +0 -12
- package/dist/types/repositories/rule-type.js +0 -2
- package/dist/types/services/money-amount.d.ts +0 -30
- package/dist/types/services/money-amount.js +0 -2
- package/dist/types/services/price-list-rule-value.d.ts +0 -21
- package/dist/types/services/price-list-rule-value.js +0 -2
- package/dist/types/services/price-list-rule.d.ts +0 -27
- package/dist/types/services/price-list-rule.js +0 -2
- package/dist/types/services/price-rule.d.ts +0 -42
- package/dist/types/services/price-rule.js +0 -2
- package/dist/types/services/price-set-money-amount-rules.d.ts +0 -24
- package/dist/types/services/price-set-money-amount-rules.js +0 -2
- package/dist/types/services/price-set-money-amount.d.ts +0 -32
- package/dist/types/services/price-set-money-amount.js +0 -2
- package/dist/types/services/price-set-rule-type.d.ts +0 -21
- package/dist/types/services/price-set-rule-type.js +0 -2
- package/dist/types/services/price-set.d.ts +0 -15
- package/dist/types/services/price-set.js +0 -2
- package/dist/types/services/pricing.d.ts +0 -20
- package/dist/types/services/pricing.js +0 -2
- package/dist/types/services/rule-type.d.ts +0 -32
- package/dist/types/services/rule-type.js +0 -2
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const utils_1 = require("@medusajs/utils");
|
|
4
|
-
const _models_1 = require("../models");
|
|
5
|
-
class PriceListRuleService extends utils_1.ModulesSdkUtils.internalModuleServiceFactory(_models_1.PriceListRule) {
|
|
6
|
-
constructor(container) {
|
|
7
|
-
// @ts-ignore
|
|
8
|
-
super(...arguments);
|
|
9
|
-
}
|
|
10
|
-
async create(data, context = {}) {
|
|
11
|
-
const data_ = Array.isArray(data) ? data : [data];
|
|
12
|
-
const priceListRule = data_.map((priceListRule) => {
|
|
13
|
-
const { price_list_id: priceListId, rule_type_id: ruleTypeId, ...createData } = priceListRule;
|
|
14
|
-
if (priceListId) {
|
|
15
|
-
createData.price_list = priceListId;
|
|
16
|
-
}
|
|
17
|
-
if (ruleTypeId) {
|
|
18
|
-
createData.rule_type = ruleTypeId;
|
|
19
|
-
}
|
|
20
|
-
return createData;
|
|
21
|
-
});
|
|
22
|
-
return await super.create(priceListRule, context);
|
|
23
|
-
}
|
|
24
|
-
// TODO add support for selector? and then rm ts ignore
|
|
25
|
-
// @ts-ignore
|
|
26
|
-
async update(data, context = {}) {
|
|
27
|
-
const data_ = Array.isArray(data) ? data : [data];
|
|
28
|
-
const priceListRules = data_.map((priceListRule) => {
|
|
29
|
-
const { price_list_id, rule_type_id, ...priceListRuleData } = priceListRule;
|
|
30
|
-
if (price_list_id) {
|
|
31
|
-
priceListRuleData.price_list = price_list_id;
|
|
32
|
-
}
|
|
33
|
-
if (rule_type_id) {
|
|
34
|
-
priceListRuleData.rule_type = rule_type_id;
|
|
35
|
-
}
|
|
36
|
-
return priceListRuleData;
|
|
37
|
-
});
|
|
38
|
-
return await super.update(priceListRules, context);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
exports.default = PriceListRuleService;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Context, DAL } from "@medusajs/types";
|
|
2
|
-
import { PriceRule } from "../models";
|
|
3
|
-
import { ServiceTypes } from "../types";
|
|
4
|
-
type InjectedDependencies = {
|
|
5
|
-
priceRuleRepository: DAL.RepositoryService;
|
|
6
|
-
};
|
|
7
|
-
declare const PriceRuleService_base: new <TEntity_1 extends object = any>(container: InjectedDependencies) => import("@medusajs/types").InternalModuleService<TEntity_1, InjectedDependencies>;
|
|
8
|
-
export default class PriceRuleService<TEntity extends PriceRule = PriceRule> extends PriceRuleService_base<TEntity> {
|
|
9
|
-
constructor(container: InjectedDependencies);
|
|
10
|
-
create(data: ServiceTypes.CreatePriceRuleDTO[], sharedContext?: Context): Promise<TEntity[]>;
|
|
11
|
-
create(data: ServiceTypes.CreatePriceRuleDTO, sharedContext?: Context): Promise<TEntity>;
|
|
12
|
-
}
|
|
13
|
-
export {};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const utils_1 = require("@medusajs/utils");
|
|
4
|
-
const _models_1 = require("../models");
|
|
5
|
-
class PriceRuleService extends utils_1.ModulesSdkUtils.internalModuleServiceFactory(_models_1.PriceRule) {
|
|
6
|
-
constructor(container) {
|
|
7
|
-
// @ts-ignore
|
|
8
|
-
super(...arguments);
|
|
9
|
-
}
|
|
10
|
-
async create(data, sharedContext = {}) {
|
|
11
|
-
const data_ = Array.isArray(data) ? data : [data];
|
|
12
|
-
const toCreate = data_.map((ruleData) => {
|
|
13
|
-
const ruleDataClone = { ...ruleData };
|
|
14
|
-
ruleDataClone.rule_type ?? (ruleDataClone.rule_type = ruleData.rule_type_id);
|
|
15
|
-
ruleDataClone.price_set ?? (ruleDataClone.price_set = ruleData.price_set_id);
|
|
16
|
-
ruleDataClone.price_set_money_amount ?? (ruleDataClone.price_set_money_amount = ruleData.price_set_money_amount_id);
|
|
17
|
-
return ruleDataClone;
|
|
18
|
-
});
|
|
19
|
-
return await super.create(toCreate, sharedContext);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
exports.default = PriceRuleService;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from "./money-amount";
|
|
2
|
-
export * from "./price-list-rule-value";
|
|
3
|
-
export * from "./price-list-rule";
|
|
4
|
-
export * from "./price-list";
|
|
5
|
-
export * from "./price-rule";
|
|
6
|
-
export * from "./price-set-money-amount-rules";
|
|
7
|
-
export * from "./price-set-money-amount";
|
|
8
|
-
export * from "./price-set-rule-type";
|
|
9
|
-
export * from "./price-set";
|
|
10
|
-
export * from "./rule-type";
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./money-amount"), exports);
|
|
18
|
-
__exportStar(require("./price-list-rule-value"), exports);
|
|
19
|
-
__exportStar(require("./price-list-rule"), exports);
|
|
20
|
-
__exportStar(require("./price-list"), exports);
|
|
21
|
-
__exportStar(require("./price-rule"), exports);
|
|
22
|
-
__exportStar(require("./price-set-money-amount-rules"), exports);
|
|
23
|
-
__exportStar(require("./price-set-money-amount"), exports);
|
|
24
|
-
__exportStar(require("./price-set-rule-type"), exports);
|
|
25
|
-
__exportStar(require("./price-set"), exports);
|
|
26
|
-
__exportStar(require("./rule-type"), exports);
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export interface CreateMoneyAmountDTO {
|
|
2
|
-
id?: string;
|
|
3
|
-
currency_code: string;
|
|
4
|
-
amount: number;
|
|
5
|
-
min_quantity?: number | null;
|
|
6
|
-
max_quantity?: number | null;
|
|
7
|
-
}
|
|
8
|
-
export interface UpdateMoneyAmountDTO {
|
|
9
|
-
id: string;
|
|
10
|
-
currency_code?: string;
|
|
11
|
-
amount?: number;
|
|
12
|
-
min_quantity?: number;
|
|
13
|
-
max_quantity?: number;
|
|
14
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { PriceListRule } from "../../models";
|
|
2
|
-
export interface CreatePriceListRuleValueDTO {
|
|
3
|
-
price_list_rule_id?: string;
|
|
4
|
-
price_list_rule: PriceListRule | string;
|
|
5
|
-
value: string;
|
|
6
|
-
}
|
|
7
|
-
export interface UpdatePriceListRuleValueDTO {
|
|
8
|
-
id: string;
|
|
9
|
-
value: string;
|
|
10
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { PriceListDTO, RuleTypeDTO } from "../services";
|
|
2
|
-
export interface CreatePriceListRuleDTO {
|
|
3
|
-
rule_type_id?: string;
|
|
4
|
-
rule_type?: string | RuleTypeDTO;
|
|
5
|
-
price_list_id?: string;
|
|
6
|
-
price_list?: string | PriceListDTO;
|
|
7
|
-
}
|
|
8
|
-
export interface UpdatePriceListRuleDTO {
|
|
9
|
-
id: string;
|
|
10
|
-
price_list_id?: string;
|
|
11
|
-
rule_type_id?: string;
|
|
12
|
-
price_list?: string;
|
|
13
|
-
rule_type?: string;
|
|
14
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { PriceListStatus, PriceListType } from "@medusajs/utils";
|
|
2
|
-
export interface CreatePriceListDTO {
|
|
3
|
-
title: string;
|
|
4
|
-
description: string;
|
|
5
|
-
starts_at?: string | null;
|
|
6
|
-
ends_at?: string | null;
|
|
7
|
-
status?: PriceListStatus;
|
|
8
|
-
type?: PriceListType;
|
|
9
|
-
rules_count?: number;
|
|
10
|
-
}
|
|
11
|
-
export interface UpdatePriceListDTO {
|
|
12
|
-
id: string;
|
|
13
|
-
title?: string;
|
|
14
|
-
starts_at?: string | null;
|
|
15
|
-
ends_at?: string | null;
|
|
16
|
-
status?: PriceListStatus;
|
|
17
|
-
number_rules?: number;
|
|
18
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { PriceSet, PriceSetMoneyAmount, RuleType } from "../../models";
|
|
2
|
-
export interface CreatePriceRuleDTO {
|
|
3
|
-
id?: string;
|
|
4
|
-
price_set_id?: string;
|
|
5
|
-
price_set?: PriceSet | string;
|
|
6
|
-
rule_type_id?: string;
|
|
7
|
-
rule_type?: RuleType | string;
|
|
8
|
-
value: string;
|
|
9
|
-
priority?: number;
|
|
10
|
-
price_set_money_amount_id?: string;
|
|
11
|
-
price_set_money_amount?: PriceSetMoneyAmount | string;
|
|
12
|
-
}
|
|
13
|
-
export interface UpdatePriceRuleDTO {
|
|
14
|
-
id: string;
|
|
15
|
-
price_set_id?: string;
|
|
16
|
-
rule_type_id?: string;
|
|
17
|
-
value?: string;
|
|
18
|
-
priority?: number;
|
|
19
|
-
price_set_money_amount_id?: string;
|
|
20
|
-
price_list_id?: string;
|
|
21
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export interface CreatePriceSetMoneyAmountRulesDTO {
|
|
2
|
-
price_set_money_amount: string;
|
|
3
|
-
rule_type: string;
|
|
4
|
-
value: string;
|
|
5
|
-
}
|
|
6
|
-
export interface UpdatePriceSetMoneyAmountRulesDTO {
|
|
7
|
-
id: string;
|
|
8
|
-
price_set_money_amount?: string;
|
|
9
|
-
rule_type?: string;
|
|
10
|
-
value?: string;
|
|
11
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { MoneyAmountDTO, PriceListDTO, PriceSetDTO } from "../services";
|
|
2
|
-
export interface UpdatePriceSetMoneyAmountDTO {
|
|
3
|
-
id: string;
|
|
4
|
-
title?: string;
|
|
5
|
-
price_set?: PriceSetDTO;
|
|
6
|
-
money_amount?: MoneyAmountDTO;
|
|
7
|
-
}
|
|
8
|
-
export interface CreatePriceSetMoneyAmountDTO {
|
|
9
|
-
title?: string;
|
|
10
|
-
price_set?: PriceSetDTO | string;
|
|
11
|
-
price_list?: PriceListDTO | string;
|
|
12
|
-
money_amount?: MoneyAmountDTO | string;
|
|
13
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { PriceSetDTO, RuleTypeDTO } from "../services";
|
|
2
|
-
export interface CreatePriceSetRuleTypeDTO {
|
|
3
|
-
price_set: PriceSetDTO | string;
|
|
4
|
-
rule_type: RuleTypeDTO | string;
|
|
5
|
-
}
|
|
6
|
-
export interface UpdatePriceSetRuleTypeDTO {
|
|
7
|
-
id: string;
|
|
8
|
-
price_set?: string;
|
|
9
|
-
rule_type?: string;
|
|
10
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface CreateRuleTypeDTO {
|
|
2
|
-
id?: string;
|
|
3
|
-
name: string;
|
|
4
|
-
rule_attribute: string;
|
|
5
|
-
default_priority?: number;
|
|
6
|
-
}
|
|
7
|
-
export interface UpdateRuleTypeDTO {
|
|
8
|
-
id: string;
|
|
9
|
-
name?: string;
|
|
10
|
-
rule_attribute?: string;
|
|
11
|
-
default_priority?: number;
|
|
12
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { BaseFilterable, PriceSetMoneyAmountDTO } from "@medusajs/types";
|
|
2
|
-
export interface CreateMoneyAmountDTO {
|
|
3
|
-
id?: string;
|
|
4
|
-
currency_code: string;
|
|
5
|
-
amount: number;
|
|
6
|
-
min_quantity?: number | null;
|
|
7
|
-
max_quantity?: number | null;
|
|
8
|
-
}
|
|
9
|
-
export interface UpdateMoneyAmountDTO {
|
|
10
|
-
id: string;
|
|
11
|
-
currency_code?: string;
|
|
12
|
-
amount?: number;
|
|
13
|
-
min_quantity?: number;
|
|
14
|
-
max_quantity?: number;
|
|
15
|
-
}
|
|
16
|
-
export interface MoneyAmountDTO {
|
|
17
|
-
id: string;
|
|
18
|
-
currency_code?: string | null;
|
|
19
|
-
amount?: number | null;
|
|
20
|
-
min_quantity?: number | null;
|
|
21
|
-
max_quantity?: number | null;
|
|
22
|
-
price_set_money_amount?: PriceSetMoneyAmountDTO;
|
|
23
|
-
created_at: Date;
|
|
24
|
-
updated_at: Date;
|
|
25
|
-
deleted_at: Date | null;
|
|
26
|
-
}
|
|
27
|
-
export interface FilterableMoneyAmountProps extends BaseFilterable<FilterableMoneyAmountProps> {
|
|
28
|
-
id?: string[];
|
|
29
|
-
currency_code?: string | string[];
|
|
30
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { BaseFilterable } from "@medusajs/types";
|
|
2
|
-
import { PriceListRule } from "../../models";
|
|
3
|
-
export interface CreatePriceListRuleValueDTO {
|
|
4
|
-
price_list_rule_id?: string;
|
|
5
|
-
price_list_rule: PriceListRule | string;
|
|
6
|
-
value: string;
|
|
7
|
-
}
|
|
8
|
-
export interface UpdatePriceListRuleValueDTO {
|
|
9
|
-
id: string;
|
|
10
|
-
value: string;
|
|
11
|
-
}
|
|
12
|
-
export interface PriceListRuleValueDTO {
|
|
13
|
-
id: string;
|
|
14
|
-
value: string;
|
|
15
|
-
price_list_rule: PriceListRule;
|
|
16
|
-
}
|
|
17
|
-
export interface FilterablePriceListRuleValueProps extends BaseFilterable<FilterablePriceListRuleValueProps> {
|
|
18
|
-
id?: string[];
|
|
19
|
-
value?: string[];
|
|
20
|
-
price_list_rule_id?: string[];
|
|
21
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { BaseFilterable, PriceListDTO, PriceListRuleValueDTO, RuleTypeDTO } from "@medusajs/types";
|
|
2
|
-
export interface CreatePriceListRuleDTO {
|
|
3
|
-
rule_type_id?: string;
|
|
4
|
-
rule_type?: string | RuleTypeDTO;
|
|
5
|
-
price_list_id?: string;
|
|
6
|
-
price_list?: string | PriceListDTO;
|
|
7
|
-
}
|
|
8
|
-
export interface UpdatePriceListRuleDTO {
|
|
9
|
-
id: string;
|
|
10
|
-
price_list_id?: string;
|
|
11
|
-
rule_type_id?: string;
|
|
12
|
-
price_list?: string;
|
|
13
|
-
rule_type?: string;
|
|
14
|
-
}
|
|
15
|
-
export interface PriceListRuleDTO {
|
|
16
|
-
id: string;
|
|
17
|
-
value: string;
|
|
18
|
-
rule_type: RuleTypeDTO;
|
|
19
|
-
price_list: PriceListDTO;
|
|
20
|
-
price_list_rule_values?: PriceListRuleValueDTO[];
|
|
21
|
-
}
|
|
22
|
-
export interface FilterablePriceListRuleProps extends BaseFilterable<FilterablePriceListRuleProps> {
|
|
23
|
-
id?: string[];
|
|
24
|
-
value?: string[];
|
|
25
|
-
rule_type?: string[];
|
|
26
|
-
price_list_id?: string[];
|
|
27
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { BaseFilterable, PriceSetDTO, RuleTypeDTO } from "@medusajs/types";
|
|
2
|
-
import { PriceSet, PriceSetMoneyAmount, RuleType } from "../../models";
|
|
3
|
-
export interface CreatePriceRuleDTO {
|
|
4
|
-
id?: string;
|
|
5
|
-
price_set_id?: string;
|
|
6
|
-
price_set?: PriceSet | string;
|
|
7
|
-
rule_type_id?: string;
|
|
8
|
-
rule_type?: RuleType | string;
|
|
9
|
-
value: string;
|
|
10
|
-
priority?: number;
|
|
11
|
-
price_set_money_amount_id?: string;
|
|
12
|
-
price_set_money_amount?: PriceSetMoneyAmount | string;
|
|
13
|
-
}
|
|
14
|
-
export interface UpdatePriceRuleDTO {
|
|
15
|
-
id: string;
|
|
16
|
-
price_set_id?: string;
|
|
17
|
-
rule_type_id?: string;
|
|
18
|
-
value?: string;
|
|
19
|
-
priority?: number;
|
|
20
|
-
price_set_money_amount_id?: string;
|
|
21
|
-
price_list_id?: string;
|
|
22
|
-
}
|
|
23
|
-
export interface PriceRuleDTO {
|
|
24
|
-
id: string;
|
|
25
|
-
price_set_id: string;
|
|
26
|
-
price_set: PriceSetDTO;
|
|
27
|
-
rule_type_id: string;
|
|
28
|
-
rule_type: RuleTypeDTO;
|
|
29
|
-
value: string;
|
|
30
|
-
priority: number;
|
|
31
|
-
price_set_money_amount_id: string;
|
|
32
|
-
price_list_id: string;
|
|
33
|
-
created_at: Date;
|
|
34
|
-
updated_at: Date;
|
|
35
|
-
deleted_at: Date | null;
|
|
36
|
-
}
|
|
37
|
-
export interface FilterablePriceRuleProps extends BaseFilterable<FilterablePriceRuleProps> {
|
|
38
|
-
id?: string[];
|
|
39
|
-
name?: string[];
|
|
40
|
-
price_set_id?: string[];
|
|
41
|
-
rule_type_id?: string[];
|
|
42
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { BaseFilterable, PriceSetMoneyAmountDTO, RuleTypeDTO } from "@medusajs/types";
|
|
2
|
-
export interface CreatePriceSetMoneyAmountRulesDTO {
|
|
3
|
-
price_set_money_amount: string;
|
|
4
|
-
rule_type: string;
|
|
5
|
-
value: string;
|
|
6
|
-
}
|
|
7
|
-
export interface UpdatePriceSetMoneyAmountRulesDTO {
|
|
8
|
-
id: string;
|
|
9
|
-
price_set_money_amount?: string;
|
|
10
|
-
rule_type?: string;
|
|
11
|
-
value?: string;
|
|
12
|
-
}
|
|
13
|
-
export interface PriceSetMoneyAmountRulesDTO {
|
|
14
|
-
id: string;
|
|
15
|
-
price_set_money_amount: PriceSetMoneyAmountDTO;
|
|
16
|
-
rule_type: RuleTypeDTO;
|
|
17
|
-
value: string;
|
|
18
|
-
}
|
|
19
|
-
export interface FilterablePriceSetMoneyAmountRulesProps extends BaseFilterable<FilterablePriceSetMoneyAmountRulesProps> {
|
|
20
|
-
id?: string[];
|
|
21
|
-
rule_type_id?: string[];
|
|
22
|
-
price_set_money_amount_id?: string[];
|
|
23
|
-
value?: string[];
|
|
24
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { BaseFilterable, MoneyAmountDTO, PriceListDTO, PriceRuleDTO, PriceSetDTO } from "@medusajs/types";
|
|
2
|
-
export interface UpdatePriceSetMoneyAmountDTO {
|
|
3
|
-
id: string;
|
|
4
|
-
title?: string;
|
|
5
|
-
price_set?: PriceSetDTO;
|
|
6
|
-
money_amount?: MoneyAmountDTO;
|
|
7
|
-
rules_count?: number;
|
|
8
|
-
}
|
|
9
|
-
export interface CreatePriceSetMoneyAmountDTO {
|
|
10
|
-
title?: string;
|
|
11
|
-
price_set?: PriceSetDTO | string;
|
|
12
|
-
price_list?: PriceListDTO | string;
|
|
13
|
-
money_amount?: MoneyAmountDTO | string;
|
|
14
|
-
rules_count?: number;
|
|
15
|
-
}
|
|
16
|
-
export interface FilterablePriceSetMoneyAmountProps extends BaseFilterable<FilterablePriceSetMoneyAmountProps> {
|
|
17
|
-
id?: string[];
|
|
18
|
-
price_set_id?: string[];
|
|
19
|
-
price_list_id?: string[];
|
|
20
|
-
}
|
|
21
|
-
export interface PriceSetMoneyAmountDTO {
|
|
22
|
-
id: string;
|
|
23
|
-
title?: string;
|
|
24
|
-
price_set?: PriceSetDTO;
|
|
25
|
-
price_list?: PriceListDTO;
|
|
26
|
-
price_set_id?: string;
|
|
27
|
-
price_rules?: PriceRuleDTO[];
|
|
28
|
-
money_amount?: MoneyAmountDTO;
|
|
29
|
-
created_at: Date;
|
|
30
|
-
updated_at: Date;
|
|
31
|
-
deleted_at: Date | null;
|
|
32
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { BaseFilterable, PriceSetDTO, RuleTypeDTO } from "@medusajs/types";
|
|
2
|
-
export interface CreatePriceSetRuleTypeDTO {
|
|
3
|
-
price_set: PriceSetDTO | string;
|
|
4
|
-
rule_type: RuleTypeDTO | string;
|
|
5
|
-
}
|
|
6
|
-
export interface UpdatePriceSetRuleTypeDTO {
|
|
7
|
-
id: string;
|
|
8
|
-
price_set?: string;
|
|
9
|
-
rule_type?: string;
|
|
10
|
-
}
|
|
11
|
-
export interface PriceSetRuleTypeDTO {
|
|
12
|
-
id: string;
|
|
13
|
-
price_set: PriceSetDTO;
|
|
14
|
-
rule_type: RuleTypeDTO;
|
|
15
|
-
value: string;
|
|
16
|
-
}
|
|
17
|
-
export interface FilterablePriceSetRuleTypeProps extends BaseFilterable<FilterablePriceSetRuleTypeProps> {
|
|
18
|
-
id?: string[];
|
|
19
|
-
rule_type_id?: string[];
|
|
20
|
-
price_set_id?: string[];
|
|
21
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { BaseFilterable, FilterableMoneyAmountProps, MoneyAmountDTO, RuleTypeDTO } from "@medusajs/types";
|
|
2
|
-
export interface CreatePriceSetDTO {
|
|
3
|
-
}
|
|
4
|
-
export interface UpdatePriceSetDTO {
|
|
5
|
-
id: string;
|
|
6
|
-
}
|
|
7
|
-
export interface PriceSetDTO {
|
|
8
|
-
id: string;
|
|
9
|
-
money_amounts?: MoneyAmountDTO[];
|
|
10
|
-
rule_types?: RuleTypeDTO[];
|
|
11
|
-
}
|
|
12
|
-
export interface FilterablePriceSetProps extends BaseFilterable<FilterablePriceSetProps> {
|
|
13
|
-
id?: string[];
|
|
14
|
-
money_amounts?: FilterableMoneyAmountProps;
|
|
15
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Context } from "@medusajs/types";
|
|
2
|
-
export interface PricingRepositoryService {
|
|
3
|
-
calculatePrices(pricingFilters: PricingFilters, pricingContext: PricingContext, context: Context): Promise<CalculatedPriceSetDTO[]>;
|
|
4
|
-
}
|
|
5
|
-
export interface PricingFilters {
|
|
6
|
-
id: string[];
|
|
7
|
-
}
|
|
8
|
-
export interface PricingContext {
|
|
9
|
-
context?: Record<string, string | number>;
|
|
10
|
-
}
|
|
11
|
-
export interface CalculatedPriceSetDTO {
|
|
12
|
-
id: string;
|
|
13
|
-
price_set_id: string;
|
|
14
|
-
amount: string | null;
|
|
15
|
-
currency_code: string | null;
|
|
16
|
-
min_quantity: string | null;
|
|
17
|
-
max_quantity: string | null;
|
|
18
|
-
price_list_type: string | null;
|
|
19
|
-
price_list_id: string | null;
|
|
20
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { BaseFilterable } from "@medusajs/types";
|
|
2
|
-
export interface CreateRuleTypeDTO {
|
|
3
|
-
id?: string;
|
|
4
|
-
name: string;
|
|
5
|
-
rule_attribute: string;
|
|
6
|
-
default_priority?: number;
|
|
7
|
-
}
|
|
8
|
-
export interface UpdateRuleTypeDTO {
|
|
9
|
-
id: string;
|
|
10
|
-
name?: string;
|
|
11
|
-
rule_attribute?: string;
|
|
12
|
-
default_priority?: number;
|
|
13
|
-
}
|
|
14
|
-
export interface RuleTypeDTO {
|
|
15
|
-
id: string;
|
|
16
|
-
name: string;
|
|
17
|
-
rule_attribute: string;
|
|
18
|
-
default_priority: number;
|
|
19
|
-
/**
|
|
20
|
-
* The creation date of the rule type.
|
|
21
|
-
*/
|
|
22
|
-
created_at?: Date | string;
|
|
23
|
-
/**
|
|
24
|
-
* The update date of the rule type.
|
|
25
|
-
*/
|
|
26
|
-
updated_at?: Date | string;
|
|
27
|
-
}
|
|
28
|
-
export interface FilterableRuleTypeProps extends BaseFilterable<FilterableRuleTypeProps> {
|
|
29
|
-
id?: string[];
|
|
30
|
-
name?: string[];
|
|
31
|
-
rule_attribute?: string[];
|
|
32
|
-
}
|