@floristcloud/api-lib 1.2.129 → 1.2.130
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/build/commands/discount-rules/get-discount-rules-all.query.js +2 -0
- package/build/commands/discount-rules/get-product-discount-price.query.js +56 -0
- package/build/commands/discount-rules/index.js +1 -0
- package/commands/discount-rules/get-discount-rules-all.query.ts +2 -0
- package/commands/discount-rules/get-product-discount-price.query.ts +59 -0
- package/commands/discount-rules/index.ts +1 -0
- package/package.json +1 -1
|
@@ -9,6 +9,8 @@ const GetDiscountRulesAllRequestSchema = zod_1.z.object({
|
|
|
9
9
|
return val === 'null' ? null : val;
|
|
10
10
|
}, zod_1.z.uuid().nullable().optional()),
|
|
11
11
|
});
|
|
12
|
+
// Только конфигурация правил: экраны настройки правят её, а цену по товару отдаёт
|
|
13
|
+
// `GetProductDiscountPriceContractQuery` — это разные вопросы и разные ответы.
|
|
12
14
|
const GetDiscountRulesAllResponseSchema = zod_1.z.object({
|
|
13
15
|
message: zod_1.z.string().optional(),
|
|
14
16
|
data: schemas_1.DiscountRulesSchema.array(),
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetProductDiscountPriceContractQuery = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const enum_1 = require("../../enum");
|
|
6
|
+
const schemas_1 = require("../../schemas");
|
|
7
|
+
const money_schema_1 = require("../../schemas/money.schema");
|
|
8
|
+
const GetProductDiscountPriceRequestSchema = zod_1.z.object({
|
|
9
|
+
productUUID: zod_1.z.uuid(),
|
|
10
|
+
clientUUID: zod_1.z.preprocess(val => {
|
|
11
|
+
return val === 'null' ? null : val;
|
|
12
|
+
}, zod_1.z.uuid().nullable().optional()),
|
|
13
|
+
});
|
|
14
|
+
/**
|
|
15
|
+
* Цена товара по одному правилу — для показа вариантов.
|
|
16
|
+
*
|
|
17
|
+
* `discountValueData` описывает, чем правило обернулось для этого товара, а не как оно настроено:
|
|
18
|
+
* у правила от себестоимости это готовая цена, и самой наценки здесь нет.
|
|
19
|
+
|
|
20
|
+
*/
|
|
21
|
+
const ProductDiscountPriceItemSchema = zod_1.z.object({
|
|
22
|
+
discountRulesUUID: zod_1.z.string(),
|
|
23
|
+
type: zod_1.z.nativeEnum(enum_1.DiscountRulesTypeEnum),
|
|
24
|
+
discountValueData: schemas_1.discountPriceOutcomeSchema,
|
|
25
|
+
priceWithDiscount: money_schema_1.MoneySchema,
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* Готовые цены товара для клиента: то, что нужно при работе с товаром, а не при настройке правил.
|
|
29
|
+
*
|
|
30
|
+
* Считает бэк тем же движком, что и для витрины, — панель формулу скидок не повторяет и
|
|
31
|
+
* себестоимость не получает. Настройка правил живёт отдельно, в `GetDiscountRulesAllContractQuery`.
|
|
32
|
+
*
|
|
33
|
+
* `null` в ценах со скидкой означает «скидка неприменима», а не «ноль».
|
|
34
|
+
*/
|
|
35
|
+
const GetProductDiscountPriceResponseSchema = zod_1.z.object({
|
|
36
|
+
message: zod_1.z.string().optional(),
|
|
37
|
+
data: zod_1.z.object({
|
|
38
|
+
productUUID: zod_1.z.string(),
|
|
39
|
+
price: money_schema_1.MoneySchema,
|
|
40
|
+
priceWithBestDiscount: money_schema_1.MoneySchema.nullable(),
|
|
41
|
+
multiplicityOptions: zod_1.z
|
|
42
|
+
.object({
|
|
43
|
+
uuid: zod_1.z.string(),
|
|
44
|
+
optionPrice: money_schema_1.MoneySchema.nullable(),
|
|
45
|
+
optionPriceWithDiscount: money_schema_1.MoneySchema.nullable(),
|
|
46
|
+
isDiscountApplicable: zod_1.z.boolean(),
|
|
47
|
+
})
|
|
48
|
+
.array(),
|
|
49
|
+
discountDataList: ProductDiscountPriceItemSchema.array(),
|
|
50
|
+
}),
|
|
51
|
+
});
|
|
52
|
+
var GetProductDiscountPriceContractQuery;
|
|
53
|
+
(function (GetProductDiscountPriceContractQuery) {
|
|
54
|
+
GetProductDiscountPriceContractQuery.RequestSchema = GetProductDiscountPriceRequestSchema;
|
|
55
|
+
GetProductDiscountPriceContractQuery.ResponseSchema = GetProductDiscountPriceResponseSchema;
|
|
56
|
+
})(GetProductDiscountPriceContractQuery || (exports.GetProductDiscountPriceContractQuery = GetProductDiscountPriceContractQuery = {}));
|
|
@@ -23,6 +23,7 @@ __exportStar(require("./get-discount-rules-extended.query"), exports);
|
|
|
23
23
|
__exportStar(require("./split-quantity-discount-rules.query"), exports);
|
|
24
24
|
__exportStar(require("./split-quantity-discount-rules-for-client.query"), exports);
|
|
25
25
|
__exportStar(require("./get-discount-rules-all.query"), exports);
|
|
26
|
+
__exportStar(require("./get-product-discount-price.query"), exports);
|
|
26
27
|
__exportStar(require("./set-consignment-discount.command"), exports);
|
|
27
28
|
__exportStar(require("./delete-consignment-discount.command"), exports);
|
|
28
29
|
__exportStar(require("./remove-consignment-discount.command"), exports);
|
|
@@ -8,6 +8,8 @@ const GetDiscountRulesAllRequestSchema = z.object({
|
|
|
8
8
|
}, z.uuid().nullable().optional()),
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
+
// Только конфигурация правил: экраны настройки правят её, а цену по товару отдаёт
|
|
12
|
+
// `GetProductDiscountPriceContractQuery` — это разные вопросы и разные ответы.
|
|
11
13
|
const GetDiscountRulesAllResponseSchema = z.object({
|
|
12
14
|
message: z.string().optional(),
|
|
13
15
|
data: DiscountRulesSchema.array(),
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { DiscountRulesTypeEnum } from '../../enum';
|
|
3
|
+
import { discountPriceOutcomeSchema } from '../../schemas';
|
|
4
|
+
import { MoneySchema } from '../../schemas/money.schema';
|
|
5
|
+
|
|
6
|
+
const GetProductDiscountPriceRequestSchema = z.object({
|
|
7
|
+
productUUID: z.uuid(),
|
|
8
|
+
clientUUID: z.preprocess(val => {
|
|
9
|
+
return val === 'null' ? null : val;
|
|
10
|
+
}, z.uuid().nullable().optional()),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Цена товара по одному правилу — для показа вариантов.
|
|
15
|
+
*
|
|
16
|
+
* `discountValueData` описывает, чем правило обернулось для этого товара, а не как оно настроено:
|
|
17
|
+
* у правила от себестоимости это готовая цена, и самой наценки здесь нет.
|
|
18
|
+
|
|
19
|
+
*/
|
|
20
|
+
const ProductDiscountPriceItemSchema = z.object({
|
|
21
|
+
discountRulesUUID: z.string(),
|
|
22
|
+
type: z.nativeEnum(DiscountRulesTypeEnum),
|
|
23
|
+
discountValueData: discountPriceOutcomeSchema,
|
|
24
|
+
priceWithDiscount: MoneySchema,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Готовые цены товара для клиента: то, что нужно при работе с товаром, а не при настройке правил.
|
|
29
|
+
*
|
|
30
|
+
* Считает бэк тем же движком, что и для витрины, — панель формулу скидок не повторяет и
|
|
31
|
+
* себестоимость не получает. Настройка правил живёт отдельно, в `GetDiscountRulesAllContractQuery`.
|
|
32
|
+
*
|
|
33
|
+
* `null` в ценах со скидкой означает «скидка неприменима», а не «ноль».
|
|
34
|
+
*/
|
|
35
|
+
const GetProductDiscountPriceResponseSchema = z.object({
|
|
36
|
+
message: z.string().optional(),
|
|
37
|
+
data: z.object({
|
|
38
|
+
productUUID: z.string(),
|
|
39
|
+
price: MoneySchema,
|
|
40
|
+
priceWithBestDiscount: MoneySchema.nullable(),
|
|
41
|
+
multiplicityOptions: z
|
|
42
|
+
.object({
|
|
43
|
+
uuid: z.string(),
|
|
44
|
+
optionPrice: MoneySchema.nullable(),
|
|
45
|
+
optionPriceWithDiscount: MoneySchema.nullable(),
|
|
46
|
+
isDiscountApplicable: z.boolean(),
|
|
47
|
+
})
|
|
48
|
+
.array(),
|
|
49
|
+
discountDataList: ProductDiscountPriceItemSchema.array(),
|
|
50
|
+
}),
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export namespace GetProductDiscountPriceContractQuery {
|
|
54
|
+
export const RequestSchema = GetProductDiscountPriceRequestSchema;
|
|
55
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
56
|
+
|
|
57
|
+
export const ResponseSchema = GetProductDiscountPriceResponseSchema;
|
|
58
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
59
|
+
}
|
|
@@ -7,6 +7,7 @@ export * from './get-discount-rules-extended.query';
|
|
|
7
7
|
export * from './split-quantity-discount-rules.query';
|
|
8
8
|
export * from './split-quantity-discount-rules-for-client.query';
|
|
9
9
|
export * from './get-discount-rules-all.query';
|
|
10
|
+
export * from './get-product-discount-price.query';
|
|
10
11
|
export * from './set-consignment-discount.command';
|
|
11
12
|
export * from './delete-consignment-discount.command';
|
|
12
13
|
export * from './remove-consignment-discount.command';
|