@floristcloud/api-lib 1.2.120 → 1.2.122
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/product/multiplicity-option/create-product-multiplicity-option.command.js +1 -0
- package/build/commands/product/multiplicity-option/update-product-multiplicity-option.command.js +1 -0
- package/build/schemas/discount-rules/discount-rules.schema.js +8 -3
- package/build/schemas/order-product/order-product-multiplicity-optiom.schema.js +3 -0
- package/build/schemas/product/product-multiplicity-option.schema.js +2 -0
- package/commands/product/multiplicity-option/create-product-multiplicity-option.command.ts +1 -0
- package/commands/product/multiplicity-option/update-product-multiplicity-option.command.ts +1 -0
- package/package.json +1 -1
- package/schemas/discount-rules/discount-rules.schema.ts +8 -3
- package/schemas/order-product/order-product-multiplicity-optiom.schema.ts +3 -0
- package/schemas/product/product-multiplicity-option.schema.ts +2 -0
package/build/commands/product/multiplicity-option/create-product-multiplicity-option.command.js
CHANGED
|
@@ -9,6 +9,7 @@ const CreateProductMultiplicityOptionRequestSchema = zod_1.z.object({
|
|
|
9
9
|
optionMultiplicity: zod_1.z.coerce.number().int().min(1),
|
|
10
10
|
optionPrice: non_negative_money_schema_1.NonNegativeMoneySchema.nullable().optional(),
|
|
11
11
|
rank: zod_1.z.coerce.number().int().min(0).default(0).optional(),
|
|
12
|
+
isDiscountAllowed: zod_1.z.coerce.boolean().optional(),
|
|
12
13
|
});
|
|
13
14
|
const CreateProductMultiplicityOptionResponseSchema = zod_1.z.object({
|
|
14
15
|
message: zod_1.z.string().optional(),
|
package/build/commands/product/multiplicity-option/update-product-multiplicity-option.command.js
CHANGED
|
@@ -10,6 +10,7 @@ const UpdateProductMultiplicityOptionRequestSchema = zod_1.z
|
|
|
10
10
|
optionMultiplicity: zod_1.z.coerce.number().int().min(1),
|
|
11
11
|
optionPrice: non_negative_money_schema_1.NonNegativeMoneySchema.nullable(),
|
|
12
12
|
rank: zod_1.z.coerce.number().int().min(0).default(0),
|
|
13
|
+
isDiscountAllowed: zod_1.z.coerce.boolean(),
|
|
13
14
|
})
|
|
14
15
|
.partial();
|
|
15
16
|
const UpdateProductMultiplicityOptionResponseSchema = zod_1.z.object({
|
|
@@ -17,8 +17,10 @@ exports.discountRulesModeSchema = zod_1.z.discriminatedUnion('typeDiscount', [
|
|
|
17
17
|
}),
|
|
18
18
|
]);
|
|
19
19
|
// Rules schemas other data
|
|
20
|
+
// Проценты ограничены так же, как в discountRulesModeSchema выше: за 100 % скидка уводит цену
|
|
21
|
+
// в минус, отрицательная — наценка под видом скидки.
|
|
20
22
|
const DiscountRulesPersonalDiscountDataSchema = zod_1.z.object({
|
|
21
|
-
discountPercent: zod_1.z.number(),
|
|
23
|
+
discountPercent: zod_1.z.number().min(0).max(100),
|
|
22
24
|
});
|
|
23
25
|
const DiscountRulesMonthlyOrderSumDataSchema = zod_1.z.object({
|
|
24
26
|
range: zod_1.z
|
|
@@ -26,11 +28,14 @@ const DiscountRulesMonthlyOrderSumDataSchema = zod_1.z.object({
|
|
|
26
28
|
.array()
|
|
27
29
|
.length(2)
|
|
28
30
|
.refine(([min, max]) => min <= max),
|
|
29
|
-
discountPercent: zod_1.z.number(),
|
|
31
|
+
discountPercent: zod_1.z.number().min(0).max(100),
|
|
30
32
|
});
|
|
31
33
|
const DiscountRulesQuantityBasedDataSchema = zod_1.z
|
|
32
34
|
.object({
|
|
33
|
-
multipleQuantity
|
|
35
|
+
// Кратность — целое положительное. При нуле `quantity % multipleQuantity` даёт NaN, и два
|
|
36
|
+
// потребителя расходятся: getPriceCalcDiscountOrderProductHelper считает условие
|
|
37
|
+
// выполненным всегда, splitQuantityProduct — не выполненным никогда.
|
|
38
|
+
multipleQuantity: zod_1.z.number().int().positive(),
|
|
34
39
|
})
|
|
35
40
|
.and(exports.discountRulesModeSchema);
|
|
36
41
|
const DiscountRulesItemDiscountDataSchema = exports.discountRulesModeSchema;
|
|
@@ -8,4 +8,7 @@ exports.OrderProductMultiplicityOptionSchema = zod_1.z.object({
|
|
|
8
8
|
title: zod_1.z.string().nullable(),
|
|
9
9
|
optionMultiplicity: zod_1.z.coerce.number(),
|
|
10
10
|
optionPrice: money_schema_1.MoneySchema.nullable(),
|
|
11
|
+
// Применять ли скидки клиента к цене этой кратности. Позиция заказа несёт флаг вместе с самой
|
|
12
|
+
// кратностью: панель считает цену сама и без него применит скидку к уже специальной цене.
|
|
13
|
+
isDiscountAllowed: zod_1.z.boolean(),
|
|
11
14
|
});
|
|
@@ -9,4 +9,6 @@ exports.ProductMultiplicityOptionSchema = zod_1.z.object({
|
|
|
9
9
|
optionMultiplicity: zod_1.z.number(),
|
|
10
10
|
optionPrice: money_schema_1.MoneySchema.nullable(),
|
|
11
11
|
rank: zod_1.z.number(),
|
|
12
|
+
// Применять ли скидки клиента к цене этой кратности.
|
|
13
|
+
isDiscountAllowed: zod_1.z.boolean(),
|
|
12
14
|
});
|
|
@@ -7,6 +7,7 @@ const CreateProductMultiplicityOptionRequestSchema = z.object({
|
|
|
7
7
|
optionMultiplicity: z.coerce.number().int().min(1),
|
|
8
8
|
optionPrice: NonNegativeMoneySchema.nullable().optional(),
|
|
9
9
|
rank: z.coerce.number().int().min(0).default(0).optional(),
|
|
10
|
+
isDiscountAllowed: z.coerce.boolean().optional(),
|
|
10
11
|
});
|
|
11
12
|
|
|
12
13
|
const CreateProductMultiplicityOptionResponseSchema = z.object({
|
|
@@ -8,6 +8,7 @@ const UpdateProductMultiplicityOptionRequestSchema = z
|
|
|
8
8
|
optionMultiplicity: z.coerce.number().int().min(1),
|
|
9
9
|
optionPrice: NonNegativeMoneySchema.nullable(),
|
|
10
10
|
rank: z.coerce.number().int().min(0).default(0),
|
|
11
|
+
isDiscountAllowed: z.coerce.boolean(),
|
|
11
12
|
})
|
|
12
13
|
.partial();
|
|
13
14
|
|
package/package.json
CHANGED
|
@@ -16,8 +16,10 @@ export const discountRulesModeSchema = z.discriminatedUnion('typeDiscount', [
|
|
|
16
16
|
]);
|
|
17
17
|
|
|
18
18
|
// Rules schemas other data
|
|
19
|
+
// Проценты ограничены так же, как в discountRulesModeSchema выше: за 100 % скидка уводит цену
|
|
20
|
+
// в минус, отрицательная — наценка под видом скидки.
|
|
19
21
|
const DiscountRulesPersonalDiscountDataSchema = z.object({
|
|
20
|
-
discountPercent: z.number(),
|
|
22
|
+
discountPercent: z.number().min(0).max(100),
|
|
21
23
|
});
|
|
22
24
|
|
|
23
25
|
const DiscountRulesMonthlyOrderSumDataSchema = z.object({
|
|
@@ -26,12 +28,15 @@ const DiscountRulesMonthlyOrderSumDataSchema = z.object({
|
|
|
26
28
|
.array()
|
|
27
29
|
.length(2)
|
|
28
30
|
.refine(([min, max]) => min <= max),
|
|
29
|
-
discountPercent: z.number(),
|
|
31
|
+
discountPercent: z.number().min(0).max(100),
|
|
30
32
|
});
|
|
31
33
|
|
|
32
34
|
const DiscountRulesQuantityBasedDataSchema = z
|
|
33
35
|
.object({
|
|
34
|
-
multipleQuantity
|
|
36
|
+
// Кратность — целое положительное. При нуле `quantity % multipleQuantity` даёт NaN, и два
|
|
37
|
+
// потребителя расходятся: getPriceCalcDiscountOrderProductHelper считает условие
|
|
38
|
+
// выполненным всегда, splitQuantityProduct — не выполненным никогда.
|
|
39
|
+
multipleQuantity: z.number().int().positive(),
|
|
35
40
|
})
|
|
36
41
|
.and(discountRulesModeSchema);
|
|
37
42
|
|
|
@@ -6,4 +6,7 @@ export const OrderProductMultiplicityOptionSchema = z.object({
|
|
|
6
6
|
title: z.string().nullable(),
|
|
7
7
|
optionMultiplicity: z.coerce.number(),
|
|
8
8
|
optionPrice: MoneySchema.nullable(),
|
|
9
|
+
// Применять ли скидки клиента к цене этой кратности. Позиция заказа несёт флаг вместе с самой
|
|
10
|
+
// кратностью: панель считает цену сама и без него применит скидку к уже специальной цене.
|
|
11
|
+
isDiscountAllowed: z.boolean(),
|
|
9
12
|
});
|