@floristcloud/api-lib 1.2.109 → 1.2.111
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/client/get-client-calculate.query.js +6 -4
- package/build/commands/consignment/execute-consignment-product-update.command.js +5 -4
- package/build/commands/integration/moysklad/execute-moysklad-import.command.js +3 -2
- package/build/commands/integration/moysklad/preview-moysklad-products.query.js +3 -2
- package/build/commands/integration/moysklad/scan-moysklad-import.query.js +3 -2
- package/build/commands/order/create-order.command.js +2 -1
- package/build/commands/order/update-order.command.js +3 -2
- package/build/commands/order/webshop/get-order-sales-by-month.query.js +2 -1
- package/build/commands/order-product/create-order-product.command.js +2 -1
- package/build/commands/order-product/group/price-valuation-execute.command.js +3 -1
- package/build/commands/order-product/update-order-product.command.js +2 -1
- package/build/commands/payment-invoice/create-payment-invoice.command.js +3 -1
- package/build/commands/payment-invoice/pay-payment-invoice.command.js +3 -1
- package/build/commands/pre-order-collection-item/execute-pre-order-collection-item-update.command.js +3 -2
- package/build/commands/pre-order-collection-item/get-pre-order-collection-item-grouped-list-for-client.query.js +1 -0
- package/build/commands/pre-order-collection-item/get-pre-order-collection-item-list-filter-values-for-client.query.js +2 -0
- package/build/commands/pre-order-collection-item/get-pre-order-collection-item-list-filter-values.query.js +2 -0
- package/build/commands/pre-order-collection-item/get-pre-order-collection-item-list-for-client.query.js +1 -0
- package/build/commands/pre-order-collection-item/get-pre-order-collection-item-list.query.js +1 -0
- package/build/commands/pre-order-collection-item/multiplicity-option/create-pre-order-collection-item-multiplicity-option.command.js +2 -1
- package/build/commands/pre-order-collection-item/multiplicity-option/update-pre-order-collection-item-multiplicity-option.command.js +2 -1
- package/build/commands/product/create-product.command.js +4 -3
- package/build/commands/product/group/update-group-product-prices.command.js +3 -2
- package/build/commands/product/group/update-group-product-update-batch.command.js +4 -3
- package/build/commands/product/multiplicity-option/create-product-multiplicity-option.command.js +2 -1
- package/build/commands/product/multiplicity-option/update-product-multiplicity-option.command.js +2 -1
- package/build/commands/product/update-product.command.js +4 -3
- package/build/commands/report/get-cash-flow.query.js +8 -5
- package/build/commands/report/get-daily-orders-summary.query.js +2 -1
- package/build/commands/report/get-report-for-period.query.js +10 -9
- package/build/commands/report/get-report-group-by-client.query.js +11 -10
- package/build/commands/report/get-report-group-by-position.query.js +15 -14
- package/build/commands/report/get-sales-summary.query.js +13 -11
- package/build/commands/transaction/generate-check-transaction.command.js +2 -1
- package/build/commands/transaction/generate-pre-payment-check.command.js +2 -1
- package/build/commands/transaction/get-sum-transaction-by-money-account.query.js +3 -1
- package/build/commands/transaction/get-transaction-summary.query.js +5 -3
- package/build/commands/write-off/get-write-off-sum-by-order.query.js +3 -1
- package/build/commands/write-off/update-write-off-price.command.js +2 -1
- package/build/schemas/action-log/action-log-money.schema.js +28 -0
- package/build/schemas/action-log/index.js +1 -0
- package/build/schemas/action-log/order-info.schema.js +3 -2
- package/build/schemas/action-log/order-product-info.schema.js +2 -1
- package/build/schemas/action-log/order-product-update-action-log.schema.js +2 -1
- package/build/schemas/action-log/pre-order-product-info.schema.js +2 -1
- package/build/schemas/action-log/pre-order-product-update-action-log.schema.js +2 -1
- package/build/schemas/action-log/transaction-info.schema.js +2 -1
- package/build/schemas/bank-payment/bank-payment.schema.js +2 -1
- package/build/schemas/client/client-debt.schema.js +8 -5
- package/build/schemas/client/client.schema.js +2 -1
- package/build/schemas/consignment/consignment.schema.js +10 -9
- package/build/schemas/consignment-transfer/accept-consignment-transfer.schema.js +3 -1
- package/build/schemas/consignment-transfer/consignment-transfer-request-item.schema.js +2 -1
- package/build/schemas/delivery-route/delivery-route.schema.js +2 -1
- package/build/schemas/discount-rules/discount-rules.schema.js +9 -2
- package/build/schemas/index.js +3 -0
- package/build/schemas/money-account/money-account-with-balance.schema.js +2 -2
- package/build/schemas/money.schema.js +27 -0
- package/build/schemas/non-negative-money.schema.js +17 -0
- package/build/schemas/order/order.schema.js +10 -9
- package/build/schemas/order-product/order-product-multiplicity-optiom.schema.js +2 -1
- package/build/schemas/order-product/order-product.schema.js +5 -4
- package/build/schemas/order-product/price-correction-analyze-item.schema.js +10 -8
- package/build/schemas/order-product/price-correction-execute-result-item.schema.js +3 -2
- package/build/schemas/order-service-line/order-service-line.schema.js +12 -5
- package/build/schemas/payment-invoice/payment-invoice.schema.js +5 -4
- package/build/schemas/positive-money.schema.js +18 -0
- package/build/schemas/pre-order/pre-order.schema.js +2 -1
- package/build/schemas/pre-order-collection-item/pre-order-collection-item-multiplicity-option.schema.js +2 -1
- package/build/schemas/pre-order-collection-item/pre-order-collection-item.schema.js +4 -3
- package/build/schemas/pre-order-product/pre-order-product.schema.js +5 -4
- package/build/schemas/product/product-multiplicity-option.schema.js +2 -1
- package/build/schemas/product/product.schema.js +6 -5
- package/build/schemas/report/client-by-weeks.schema.js +2 -1
- package/build/schemas/report/client-statement.schema.js +2 -1
- package/build/schemas/report/inventory-turnover-category-item.schema.js +1 -1
- package/build/schemas/report/inventory-turnover-detailed-item.schema.js +1 -1
- package/build/schemas/report/sales-by-client-row.schema.js +9 -8
- package/build/schemas/report/sales-by-client-top-item.schema.js +2 -1
- package/build/schemas/service/service.schema.js +8 -3
- package/build/schemas/settings/settings.schema.js +6 -2
- package/build/schemas/transaction/transaction.schema.js +2 -1
- package/commands/client/get-client-calculate.query.ts +6 -4
- package/commands/consignment/execute-consignment-product-update.command.ts +5 -4
- package/commands/integration/moysklad/execute-moysklad-import.command.ts +3 -2
- package/commands/integration/moysklad/preview-moysklad-products.query.ts +3 -2
- package/commands/integration/moysklad/scan-moysklad-import.query.ts +3 -2
- package/commands/order/create-order.command.ts +2 -1
- package/commands/order/update-order.command.ts +3 -2
- package/commands/order/webshop/get-order-sales-by-month.query.ts +3 -1
- package/commands/order-product/create-order-product.command.ts +2 -1
- package/commands/order-product/group/price-valuation-execute.command.ts +4 -1
- package/commands/order-product/update-order-product.command.ts +2 -1
- package/commands/payment-invoice/create-payment-invoice.command.ts +4 -1
- package/commands/payment-invoice/pay-payment-invoice.command.ts +4 -1
- package/commands/pre-order-collection-item/execute-pre-order-collection-item-update.command.ts +3 -2
- package/commands/pre-order-collection-item/get-pre-order-collection-item-grouped-list-for-client.query.ts +1 -0
- package/commands/pre-order-collection-item/get-pre-order-collection-item-list-filter-values-for-client.query.ts +2 -0
- package/commands/pre-order-collection-item/get-pre-order-collection-item-list-filter-values.query.ts +2 -0
- package/commands/pre-order-collection-item/get-pre-order-collection-item-list-for-client.query.ts +1 -0
- package/commands/pre-order-collection-item/get-pre-order-collection-item-list.query.ts +1 -0
- package/commands/pre-order-collection-item/multiplicity-option/create-pre-order-collection-item-multiplicity-option.command.ts +2 -1
- package/commands/pre-order-collection-item/multiplicity-option/update-pre-order-collection-item-multiplicity-option.command.ts +2 -1
- package/commands/product/create-product.command.ts +4 -3
- package/commands/product/group/update-group-product-prices.command.ts +3 -2
- package/commands/product/group/update-group-product-update-batch.command.ts +4 -3
- package/commands/product/multiplicity-option/create-product-multiplicity-option.command.ts +2 -1
- package/commands/product/multiplicity-option/update-product-multiplicity-option.command.ts +2 -1
- package/commands/product/update-product.command.ts +4 -3
- package/commands/report/get-cash-flow.query.ts +8 -5
- package/commands/report/get-daily-orders-summary.query.ts +2 -1
- package/commands/report/get-report-for-period.query.ts +10 -9
- package/commands/report/get-report-group-by-client.query.ts +11 -10
- package/commands/report/get-report-group-by-position.query.ts +15 -14
- package/commands/report/get-sales-summary.query.ts +13 -11
- package/commands/transaction/generate-check-transaction.command.ts +2 -1
- package/commands/transaction/generate-pre-payment-check.command.ts +2 -1
- package/commands/transaction/get-sum-transaction-by-money-account.query.ts +3 -1
- package/commands/transaction/get-transaction-summary.query.ts +5 -3
- package/commands/write-off/get-write-off-sum-by-order.query.ts +4 -1
- package/commands/write-off/update-write-off-price.command.ts +2 -1
- package/package.json +1 -1
- package/schemas/action-log/action-log-money.schema.ts +26 -0
- package/schemas/action-log/index.ts +1 -0
- package/schemas/action-log/order-info.schema.ts +3 -2
- package/schemas/action-log/order-product-info.schema.ts +2 -1
- package/schemas/action-log/order-product-update-action-log.schema.ts +2 -1
- package/schemas/action-log/pre-order-product-info.schema.ts +2 -1
- package/schemas/action-log/pre-order-product-update-action-log.schema.ts +2 -1
- package/schemas/action-log/transaction-info.schema.ts +2 -1
- package/schemas/bank-payment/bank-payment.schema.ts +2 -1
- package/schemas/client/client-debt.schema.ts +8 -5
- package/schemas/client/client.schema.ts +2 -1
- package/schemas/consignment/consignment.schema.ts +10 -9
- package/schemas/consignment-transfer/accept-consignment-transfer.schema.ts +4 -1
- package/schemas/consignment-transfer/consignment-transfer-request-item.schema.ts +2 -1
- package/schemas/delivery-route/delivery-route.schema.ts +2 -1
- package/schemas/discount-rules/discount-rules.schema.ts +9 -2
- package/schemas/index.ts +3 -0
- package/schemas/money-account/money-account-with-balance.schema.ts +2 -1
- package/schemas/money.schema.ts +25 -0
- package/schemas/non-negative-money.schema.ts +15 -0
- package/schemas/order/order.schema.ts +10 -9
- package/schemas/order-product/order-product-multiplicity-optiom.schema.ts +2 -1
- package/schemas/order-product/order-product.schema.ts +5 -4
- package/schemas/order-product/price-correction-analyze-item.schema.ts +10 -8
- package/schemas/order-product/price-correction-execute-result-item.schema.ts +3 -2
- package/schemas/order-service-line/order-service-line.schema.ts +13 -5
- package/schemas/payment-invoice/payment-invoice.schema.ts +5 -4
- package/schemas/positive-money.schema.ts +16 -0
- package/schemas/pre-order/pre-order.schema.ts +2 -1
- package/schemas/pre-order-collection-item/pre-order-collection-item-multiplicity-option.schema.ts +3 -1
- package/schemas/pre-order-collection-item/pre-order-collection-item.schema.ts +4 -3
- package/schemas/pre-order-product/pre-order-product.schema.ts +5 -4
- package/schemas/product/product-multiplicity-option.schema.ts +2 -1
- package/schemas/product/product.schema.ts +6 -5
- package/schemas/report/client-by-weeks.schema.ts +2 -1
- package/schemas/report/client-statement.schema.ts +2 -1
- package/schemas/report/inventory-turnover-category-item.schema.ts +1 -1
- package/schemas/report/inventory-turnover-detailed-item.schema.ts +1 -1
- package/schemas/report/sales-by-client-row.schema.ts +9 -8
- package/schemas/report/sales-by-client-top-item.schema.ts +2 -1
- package/schemas/service/service.schema.ts +9 -3
- package/schemas/settings/settings.schema.ts +7 -2
- package/schemas/transaction/transaction.schema.ts +2 -1
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OrderProductMultiplicityOptionSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const money_schema_1 = require("../money.schema");
|
|
5
6
|
exports.OrderProductMultiplicityOptionSchema = zod_1.z.object({
|
|
6
7
|
uuid: zod_1.z.uuid(),
|
|
7
8
|
title: zod_1.z.string().nullable(),
|
|
8
9
|
optionMultiplicity: zod_1.z.coerce.number(),
|
|
9
|
-
optionPrice:
|
|
10
|
+
optionPrice: money_schema_1.MoneySchema.nullable(),
|
|
10
11
|
});
|
|
@@ -8,17 +8,18 @@ const client_1 = require("../client");
|
|
|
8
8
|
const branch_schema_1 = require("../branch/branch.schema");
|
|
9
9
|
const distribution_schema_1 = require("../distribution/distribution.schema");
|
|
10
10
|
const order_product_multiplicity_optiom_schema_1 = require("./order-product-multiplicity-optiom.schema");
|
|
11
|
+
const money_schema_1 = require("../money.schema");
|
|
11
12
|
exports.OrderProductSchema = zod_1.z.object({
|
|
12
13
|
uuid: zod_1.z.uuid(),
|
|
13
14
|
productUUID: zod_1.z.uuid(),
|
|
14
15
|
orderUUID: zod_1.z.uuid(),
|
|
15
16
|
multiplicityOptionUUID: zod_1.z.uuid().nullable().optional(),
|
|
16
17
|
quantity: zod_1.z.number(),
|
|
17
|
-
price:
|
|
18
|
-
amount:
|
|
19
|
-
vatAmount:
|
|
18
|
+
price: money_schema_1.MoneySchema,
|
|
19
|
+
amount: money_schema_1.MoneySchema,
|
|
20
|
+
vatAmount: money_schema_1.MoneySchema,
|
|
20
21
|
vat: zod_1.z.number().nullable(),
|
|
21
|
-
checkAmount:
|
|
22
|
+
checkAmount: money_schema_1.MoneySchema,
|
|
22
23
|
comment: zod_1.z.string().nullable(),
|
|
23
24
|
tag: zod_1.z.string().nullable(),
|
|
24
25
|
isVerified: zod_1.z.boolean(),
|
|
@@ -4,6 +4,7 @@ exports.PriceCorrectionAnalyzeItemSchema = void 0;
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const enum_1 = require("../../enum");
|
|
6
6
|
const error_message_schema_1 = require("../error-message.schema");
|
|
7
|
+
const money_schema_1 = require("../money.schema");
|
|
7
8
|
exports.PriceCorrectionAnalyzeItemSchema = zod_1.z.object({
|
|
8
9
|
orderProductUUID: zod_1.z.string(),
|
|
9
10
|
orderUUID: zod_1.z.string(),
|
|
@@ -20,15 +21,16 @@ exports.PriceCorrectionAnalyzeItemSchema = zod_1.z.object({
|
|
|
20
21
|
size3: zod_1.z.string().nullable(),
|
|
21
22
|
article: zod_1.z.string().nullable(),
|
|
22
23
|
color: zod_1.z.string().nullable(),
|
|
23
|
-
currentPrice:
|
|
24
|
-
currentAmount:
|
|
24
|
+
currentPrice: money_schema_1.MoneySchema,
|
|
25
|
+
currentAmount: money_schema_1.MoneySchema,
|
|
25
26
|
quantity: zod_1.z.number(),
|
|
26
|
-
newPriceWithoutDiscount:
|
|
27
|
-
newPriceWithDiscount:
|
|
28
|
-
newAmountWithoutDiscount:
|
|
29
|
-
newAmountWithDiscount:
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
newPriceWithoutDiscount: money_schema_1.MoneySchema,
|
|
28
|
+
newPriceWithDiscount: money_schema_1.MoneySchema,
|
|
29
|
+
newAmountWithoutDiscount: money_schema_1.MoneySchema,
|
|
30
|
+
newAmountWithDiscount: money_schema_1.MoneySchema,
|
|
31
|
+
// Разницы могут быть отрицательными — цена корректируется в обе стороны, поэтому без ограничения знака.
|
|
32
|
+
priceDifferenceWithoutDiscount: money_schema_1.MoneySchema,
|
|
33
|
+
priceDifferenceWithDiscount: money_schema_1.MoneySchema,
|
|
32
34
|
isSkipped: zod_1.z.boolean(),
|
|
33
35
|
skipReason: error_message_schema_1.ErrorMessageSchema.optional(),
|
|
34
36
|
});
|
|
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PriceCorrectionExecuteResultItemSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const error_message_schema_1 = require("../error-message.schema");
|
|
6
|
+
const money_schema_1 = require("../money.schema");
|
|
6
7
|
exports.PriceCorrectionExecuteResultItemSchema = zod_1.z.object({
|
|
7
8
|
orderProductUUID: zod_1.z.string(),
|
|
8
9
|
orderUUID: zod_1.z.string(),
|
|
9
10
|
isSuccess: zod_1.z.boolean(),
|
|
10
11
|
error: error_message_schema_1.ErrorMessageSchema.optional(),
|
|
11
|
-
oldPrice:
|
|
12
|
-
newPrice:
|
|
12
|
+
oldPrice: money_schema_1.MoneySchema.optional(),
|
|
13
|
+
newPrice: money_schema_1.MoneySchema.optional(),
|
|
13
14
|
});
|
|
@@ -3,16 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DeleteOrderServiceLineResponseSchema = exports.GetOrderServiceLineListResponseSchema = exports.UpdateOrderServiceLineResponseSchema = exports.CreateOrderServiceLineResponseSchema = exports.GetOrderServiceLineListRequestSchema = exports.UpdateOrderServiceLineRequestSchema = exports.CreateOrderServiceLineRequestSchema = exports.OrderServiceLineSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const service_pricing_unit_enum_1 = require("../../enum/service-pricing-unit.enum");
|
|
6
|
+
const money_schema_1 = require("../money.schema");
|
|
7
|
+
const non_negative_money_schema_1 = require("../non-negative-money.schema");
|
|
8
|
+
// Цена строки услуги: неотрицательная и не больше миллиарда. Знак берём из самой строки,
|
|
9
|
+
// потолок — из разобранного значения: до 1e9 с двумя знаками число представимо точно.
|
|
10
|
+
const OrderServiceLinePriceSchema = non_negative_money_schema_1.NonNegativeMoneySchema.refine(value => Number(value) <= 1000000000, {
|
|
11
|
+
message: 'validation.money.max',
|
|
12
|
+
});
|
|
6
13
|
exports.OrderServiceLineSchema = zod_1.z.object({
|
|
7
14
|
uuid: zod_1.z.uuid(),
|
|
8
15
|
orderUUID: zod_1.z.uuid(),
|
|
9
16
|
serviceUUID: zod_1.z.uuid().nullable(),
|
|
10
17
|
name: zod_1.z.string(),
|
|
11
|
-
price:
|
|
18
|
+
price: money_schema_1.MoneySchema,
|
|
12
19
|
quantity: zod_1.z.number(),
|
|
13
|
-
amount:
|
|
20
|
+
amount: money_schema_1.MoneySchema,
|
|
14
21
|
vat: zod_1.z.number().nullable(),
|
|
15
|
-
vatAmount:
|
|
22
|
+
vatAmount: money_schema_1.MoneySchema,
|
|
16
23
|
unit: zod_1.z.nativeEnum(service_pricing_unit_enum_1.ServicePricingUnitEnum),
|
|
17
24
|
comment: zod_1.z.string().nullable(),
|
|
18
25
|
createdAt: zod_1.z.date(),
|
|
@@ -23,7 +30,7 @@ exports.CreateOrderServiceLineRequestSchema = zod_1.z
|
|
|
23
30
|
orderUUID: zod_1.z.uuid(),
|
|
24
31
|
serviceUUID: zod_1.z.uuid().optional(),
|
|
25
32
|
name: zod_1.z.string().min(1).max(255).optional(),
|
|
26
|
-
price:
|
|
33
|
+
price: OrderServiceLinePriceSchema.optional(),
|
|
27
34
|
quantity: zod_1.z.number().int().min(1).max(1000000).optional().default(1),
|
|
28
35
|
vat: zod_1.z.number().int().min(0).max(100).optional(),
|
|
29
36
|
comment: zod_1.z.string().max(1000).optional(),
|
|
@@ -32,7 +39,7 @@ exports.CreateOrderServiceLineRequestSchema = zod_1.z
|
|
|
32
39
|
message: 'validation.serviceOrNamePrice',
|
|
33
40
|
});
|
|
34
41
|
exports.UpdateOrderServiceLineRequestSchema = zod_1.z.object({
|
|
35
|
-
price:
|
|
42
|
+
price: OrderServiceLinePriceSchema.optional(),
|
|
36
43
|
quantity: zod_1.z.number().int().min(1).max(1000000).optional(),
|
|
37
44
|
comment: zod_1.z.string().max(1000).nullable().optional(),
|
|
38
45
|
});
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PaymentInvoiceSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const payment_invoice_status_enum_1 = require("../../enum/payment-invoice-status.enum");
|
|
6
|
+
const money_schema_1 = require("../money.schema");
|
|
6
7
|
// Строка счёта. Для счёта, собранного из заказов, каждая строка — снимок заказа на момент
|
|
7
8
|
// выставления: заказ потом может измениться, а выставленный счёт обязан остаться прежним.
|
|
8
9
|
const PaymentInvoiceItemSchema = zod_1.z.object({
|
|
@@ -10,15 +11,15 @@ const PaymentInvoiceItemSchema = zod_1.z.object({
|
|
|
10
11
|
orderId: zod_1.z.number().nullable(),
|
|
11
12
|
orderDate: zod_1.z.coerce.date().nullable(),
|
|
12
13
|
description: zod_1.z.string(),
|
|
13
|
-
amount:
|
|
14
|
+
amount: money_schema_1.MoneySchema,
|
|
14
15
|
});
|
|
15
16
|
exports.PaymentInvoiceSchema = zod_1.z.object({
|
|
16
17
|
uuid: zod_1.z.string(),
|
|
17
18
|
number: zod_1.z.string(),
|
|
18
19
|
invoiceDate: zod_1.z.coerce.date(),
|
|
19
|
-
amount:
|
|
20
|
-
paidAmount:
|
|
21
|
-
remainingAmount:
|
|
20
|
+
amount: money_schema_1.MoneySchema,
|
|
21
|
+
paidAmount: money_schema_1.MoneySchema,
|
|
22
|
+
remainingAmount: money_schema_1.MoneySchema,
|
|
22
23
|
status: zod_1.z.nativeEnum(payment_invoice_status_enum_1.PaymentInvoiceStatusEnum),
|
|
23
24
|
clientUUID: zod_1.z.string(),
|
|
24
25
|
clientName: zod_1.z.string(),
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PositiveMoneySchema = void 0;
|
|
4
|
+
const money_schema_1 = require("./money.schema");
|
|
5
|
+
/**
|
|
6
|
+
* Денежная величина строго больше нуля: сумма платежа, фиксированная скидка.
|
|
7
|
+
*
|
|
8
|
+
* Отличается от `NonNegativeMoneySchema` тем, что отвергает ноль — платёж на 0 рублей или скидка
|
|
9
|
+
* в 0 рублей это не операция, а ошибка ввода.
|
|
10
|
+
*
|
|
11
|
+
* Обе проверки строковые: знак берётся по первому символу, а ноль опознаётся по форме записи —
|
|
12
|
+
* `MoneySchema` уже гарантировал формат `^-?\d+(\.\d{1,2})?$`, поэтому нулю соответствуют ровно
|
|
13
|
+
* `0`, `0.0` и `0.00`. Через `Number()` это не проверяется намеренно: приводить деньги к float
|
|
14
|
+
* ради сравнения — то, от чего ушли.
|
|
15
|
+
*/
|
|
16
|
+
exports.PositiveMoneySchema = money_schema_1.MoneySchema.refine(value => !value.startsWith('-') && !/^0+(\.0*)?$/.test(value), {
|
|
17
|
+
message: 'validation.money.positive',
|
|
18
|
+
});
|
|
@@ -6,6 +6,7 @@ const enum_1 = require("../../enum");
|
|
|
6
6
|
const client_1 = require("../client");
|
|
7
7
|
const branch_schema_1 = require("../branch/branch.schema");
|
|
8
8
|
const pre_order_collection_schema_1 = require("../pre-order-collection/pre-order-collection.schema");
|
|
9
|
+
const money_schema_1 = require("../money.schema");
|
|
9
10
|
exports.PreOrderSchema = zod_1.z.object({
|
|
10
11
|
uuid: zod_1.z.string(),
|
|
11
12
|
clientUUID: zod_1.z.string(),
|
|
@@ -22,7 +23,7 @@ exports.PreOrderExtendedSchema = exports.PreOrderSchema.extend({
|
|
|
22
23
|
preOrderCollection: pre_order_collection_schema_1.PreOrderCollectionSchema.nullable(),
|
|
23
24
|
totalPositions: zod_1.z.number(),
|
|
24
25
|
totalQuantity: zod_1.z.number(),
|
|
25
|
-
totalPrice:
|
|
26
|
+
totalPrice: money_schema_1.MoneySchema,
|
|
26
27
|
});
|
|
27
28
|
exports.PreOrderWithClientSchema = exports.PreOrderSchema.extend({
|
|
28
29
|
preOrderCollection: pre_order_collection_schema_1.PreOrderCollectionSchema.nullable(),
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PreOrderCollectionItemMultiplicityOptionSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const non_negative_money_schema_1 = require("../non-negative-money.schema");
|
|
5
6
|
exports.PreOrderCollectionItemMultiplicityOptionSchema = zod_1.z.object({
|
|
6
7
|
uuid: zod_1.z.string(),
|
|
7
8
|
title: zod_1.z.string().max(100).nullable(),
|
|
8
9
|
optionMultiplicity: zod_1.z.number().int().min(1),
|
|
9
|
-
optionPrice:
|
|
10
|
+
optionPrice: non_negative_money_schema_1.NonNegativeMoneySchema.nullable(),
|
|
10
11
|
rank: zod_1.z.number().int().min(0),
|
|
11
12
|
});
|
|
@@ -9,6 +9,7 @@ const client_1 = require("../client");
|
|
|
9
9
|
const pre_order_product_schema_1 = require("../pre-order-product/pre-order-product.schema");
|
|
10
10
|
const enum_1 = require("../../enum");
|
|
11
11
|
const pre_order_collection_item_multiplicity_option_schema_1 = require("./pre-order-collection-item-multiplicity-option.schema");
|
|
12
|
+
const money_schema_1 = require("../money.schema");
|
|
12
13
|
exports.PreOrderCollectionItemSchema = zod_1.z.object({
|
|
13
14
|
uuid: zod_1.z.string(),
|
|
14
15
|
productUUID: zod_1.z.string().nullable(),
|
|
@@ -20,7 +21,7 @@ exports.PreOrderCollectionItemSchema = zod_1.z.object({
|
|
|
20
21
|
quantity: zod_1.z.number().nullable(),
|
|
21
22
|
balance: zod_1.z.number().nullable(),
|
|
22
23
|
imageUUID: zod_1.z.string().nullable(),
|
|
23
|
-
price:
|
|
24
|
+
price: money_schema_1.MoneySchema,
|
|
24
25
|
advancedPrice: zod_1.z.string().nullable(),
|
|
25
26
|
grower: zod_1.z.string().nullable(),
|
|
26
27
|
size: zod_1.z.string().nullable(),
|
|
@@ -48,7 +49,7 @@ exports.CreatePreOrderCollectionItemSchema = zod_1.z.object({
|
|
|
48
49
|
quantity: zod_1.z.coerce.number().nullable().optional(),
|
|
49
50
|
balance: zod_1.z.coerce.number().nullable().optional(),
|
|
50
51
|
imageUUID: zod_1.z.string().nullable().optional(),
|
|
51
|
-
price:
|
|
52
|
+
price: money_schema_1.MoneySchema,
|
|
52
53
|
advancedPrice: zod_1.z.string().nullable().optional(),
|
|
53
54
|
grower: zod_1.z.string().nullable().optional(),
|
|
54
55
|
size: zod_1.z.string().nullable().optional(),
|
|
@@ -76,7 +77,7 @@ exports.UpdatePreOrderCollectionItemSchema = zod_1.z
|
|
|
76
77
|
quantity: zod_1.z.coerce.number().nullable(),
|
|
77
78
|
balance: zod_1.z.coerce.number().nullable(),
|
|
78
79
|
imageUUID: zod_1.z.string().nullable(),
|
|
79
|
-
price:
|
|
80
|
+
price: money_schema_1.MoneySchema,
|
|
80
81
|
advancedPrice: zod_1.z.string().nullable(),
|
|
81
82
|
grower: zod_1.z.string().nullable(),
|
|
82
83
|
size: zod_1.z.string().nullable(),
|
|
@@ -5,6 +5,7 @@ const zod_1 = require("zod");
|
|
|
5
5
|
const pre_order_collection_item_schema_1 = require("../pre-order-collection-item/pre-order-collection-item.schema");
|
|
6
6
|
const category_schema_1 = require("../category/category.schema");
|
|
7
7
|
const pre_order_collection_item_multiplicity_option_schema_1 = require("../pre-order-collection-item/pre-order-collection-item-multiplicity-option.schema");
|
|
8
|
+
const money_schema_1 = require("../money.schema");
|
|
8
9
|
exports.MatchingConfigSchema = zod_1.z.object({
|
|
9
10
|
matchByName: zod_1.z.coerce.boolean(),
|
|
10
11
|
matchByCategory: zod_1.z.coerce.boolean(),
|
|
@@ -23,13 +24,13 @@ exports.PreOrderProductSchema = zod_1.z.object({
|
|
|
23
24
|
tag: zod_1.z.string().nullable(),
|
|
24
25
|
isPurchased: zod_1.z.boolean(),
|
|
25
26
|
isReplaceable: zod_1.z.boolean(),
|
|
26
|
-
stopPrice:
|
|
27
|
+
stopPrice: money_schema_1.MoneySchema.nullable(),
|
|
27
28
|
highAttention: zod_1.z.boolean(),
|
|
28
29
|
categoryUUID: zod_1.z.string().nullable(),
|
|
29
30
|
name: zod_1.z.string().nullable(),
|
|
30
31
|
grower: zod_1.z.string().nullable(),
|
|
31
32
|
size: zod_1.z.string().nullable(),
|
|
32
|
-
price:
|
|
33
|
+
price: money_schema_1.MoneySchema.nullable(),
|
|
33
34
|
color: zod_1.z.string().nullable(),
|
|
34
35
|
parentPreOrderProductUUID: zod_1.z.string().nullable(),
|
|
35
36
|
matchingConfig: exports.MatchingConfigSchema.optional().nullable(),
|
|
@@ -46,7 +47,7 @@ exports.CreatePreOrderProductSchema = exports.PreOrderProductSchema.omit({ uuid:
|
|
|
46
47
|
name: zod_1.z.string().nullable().optional(),
|
|
47
48
|
grower: zod_1.z.string().nullable().optional(),
|
|
48
49
|
size: zod_1.z.string().nullable().optional(),
|
|
49
|
-
price:
|
|
50
|
+
price: money_schema_1.MoneySchema.nullable().optional(),
|
|
50
51
|
color: zod_1.z.string().nullable().optional(),
|
|
51
52
|
parentPreOrderProductUUID: zod_1.z.string().nullable().optional(),
|
|
52
53
|
matchingConfig: exports.MatchingConfigSchema.optional().nullable(),
|
|
@@ -61,7 +62,7 @@ exports.UpdatePreOrderProductSchema = exports.PreOrderProductSchema.omit({
|
|
|
61
62
|
name: zod_1.z.string().nullable().optional(),
|
|
62
63
|
grower: zod_1.z.string().nullable().optional(),
|
|
63
64
|
size: zod_1.z.string().nullable().optional(),
|
|
64
|
-
price:
|
|
65
|
+
price: money_schema_1.MoneySchema.nullable().optional(),
|
|
65
66
|
color: zod_1.z.string().nullable().optional(),
|
|
66
67
|
parentPreOrderProductUUID: zod_1.z.string().nullable().optional(),
|
|
67
68
|
matchingConfig: exports.MatchingConfigSchema.optional().nullable(),
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ProductMultiplicityOptionSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const money_schema_1 = require("../money.schema");
|
|
5
6
|
exports.ProductMultiplicityOptionSchema = zod_1.z.object({
|
|
6
7
|
uuid: zod_1.z.uuid(),
|
|
7
8
|
title: zod_1.z.string().nullable(),
|
|
8
9
|
optionMultiplicity: zod_1.z.number(),
|
|
9
|
-
optionPrice:
|
|
10
|
+
optionPrice: money_schema_1.MoneySchema.nullable(),
|
|
10
11
|
rank: zod_1.z.number(),
|
|
11
12
|
});
|
|
@@ -9,6 +9,7 @@ const consignment_schema_1 = require("../consignment/consignment.schema");
|
|
|
9
9
|
const enum_1 = require("../../enum");
|
|
10
10
|
const discount_rules_schema_1 = require("../discount-rules/discount-rules.schema");
|
|
11
11
|
const __1 = require("../..");
|
|
12
|
+
const money_schema_1 = require("../money.schema");
|
|
12
13
|
exports.ProductSchema = zod_1.z.object({
|
|
13
14
|
uuid: zod_1.z.uuid(),
|
|
14
15
|
consignmentUUID: zod_1.z.uuid(),
|
|
@@ -16,8 +17,8 @@ exports.ProductSchema = zod_1.z.object({
|
|
|
16
17
|
name: zod_1.z.string(),
|
|
17
18
|
balance: zod_1.z.number(),
|
|
18
19
|
quantity: zod_1.z.number(),
|
|
19
|
-
price:
|
|
20
|
-
costPrice:
|
|
20
|
+
price: money_schema_1.MoneySchema,
|
|
21
|
+
costPrice: money_schema_1.MoneySchema,
|
|
21
22
|
multiplicity: zod_1.z.number(),
|
|
22
23
|
isOpen: zod_1.z.boolean(),
|
|
23
24
|
article: zod_1.z.string().nullable(),
|
|
@@ -27,7 +28,7 @@ exports.ProductSchema = zod_1.z.object({
|
|
|
27
28
|
size: zod_1.z.string().nullable(),
|
|
28
29
|
size2: zod_1.z.string().nullable(),
|
|
29
30
|
size3: zod_1.z.string().nullable(),
|
|
30
|
-
invoicePrice:
|
|
31
|
+
invoicePrice: money_schema_1.MoneySchema.nullable(),
|
|
31
32
|
invoiceNumber: zod_1.z.string().nullable(),
|
|
32
33
|
imageUUID: zod_1.z.string().nullable(),
|
|
33
34
|
country: zod_1.z.string().nullable(),
|
|
@@ -51,7 +52,7 @@ exports.ProductForClientSchema = zod_1.z.object({
|
|
|
51
52
|
uuid: zod_1.z.uuid(),
|
|
52
53
|
name: zod_1.z.string(),
|
|
53
54
|
balance: zod_1.z.number(),
|
|
54
|
-
price:
|
|
55
|
+
price: money_schema_1.MoneySchema,
|
|
55
56
|
multiplicity: zod_1.z.number(),
|
|
56
57
|
article: zod_1.z.string().nullable(),
|
|
57
58
|
barcode: zod_1.z.string().nullable(),
|
|
@@ -94,7 +95,7 @@ exports.ProductExtendedForClientSchema = exports.ProductForClientSchema.merge(zo
|
|
|
94
95
|
discountRulesUUID: zod_1.z.string(),
|
|
95
96
|
type: zod_1.z.nativeEnum(enum_1.DiscountRulesTypeEnum),
|
|
96
97
|
discountValueData: discount_rules_schema_1.discountRulesModeSchema,
|
|
97
|
-
priceWithDiscount:
|
|
98
|
+
priceWithDiscount: money_schema_1.MoneySchema,
|
|
98
99
|
multipleQuantity: zod_1.z.number().optional(),
|
|
99
100
|
})
|
|
100
101
|
.array()
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ClientByWeeksSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const money_schema_1 = require("../money.schema");
|
|
5
6
|
exports.ClientByWeeksSchema = zod_1.z.object({
|
|
6
7
|
weekStart: zod_1.z.coerce.date(),
|
|
7
8
|
weekEnd: zod_1.z.coerce.date(),
|
|
@@ -10,5 +11,5 @@ exports.ClientByWeeksSchema = zod_1.z.object({
|
|
|
10
11
|
clientGroup: zod_1.z.string().nullable(),
|
|
11
12
|
hasOrders: zod_1.z.boolean(),
|
|
12
13
|
ordersCount: zod_1.z.number(),
|
|
13
|
-
totalAmount:
|
|
14
|
+
totalAmount: money_schema_1.MoneySchema,
|
|
14
15
|
});
|
|
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ClientStatementItemSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const enum_1 = require("../../enum");
|
|
6
|
+
const money_schema_1 = require("../money.schema");
|
|
6
7
|
exports.ClientStatementItemSchema = zod_1.z.object({
|
|
7
8
|
date: zod_1.z.coerce.date(),
|
|
8
9
|
type: zod_1.z.nativeEnum(enum_1.ClientStatementTypeEnum),
|
|
9
|
-
amount:
|
|
10
|
+
amount: money_schema_1.MoneySchema,
|
|
10
11
|
description: zod_1.z.string(),
|
|
11
12
|
documentNumber: zod_1.z.string().nullable(),
|
|
12
13
|
transactionType: zod_1.z.nativeEnum(enum_1.TransactionTypeEnum).nullable(),
|
|
@@ -9,7 +9,7 @@ exports.InventoryTurnoverCategoryItemSchema = zod_1.z.object({
|
|
|
9
9
|
initialBalance: zod_1.z.number(), // начальный остаток
|
|
10
10
|
receipts: zod_1.z.number(), // приходы
|
|
11
11
|
sales: zod_1.z.number(), // продажи
|
|
12
|
-
currentBalance: zod_1.z.number(), //
|
|
12
|
+
currentBalance: zod_1.z.number(), // товарный остаток (SUM по product.balance, Int), не деньги
|
|
13
13
|
daysInStock: zod_1.z.number(), // дни в наличии на складе
|
|
14
14
|
turnoverRate: zod_1.z.number(), // коэффициент оборачиваемости
|
|
15
15
|
});
|
|
@@ -13,7 +13,7 @@ exports.InventoryTurnoverDetailedItemSchema = zod_1.z.object({
|
|
|
13
13
|
initialBalance: zod_1.z.number(), // начальный остаток
|
|
14
14
|
receipts: zod_1.z.number(), // приходы
|
|
15
15
|
sales: zod_1.z.number(), // продажи
|
|
16
|
-
currentBalance: zod_1.z.number(), //
|
|
16
|
+
currentBalance: zod_1.z.number(), // товарный остаток (SUM по product.balance, Int), не деньги
|
|
17
17
|
daysInStock: zod_1.z.number(), // дни в наличии на складе
|
|
18
18
|
turnoverRate: zod_1.z.number(), // коэффициент оборачиваемости
|
|
19
19
|
});
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SalesByClientRowSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const sales_by_client_top_item_schema_1 = require("./sales-by-client-top-item.schema");
|
|
6
|
+
const money_schema_1 = require("../money.schema");
|
|
6
7
|
/**
|
|
7
8
|
* Строка отчёта «продажи по клиентам» — те же данные, что уходят в Excel из `export/sales/clients`.
|
|
8
9
|
* Опциональные поля отсутствуют в ответе, когда у клиента нет соответствующего значения.
|
|
@@ -18,18 +19,18 @@ exports.SalesByClientRowSchema = zod_1.z.object({
|
|
|
18
19
|
PACK: zod_1.z.number(),
|
|
19
20
|
BOX: zod_1.z.number(),
|
|
20
21
|
}),
|
|
21
|
-
totalSales:
|
|
22
|
-
avgCheck:
|
|
23
|
-
totalWriteOff:
|
|
24
|
-
grossProfit:
|
|
22
|
+
totalSales: money_schema_1.MoneySchema,
|
|
23
|
+
avgCheck: money_schema_1.MoneySchema,
|
|
24
|
+
totalWriteOff: money_schema_1.MoneySchema,
|
|
25
|
+
grossProfit: money_schema_1.MoneySchema,
|
|
25
26
|
marginality: zod_1.z.number(),
|
|
26
27
|
// Оплаты (INCOME) и предоплаты (PREPAYMENT) клиента за период
|
|
27
|
-
totalPayments:
|
|
28
|
-
totalPrepayments:
|
|
28
|
+
totalPayments: money_schema_1.MoneySchema,
|
|
29
|
+
totalPrepayments: money_schema_1.MoneySchema,
|
|
29
30
|
// Сумма услуг (order_service_line) за период — отдельно, вне товарных sales/margin
|
|
30
|
-
totalServiceAmount:
|
|
31
|
+
totalServiceAmount: money_schema_1.MoneySchema,
|
|
31
32
|
// Текущий баланс клиента (на момент формирования отчёта)
|
|
32
|
-
balance:
|
|
33
|
+
balance: money_schema_1.MoneySchema,
|
|
33
34
|
lastOrderDate: zod_1.z.coerce.date().optional(),
|
|
34
35
|
// Топ-5 по сумме выручки за период
|
|
35
36
|
topCategories: zod_1.z.array(sales_by_client_top_item_schema_1.SalesByClientTopItemSchema),
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SalesByClientTopItemSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const money_schema_1 = require("../money.schema");
|
|
5
6
|
/** Элемент топа (категория или товар) внутри строки отчёта «продажи по клиентам». */
|
|
6
7
|
exports.SalesByClientTopItemSchema = zod_1.z.object({
|
|
7
8
|
name: zod_1.z.string(),
|
|
8
|
-
amount:
|
|
9
|
+
amount: money_schema_1.MoneySchema,
|
|
9
10
|
});
|
|
@@ -4,10 +4,15 @@ exports.GetServiceListRequestSchema = exports.UpdateServiceRequestSchema = expor
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const service_pricing_unit_enum_1 = require("../../enum/service-pricing-unit.enum");
|
|
6
6
|
const service_status_enum_1 = require("../../enum/service-status.enum");
|
|
7
|
+
const money_schema_1 = require("../money.schema");
|
|
8
|
+
const non_negative_money_schema_1 = require("../non-negative-money.schema");
|
|
9
|
+
// Цена услуги: неотрицательная и не больше миллиарда. Знак берём из самой строки,
|
|
10
|
+
// потолок — из разобранного значения: до 1e9 с двумя знаками число представимо точно.
|
|
11
|
+
const ServicePriceSchema = non_negative_money_schema_1.NonNegativeMoneySchema.refine(value => Number(value) <= 1000000000, { message: 'validation.money.max' });
|
|
7
12
|
exports.ServiceSchema = zod_1.z.object({
|
|
8
13
|
uuid: zod_1.z.uuid(),
|
|
9
14
|
name: zod_1.z.string(),
|
|
10
|
-
price:
|
|
15
|
+
price: money_schema_1.MoneySchema,
|
|
11
16
|
vat: zod_1.z.number().nullable(),
|
|
12
17
|
unit: zod_1.z.nativeEnum(service_pricing_unit_enum_1.ServicePricingUnitEnum),
|
|
13
18
|
status: zod_1.z.nativeEnum(service_status_enum_1.ServiceStatusEnum),
|
|
@@ -16,13 +21,13 @@ exports.ServiceSchema = zod_1.z.object({
|
|
|
16
21
|
});
|
|
17
22
|
exports.CreateServiceRequestSchema = zod_1.z.object({
|
|
18
23
|
name: zod_1.z.string().min(1).max(255),
|
|
19
|
-
price:
|
|
24
|
+
price: ServicePriceSchema,
|
|
20
25
|
vat: zod_1.z.number().int().min(0).max(100).nullable().optional(),
|
|
21
26
|
unit: zod_1.z.nativeEnum(service_pricing_unit_enum_1.ServicePricingUnitEnum).optional().default(service_pricing_unit_enum_1.ServicePricingUnitEnum.FIXED),
|
|
22
27
|
});
|
|
23
28
|
exports.UpdateServiceRequestSchema = zod_1.z.object({
|
|
24
29
|
name: zod_1.z.string().min(1).max(255).optional(),
|
|
25
|
-
price:
|
|
30
|
+
price: ServicePriceSchema.optional(),
|
|
26
31
|
vat: zod_1.z.number().int().min(0).max(100).nullable().optional(),
|
|
27
32
|
unit: zod_1.z.nativeEnum(service_pricing_unit_enum_1.ServicePricingUnitEnum).optional(),
|
|
28
33
|
status: zod_1.z.nativeEnum(service_status_enum_1.ServiceStatusEnum).optional(),
|
|
@@ -5,6 +5,7 @@ const zod_1 = require("zod");
|
|
|
5
5
|
const enum_1 = require("../../enum");
|
|
6
6
|
const webshop_main_display_mode_enum_1 = require("../../enum/webshop-main-display-mode.enum");
|
|
7
7
|
const menu_items_url_enum_1 = require("../../enum/menu-items-url.enum");
|
|
8
|
+
const non_negative_money_schema_1 = require("../non-negative-money.schema");
|
|
8
9
|
exports.SettingsWorkingHoursSchema = zod_1.z.object({
|
|
9
10
|
uuid: zod_1.z.string(),
|
|
10
11
|
settingsUUID: zod_1.z.string(),
|
|
@@ -20,9 +21,12 @@ exports.ImportantMessageSchema = zod_1.z.object({
|
|
|
20
21
|
description: zod_1.z.string(),
|
|
21
22
|
isActive: zod_1.z.boolean(),
|
|
22
23
|
});
|
|
24
|
+
// Обе величины — деньги: `minSubtotal` сравнивается с суммой заказа, `cost` попадает в
|
|
25
|
+
// `order.delivery_cost`. Живут они внутри JSON-колонки, куда ALTER TABLE не достаёт, поэтому
|
|
26
|
+
// точность здесь держит не тип колонки, а формат значения — та же десятичная строка, что и на проводе.
|
|
23
27
|
exports.DeliveryPricingTierSchema = zod_1.z.object({
|
|
24
|
-
minSubtotal:
|
|
25
|
-
cost:
|
|
28
|
+
minSubtotal: non_negative_money_schema_1.NonNegativeMoneySchema,
|
|
29
|
+
cost: non_negative_money_schema_1.NonNegativeMoneySchema,
|
|
26
30
|
});
|
|
27
31
|
exports.SettingsSchema = zod_1.z.object({
|
|
28
32
|
uuid: zod_1.z.string(),
|
|
@@ -6,10 +6,11 @@ const enum_1 = require("../../enum");
|
|
|
6
6
|
const money_account_schema_1 = require("../money-account/money-account.schema");
|
|
7
7
|
const client_1 = require("../client");
|
|
8
8
|
const order_schema_1 = require("../order/order.schema");
|
|
9
|
+
const money_schema_1 = require("../money.schema");
|
|
9
10
|
exports.TransactionSchema = zod_1.z.object({
|
|
10
11
|
uuid: zod_1.z.uuid(),
|
|
11
12
|
moneyAccountUUID: zod_1.z.uuid(),
|
|
12
|
-
amount:
|
|
13
|
+
amount: money_schema_1.MoneySchema,
|
|
13
14
|
comment: zod_1.z.string(),
|
|
14
15
|
clientUUID: zod_1.z.string().nullable(),
|
|
15
16
|
orderUUID: zod_1.z.string().nullable(),
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { MoneySchema } from '../../schemas/money.schema';
|
|
2
3
|
|
|
3
4
|
const GetClientCalculateResponseSchema = z.object({
|
|
4
5
|
message: z.string().optional(),
|
|
5
6
|
data: z.object({
|
|
6
|
-
transactionSum:
|
|
7
|
-
ordersSum:
|
|
8
|
-
writeOffSum:
|
|
9
|
-
|
|
7
|
+
transactionSum: MoneySchema,
|
|
8
|
+
ordersSum: MoneySchema,
|
|
9
|
+
writeOffSum: MoneySchema,
|
|
10
|
+
// Сальдо по клиенту: может быть отрицательным, поэтому знаковых ограничений нет.
|
|
11
|
+
calculation: MoneySchema,
|
|
10
12
|
}),
|
|
11
13
|
});
|
|
12
14
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ErrorMessageSchema } from '../../schemas/error-message.schema';
|
|
3
|
+
import { MoneySchema } from '../../schemas/money.schema';
|
|
3
4
|
|
|
4
5
|
const OptionUpdateSchema = z.object({
|
|
5
6
|
title: z.string().nullable().optional(),
|
|
6
7
|
optionMultiplicity: z.number().nullable().optional(),
|
|
7
|
-
optionPrice:
|
|
8
|
+
optionPrice: MoneySchema.nullable().optional(),
|
|
8
9
|
});
|
|
9
10
|
|
|
10
11
|
const ConsignmentProductPositionUpdateSchema = z.object({
|
|
@@ -12,9 +13,9 @@ const ConsignmentProductPositionUpdateSchema = z.object({
|
|
|
12
13
|
multiplicity: z.number().nullable().optional(),
|
|
13
14
|
quantity: z.number().nullable().optional(),
|
|
14
15
|
balance: z.number().nullable().optional(),
|
|
15
|
-
price:
|
|
16
|
-
costPrice:
|
|
17
|
-
invoicePrice:
|
|
16
|
+
price: MoneySchema.nullable().optional(),
|
|
17
|
+
costPrice: MoneySchema.nullable().optional(),
|
|
18
|
+
invoicePrice: MoneySchema.nullable().optional(),
|
|
18
19
|
invoiceNumber: z.string().nullable().optional(),
|
|
19
20
|
multiplicityDescription: z.string().nullable().optional(),
|
|
20
21
|
vat: z.number().nullable().optional(),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { SalesUnitEnum } from '../../../enum';
|
|
3
|
+
import { MoneySchema } from '../../../schemas/money.schema';
|
|
3
4
|
|
|
4
5
|
const ExecutableItemSchema = z.object({
|
|
5
6
|
externalSourceId: z.string(),
|
|
@@ -11,8 +12,8 @@ const ExecutableItemSchema = z.object({
|
|
|
11
12
|
color: z.string().nullable(),
|
|
12
13
|
country: z.string().nullable(),
|
|
13
14
|
grower: z.string().nullable(),
|
|
14
|
-
price:
|
|
15
|
-
costPrice:
|
|
15
|
+
price: MoneySchema,
|
|
16
|
+
costPrice: MoneySchema,
|
|
16
17
|
balance: z.number(),
|
|
17
18
|
vat: z.number().nullable(),
|
|
18
19
|
salesUnit: z.nativeEnum(SalesUnitEnum),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { MoneySchema } from '../../../schemas/money.schema';
|
|
2
3
|
|
|
3
4
|
const PreviewMoyskladProductsRequestSchema = z.object({
|
|
4
5
|
limit: z.coerce.number().int().min(1).max(100).default(20),
|
|
@@ -13,8 +14,8 @@ const MappedProductPreviewSchema = z.object({
|
|
|
13
14
|
color: z.string().nullable(),
|
|
14
15
|
country: z.string().nullable(),
|
|
15
16
|
grower: z.string().nullable(),
|
|
16
|
-
price:
|
|
17
|
-
costPrice:
|
|
17
|
+
price: MoneySchema,
|
|
18
|
+
costPrice: MoneySchema,
|
|
18
19
|
balance: z.number(),
|
|
19
20
|
categoryName: z.string().nullable(),
|
|
20
21
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { SalesUnitEnum } from '../../../enum';
|
|
3
|
+
import { MoneySchema } from '../../../schemas/money.schema';
|
|
3
4
|
|
|
4
5
|
const ScannedItemSchema = z.object({
|
|
5
6
|
externalSourceId: z.string(),
|
|
@@ -13,8 +14,8 @@ const ScannedItemSchema = z.object({
|
|
|
13
14
|
color: z.string().nullable(),
|
|
14
15
|
country: z.string().nullable(),
|
|
15
16
|
grower: z.string().nullable(),
|
|
16
|
-
price:
|
|
17
|
-
costPrice:
|
|
17
|
+
price: MoneySchema,
|
|
18
|
+
costPrice: MoneySchema,
|
|
18
19
|
balance: z.number(),
|
|
19
20
|
categoryName: z.string().nullable(),
|
|
20
21
|
vat: z.number().nullable(),
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { OrderTypeEnum } from '../../enum';
|
|
3
3
|
import { OrderDeliverySchema, OrderSchema } from '../../schemas';
|
|
4
|
+
import { MoneySchema } from '../../schemas/money.schema';
|
|
4
5
|
|
|
5
6
|
const CreateOrderRequestSchema = z.object({
|
|
6
7
|
clientUUID: z.uuid(),
|
|
7
8
|
branchUUID: z.uuid().nullable(),
|
|
8
|
-
deliveryCost:
|
|
9
|
+
deliveryCost: MoneySchema,
|
|
9
10
|
deliveryVat: z.number().nullable(),
|
|
10
11
|
type: z.nativeEnum(OrderTypeEnum),
|
|
11
12
|
comment: z.string().nullable(),
|