@floristcloud/api-lib 1.2.109 → 1.2.110
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/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/multiplicity-option/create-pre-order-collection-item-multiplicity-option.command.ts +3 -1
- package/commands/pre-order-collection-item/multiplicity-option/update-pre-order-collection-item-multiplicity-option.command.ts +3 -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 +3 -1
- package/commands/product/multiplicity-option/update-product-multiplicity-option.command.ts +3 -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
|
@@ -4,6 +4,7 @@ exports.GetSalesSummaryContractQuery = void 0;
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const date_helper_1 = require("../../helpers/date.helper");
|
|
6
6
|
const report_period_type_enum_1 = require("../../enum/report-period-type.enum");
|
|
7
|
+
const money_schema_1 = require("../../schemas/money.schema");
|
|
7
8
|
const report_order_filter_schema_1 = require("../../schemas/report/report-order-filter.schema");
|
|
8
9
|
const GetSalesSummaryRequestSchema = zod_1.z
|
|
9
10
|
.object({
|
|
@@ -25,26 +26,27 @@ const GetSalesSummaryRequestSchema = zod_1.z
|
|
|
25
26
|
path: ['endDate', 'startDate'],
|
|
26
27
|
});
|
|
27
28
|
const SalesSummaryTotalsSchema = zod_1.z.object({
|
|
28
|
-
totalRevenue:
|
|
29
|
-
totalRevenueWithDelivery:
|
|
29
|
+
totalRevenue: money_schema_1.MoneySchema,
|
|
30
|
+
totalRevenueWithDelivery: money_schema_1.MoneySchema,
|
|
30
31
|
totalOrders: zod_1.z.number(),
|
|
31
32
|
uniqueClients: zod_1.z.number(),
|
|
32
33
|
soldUnits: zod_1.z.number(),
|
|
33
|
-
avgCheck:
|
|
34
|
-
totalVatAmount:
|
|
35
|
-
totalCost:
|
|
36
|
-
totalDeliveryCost:
|
|
37
|
-
totalServiceAmount:
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
avgCheck: money_schema_1.MoneySchema,
|
|
35
|
+
totalVatAmount: money_schema_1.MoneySchema,
|
|
36
|
+
totalCost: money_schema_1.MoneySchema,
|
|
37
|
+
totalDeliveryCost: money_schema_1.MoneySchema,
|
|
38
|
+
totalServiceAmount: money_schema_1.MoneySchema,
|
|
39
|
+
// Сумма скидки в деньгах (SUM(order.discount_amount)) — в отличие от процента `discountPercent`
|
|
40
|
+
totalDiscountAmount: money_schema_1.MoneySchema,
|
|
41
|
+
grossProfit: money_schema_1.MoneySchema,
|
|
40
42
|
marginality: zod_1.z.number(),
|
|
41
43
|
});
|
|
42
44
|
const SalesSummarySeriesItemSchema = zod_1.z.object({
|
|
43
45
|
period: zod_1.z.string(),
|
|
44
|
-
revenue:
|
|
46
|
+
revenue: money_schema_1.MoneySchema,
|
|
45
47
|
orders: zod_1.z.number(),
|
|
46
48
|
units: zod_1.z.number(),
|
|
47
|
-
avgCheck:
|
|
49
|
+
avgCheck: money_schema_1.MoneySchema,
|
|
48
50
|
});
|
|
49
51
|
const GetSalesSummaryResponseSchema = zod_1.z.object({
|
|
50
52
|
data: zod_1.z.object({
|
|
@@ -3,9 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.GenerateCheckTransactionContractCommand = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const schemas_1 = require("../../schemas");
|
|
6
|
+
const money_schema_1 = require("../../schemas/money.schema");
|
|
6
7
|
const GenerateCheckTransactionRequestSchema = zod_1.z.object({
|
|
7
8
|
orderUUID: zod_1.z.string(),
|
|
8
|
-
amount:
|
|
9
|
+
amount: money_schema_1.MoneySchema,
|
|
9
10
|
});
|
|
10
11
|
const GenerateCheckTransactionResponseSchema = zod_1.z.object({
|
|
11
12
|
message: zod_1.z.string().optional(),
|
|
@@ -3,9 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.GeneratePrepaymentCheckContractCommand = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const schemas_1 = require("../../schemas");
|
|
6
|
+
const money_schema_1 = require("../../schemas/money.schema");
|
|
6
7
|
const GeneratePrepaymentCheckRequestSchema = zod_1.z.object({
|
|
7
8
|
clientUUID: zod_1.z.string(),
|
|
8
|
-
amount:
|
|
9
|
+
amount: money_schema_1.MoneySchema,
|
|
9
10
|
});
|
|
10
11
|
const GeneratePrepaymentCheckResponseSchema = zod_1.z.object({
|
|
11
12
|
message: zod_1.z.string().optional(),
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.GetSumTransactionByMoneyAccountContractQuery = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const date_helper_1 = require("../../helpers/date.helper");
|
|
6
|
+
const money_schema_1 = require("../../schemas/money.schema");
|
|
6
7
|
const GetSumTransactionByMoneyAccountRequestSchema = zod_1.z
|
|
7
8
|
.object({
|
|
8
9
|
startDate: zod_1.z.coerce.date().optional(),
|
|
@@ -22,7 +23,8 @@ const GetSumTransactionByMoneyAccountRequestSchema = zod_1.z
|
|
|
22
23
|
const GetSumTransactionByMoneyAccountResponseSchema = zod_1.z.object({
|
|
23
24
|
message: zod_1.z.string().optional(),
|
|
24
25
|
data: zod_1.z.object({
|
|
25
|
-
|
|
26
|
+
// Сальдо по кассе: расход может превысить приход, поэтому знаковых ограничений нет.
|
|
27
|
+
sum: money_schema_1.MoneySchema,
|
|
26
28
|
}),
|
|
27
29
|
});
|
|
28
30
|
var GetSumTransactionByMoneyAccountContractQuery;
|
|
@@ -4,6 +4,7 @@ exports.GetTransactionSummaryContractQuery = void 0;
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const date_helper_1 = require("../../helpers/date.helper");
|
|
6
6
|
const enum_1 = require("../../enum");
|
|
7
|
+
const money_schema_1 = require("../../schemas/money.schema");
|
|
7
8
|
const GetTransactionSummaryRequestSchema = zod_1.z
|
|
8
9
|
.object({
|
|
9
10
|
startDate: zod_1.z.coerce.date().optional(),
|
|
@@ -28,9 +29,10 @@ const GetTransactionSummaryRequestSchema = zod_1.z
|
|
|
28
29
|
const GetTransactionSummaryResponseSchema = zod_1.z.object({
|
|
29
30
|
message: zod_1.z.string().optional(),
|
|
30
31
|
data: zod_1.z.object({
|
|
31
|
-
income:
|
|
32
|
-
expense:
|
|
33
|
-
|
|
32
|
+
income: money_schema_1.MoneySchema,
|
|
33
|
+
expense: money_schema_1.MoneySchema,
|
|
34
|
+
// Разница income − expense: минус здесь легитимен, поэтому знаковых ограничений нет.
|
|
35
|
+
total: money_schema_1.MoneySchema,
|
|
34
36
|
}),
|
|
35
37
|
});
|
|
36
38
|
var GetTransactionSummaryContractQuery;
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GetWriteOffSumByOrderContractQuery = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const non_negative_money_schema_1 = require("../../schemas/non-negative-money.schema");
|
|
5
6
|
const GetWriteOffSumByOrderRequestSchema = zod_1.z.object({});
|
|
6
7
|
const GetWriteOffSumByOrderResponseSchema = zod_1.z.object({
|
|
7
8
|
message: zod_1.z.string().optional(),
|
|
8
|
-
|
|
9
|
+
// Сумма списаний (количество × цена позиции) — деньги, отрицательной быть не может.
|
|
10
|
+
data: non_negative_money_schema_1.NonNegativeMoneySchema,
|
|
9
11
|
});
|
|
10
12
|
var GetWriteOffSumByOrderContractQuery;
|
|
11
13
|
(function (GetWriteOffSumByOrderContractQuery) {
|
|
@@ -3,9 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.UpdateWriteOffPriceContractCommand = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const schemas_1 = require("../../schemas");
|
|
6
|
+
const money_schema_1 = require("../../schemas/money.schema");
|
|
6
7
|
const UpdateWriteOffPriceRequestSchema = zod_1.z.object({
|
|
7
8
|
quantity: zod_1.z.coerce.number(),
|
|
8
|
-
price:
|
|
9
|
+
price: money_schema_1.MoneySchema,
|
|
9
10
|
});
|
|
10
11
|
const UpdateWriteOffPriceResponseSchema = zod_1.z.object({
|
|
11
12
|
message: zod_1.z.string().optional(),
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActionLogMoneySchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const money_schema_1 = require("../money.schema");
|
|
6
|
+
/**
|
|
7
|
+
* Денежная величина внутри записи журнала аудита.
|
|
8
|
+
*
|
|
9
|
+
* Отличается от обычного `MoneySchema` тем, что принимает ОБА формата: и десятичную строку,
|
|
10
|
+
* которой деньги пишутся сейчас, и JSON-число, которым они писались раньше.
|
|
11
|
+
*
|
|
12
|
+
* Причина в природе самих данных. `action_log.payload` — это неизменяемый журнал: он фиксирует,
|
|
13
|
+
* что произошло, в том виде, в каком это выглядело на момент события. На проде в нём 265 402
|
|
14
|
+
* записи с деньгами-числами, разложенными по шести разным формам payload'а на разной глубине
|
|
15
|
+
* вложенности. Переписать их миграцией мешает и объём, и то, что `jsonb_set` требует конкретный
|
|
16
|
+
* путь: рекурсивно искать `jsonb_path_exists` умеет, а записывать — нет. Любая форма, не учтённая
|
|
17
|
+
* в такой миграции, осталась бы непочиненной и роняла бы чтение.
|
|
18
|
+
*
|
|
19
|
+
* Но главное — переписывать историю аудита под новую схему неправильно по существу, даже когда
|
|
20
|
+
* переписывание чисто техническое.
|
|
21
|
+
*
|
|
22
|
+
* Поэтому снисходительность живёт здесь и только здесь. Во всех остальных местах, включая JSON-поля
|
|
23
|
+
* `settings.delivery_pricing_tiers` и `discount_rules.data`, деньги мигрированы в строки, и там
|
|
24
|
+
* используется строгий `MoneySchema`.
|
|
25
|
+
*
|
|
26
|
+
* Новые записи журнала уже пишутся строками: `Decimal.toJSON()` возвращает строку.
|
|
27
|
+
*/
|
|
28
|
+
exports.ActionLogMoneySchema = zod_1.z.union([money_schema_1.MoneySchema, zod_1.z.number().transform(value => value.toFixed(2))]);
|
|
@@ -37,3 +37,4 @@ __exportStar(require("./consignment-items-create-action-log.schema"), exports);
|
|
|
37
37
|
__exportStar(require("./consignment-items-delete-action-log.schema"), exports);
|
|
38
38
|
__exportStar(require("./group-update-consignment-items-action-log.schema"), exports);
|
|
39
39
|
__exportStar(require("./transfer-consignment-items-action-log.schema"), exports);
|
|
40
|
+
__exportStar(require("./action-log-money.schema"), exports);
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OrderInfoSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const action_log_money_schema_1 = require("./action-log-money.schema");
|
|
5
6
|
exports.OrderInfoSchema = zod_1.z.object({
|
|
6
7
|
orderUUID: zod_1.z.string(),
|
|
7
8
|
orderId: zod_1.z.coerce.number(),
|
|
8
9
|
clientUUID: zod_1.z.string(),
|
|
9
10
|
clientName: zod_1.z.string(),
|
|
10
11
|
createdAt: zod_1.z.coerce.date(),
|
|
11
|
-
totalCost:
|
|
12
|
+
totalCost: action_log_money_schema_1.ActionLogMoneySchema,
|
|
12
13
|
deliveryAddress: zod_1.z.string().nullable().optional(),
|
|
13
|
-
deliveryCost:
|
|
14
|
+
deliveryCost: action_log_money_schema_1.ActionLogMoneySchema.nullable().optional(),
|
|
14
15
|
});
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OrderProductInfoSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const action_log_money_schema_1 = require("./action-log-money.schema");
|
|
5
6
|
exports.OrderProductInfoSchema = zod_1.z.object({
|
|
6
7
|
orderUUID: zod_1.z.string(),
|
|
7
8
|
orderProductUUID: zod_1.z.string(),
|
|
@@ -10,7 +11,7 @@ exports.OrderProductInfoSchema = zod_1.z.object({
|
|
|
10
11
|
categoryUUID: zod_1.z.string().nullable(),
|
|
11
12
|
categoryName: zod_1.z.string().nullable(),
|
|
12
13
|
quantity: zod_1.z.coerce.number(),
|
|
13
|
-
price:
|
|
14
|
+
price: action_log_money_schema_1.ActionLogMoneySchema,
|
|
14
15
|
consignmentUUID: zod_1.z.string().nullable(),
|
|
15
16
|
consignmentDeliveryDate: zod_1.z.coerce.date().nullable(),
|
|
16
17
|
});
|
|
@@ -3,8 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.OrderProductUpdateActionLogSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const order_product_info_schema_1 = require("./order-product-info.schema");
|
|
6
|
+
const action_log_money_schema_1 = require("./action-log-money.schema");
|
|
6
7
|
exports.OrderProductUpdateActionLogSchema = zod_1.z.object({
|
|
7
8
|
orderProduct: order_product_info_schema_1.OrderProductInfoSchema,
|
|
8
9
|
newQuantity: zod_1.z.coerce.number(),
|
|
9
|
-
newPrice:
|
|
10
|
+
newPrice: action_log_money_schema_1.ActionLogMoneySchema,
|
|
10
11
|
});
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PreOrderProductInfoSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const action_log_money_schema_1 = require("./action-log-money.schema");
|
|
5
6
|
exports.PreOrderProductInfoSchema = zod_1.z.object({
|
|
6
7
|
preOrderUUID: zod_1.z.string(),
|
|
7
8
|
preOrderProductUUID: zod_1.z.string(),
|
|
8
9
|
name: zod_1.z.string(),
|
|
9
10
|
categoryName: zod_1.z.string().nullable(),
|
|
10
11
|
quantity: zod_1.z.coerce.number(),
|
|
11
|
-
price:
|
|
12
|
+
price: action_log_money_schema_1.ActionLogMoneySchema,
|
|
12
13
|
comment: zod_1.z.string().nullable(),
|
|
13
14
|
});
|
|
@@ -3,9 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PreOrderProductUpdateActionLogSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const pre_order_product_info_schema_1 = require("./pre-order-product-info.schema");
|
|
6
|
+
const action_log_money_schema_1 = require("./action-log-money.schema");
|
|
6
7
|
exports.PreOrderProductUpdateActionLogSchema = zod_1.z.object({
|
|
7
8
|
preOrderProduct: pre_order_product_info_schema_1.PreOrderProductInfoSchema,
|
|
8
9
|
newQuantity: zod_1.z.coerce.number(),
|
|
9
|
-
newPrice:
|
|
10
|
+
newPrice: action_log_money_schema_1.ActionLogMoneySchema,
|
|
10
11
|
newComment: zod_1.z.string().nullable(),
|
|
11
12
|
});
|
|
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TransactionInfoSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const enum_1 = require("../../enum");
|
|
6
|
+
const action_log_money_schema_1 = require("./action-log-money.schema");
|
|
6
7
|
exports.TransactionInfoSchema = zod_1.z.object({
|
|
7
8
|
transactionUUID: zod_1.z.string(),
|
|
8
9
|
createdAt: zod_1.z.coerce.date(),
|
|
9
|
-
amount:
|
|
10
|
+
amount: action_log_money_schema_1.ActionLogMoneySchema,
|
|
10
11
|
moneyAccountName: zod_1.z.string(),
|
|
11
12
|
type: zod_1.z.nativeEnum(enum_1.TransactionTypeEnum),
|
|
12
13
|
clientName: zod_1.z.string().nullable(),
|
|
@@ -4,12 +4,13 @@ exports.BankPaymentSchema = void 0;
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const bank_provider_enum_1 = require("../../enum/bank-provider.enum");
|
|
6
6
|
const bank_payment_event_status_enum_1 = require("../../enum/bank-payment-event-status.enum");
|
|
7
|
+
const money_schema_1 = require("../money.schema");
|
|
7
8
|
exports.BankPaymentSchema = zod_1.z.object({
|
|
8
9
|
uuid: zod_1.z.uuid(),
|
|
9
10
|
provider: zod_1.z.nativeEnum(bank_provider_enum_1.BankProviderEnum),
|
|
10
11
|
externalEventId: zod_1.z.string(),
|
|
11
12
|
accountNumber: zod_1.z.string(),
|
|
12
|
-
amount:
|
|
13
|
+
amount: money_schema_1.MoneySchema,
|
|
13
14
|
currency: zod_1.z.string(),
|
|
14
15
|
purpose: zod_1.z.string(),
|
|
15
16
|
status: zod_1.z.nativeEnum(bank_payment_event_status_enum_1.BankPaymentEventStatusEnum),
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ClientDebtListSchema = exports.ClientDebtItemSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const money_schema_1 = require("../money.schema");
|
|
5
6
|
exports.ClientDebtItemSchema = zod_1.z.object({
|
|
6
7
|
clientUUID: zod_1.z.uuid(),
|
|
7
8
|
name: zod_1.z.string(),
|
|
@@ -9,11 +10,13 @@ exports.ClientDebtItemSchema = zod_1.z.object({
|
|
|
9
10
|
group: zod_1.z.string().nullable(),
|
|
10
11
|
city: zod_1.z.string().nullable(),
|
|
11
12
|
responsibleUserName: zod_1.z.string().nullable(),
|
|
12
|
-
currentBalance:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
currentBalance: money_schema_1.MoneySchema,
|
|
14
|
+
// Знаковые величины: сальдо транзакций и остатки по заказам законно уходят в минус
|
|
15
|
+
// (переплата клиента, возврат), поэтому ограничения на знак здесь нет и быть не должно.
|
|
16
|
+
transactionNet: money_schema_1.MoneySchema,
|
|
17
|
+
completedOrdersBalance: money_schema_1.MoneySchema,
|
|
18
|
+
completedOrdersBalanceWithDelay: money_schema_1.MoneySchema,
|
|
19
|
+
nonCompletedBalance: money_schema_1.MoneySchema,
|
|
17
20
|
hasOverdueDebt: zod_1.z.boolean().nullable(),
|
|
18
21
|
});
|
|
19
22
|
exports.ClientDebtListSchema = zod_1.z.object({
|
|
@@ -10,6 +10,7 @@ const client_individual_profile_schema_1 = require("./client-individual-profile.
|
|
|
10
10
|
const client_legal_profile_schema_1 = require("./client-legal-profile.schema");
|
|
11
11
|
const discount_rules_schema_1 = require("../discount-rules/discount-rules.schema");
|
|
12
12
|
const client_marking_schema_1 = require("./client-marking.schema");
|
|
13
|
+
const money_schema_1 = require("../money.schema");
|
|
13
14
|
exports.ClientSchema = zod_1.z.object({
|
|
14
15
|
uuid: zod_1.z.uuid(),
|
|
15
16
|
name: zod_1.z.string(),
|
|
@@ -30,7 +31,7 @@ exports.ClientSchema = zod_1.z.object({
|
|
|
30
31
|
additionalPhone: zod_1.z.string().nullable(),
|
|
31
32
|
comment: zod_1.z.string().nullable(),
|
|
32
33
|
paymentGraceDaysAfterCompletion: zod_1.z.number().nullable(),
|
|
33
|
-
balance:
|
|
34
|
+
balance: money_schema_1.MoneySchema,
|
|
34
35
|
deletedAt: zod_1.z.date().nullable(),
|
|
35
36
|
createdAt: zod_1.z.date(),
|
|
36
37
|
updatedAt: zod_1.z.date(),
|
|
@@ -4,6 +4,7 @@ exports.ConsignmentWithClientsAccessSchema = exports.DataNotExistsSchema = expor
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const enum_1 = require("../../enum");
|
|
6
6
|
const client_1 = require("../client");
|
|
7
|
+
const money_schema_1 = require("../money.schema");
|
|
7
8
|
exports.ConsignmentSchema = zod_1.z.object({
|
|
8
9
|
uuid: zod_1.z.uuid(),
|
|
9
10
|
deliveryDate: zod_1.z.date(),
|
|
@@ -21,24 +22,24 @@ exports.ConsignmentSchema = zod_1.z.object({
|
|
|
21
22
|
});
|
|
22
23
|
exports.ConsignmentWithStatisticForListSchema = exports.ConsignmentSchema.extend({
|
|
23
24
|
statistic: zod_1.z.object({
|
|
24
|
-
totalCostPrice:
|
|
25
|
+
totalCostPrice: money_schema_1.MoneySchema,
|
|
25
26
|
currentProductBalance: zod_1.z.number(),
|
|
26
|
-
currentCostPrice:
|
|
27
|
+
currentCostPrice: money_schema_1.MoneySchema,
|
|
27
28
|
totalProductQuantity: zod_1.z.number(),
|
|
28
|
-
totalSellings:
|
|
29
|
-
totalApprovedWriteOffSellings:
|
|
29
|
+
totalSellings: money_schema_1.MoneySchema,
|
|
30
|
+
totalApprovedWriteOffSellings: money_schema_1.MoneySchema,
|
|
30
31
|
}),
|
|
31
32
|
});
|
|
32
33
|
exports.ConsignmentWithStatisticSchema = exports.ConsignmentSchema.extend({
|
|
33
34
|
statistic: zod_1.z.object({
|
|
34
|
-
totalCostPrice:
|
|
35
|
+
totalCostPrice: money_schema_1.MoneySchema,
|
|
35
36
|
currentProductBalance: zod_1.z.number(),
|
|
36
|
-
currentCostPrice:
|
|
37
|
+
currentCostPrice: money_schema_1.MoneySchema,
|
|
37
38
|
totalProductQuantity: zod_1.z.number(),
|
|
38
|
-
totalSellings:
|
|
39
|
+
totalSellings: money_schema_1.MoneySchema,
|
|
39
40
|
writeOffQuantity: zod_1.z.number(),
|
|
40
|
-
writeOffCostPrice:
|
|
41
|
-
writeOffCostPriceByOrderProduct:
|
|
41
|
+
writeOffCostPrice: money_schema_1.MoneySchema,
|
|
42
|
+
writeOffCostPriceByOrderProduct: money_schema_1.MoneySchema,
|
|
42
43
|
}),
|
|
43
44
|
});
|
|
44
45
|
exports.ProductErrorTypeSchema = zod_1.z.object({
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AcceptConsignmentTransferResponseSchema = exports.AcceptConsignmentTransferRequestSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const consignment_transfer_request_schema_1 = require("./consignment-transfer-request.schema");
|
|
6
|
+
const non_negative_money_schema_1 = require("../non-negative-money.schema");
|
|
6
7
|
exports.AcceptConsignmentTransferRequestSchema = zod_1.z
|
|
7
8
|
.object({
|
|
8
9
|
// Accept into an existing consignment of the receiver OR create a new one — exactly one of the two.
|
|
@@ -18,7 +19,8 @@ exports.AcceptConsignmentTransferRequestSchema = zod_1.z
|
|
|
18
19
|
.array(zod_1.z.object({
|
|
19
20
|
itemUUID: zod_1.z.uuid(),
|
|
20
21
|
categoryUUID: zod_1.z.uuid(),
|
|
21
|
-
|
|
22
|
+
// Отрицательную цену отсекаем по знаку строки — минус и есть признак отрицательности.
|
|
23
|
+
price: non_negative_money_schema_1.NonNegativeMoneySchema.optional(),
|
|
22
24
|
}))
|
|
23
25
|
.min(1),
|
|
24
26
|
})
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ConsignmentTransferRequestItemSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const money_schema_1 = require("../money.schema");
|
|
5
6
|
exports.ConsignmentTransferRequestItemSchema = zod_1.z.object({
|
|
6
7
|
uuid: zod_1.z.uuid(),
|
|
7
8
|
sourceProductUUID: zod_1.z.uuid(),
|
|
8
9
|
targetProductUUID: zod_1.z.uuid().nullable(),
|
|
9
10
|
name: zod_1.z.string(),
|
|
10
11
|
quantity: zod_1.z.number().int(),
|
|
11
|
-
transferPrice:
|
|
12
|
+
transferPrice: money_schema_1.MoneySchema,
|
|
12
13
|
categoryName: zod_1.z.string().nullable(),
|
|
13
14
|
multiplicity: zod_1.z.number().int(),
|
|
14
15
|
grower: zod_1.z.string().nullable(),
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DeliveryRouteWithOrdersSchema = exports.UpdateDeliveryRouteSchema = exports.CreateDeliveryRouteSchema = exports.DeliveryRouteSchema = 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.DeliveryRouteSchema = zod_1.z.object({
|
|
7
8
|
uuid: zod_1.z.uuid(),
|
|
8
9
|
routeName: zod_1.z.string().nullable(),
|
|
@@ -32,7 +33,7 @@ exports.DeliveryRouteWithOrdersSchema = exports.DeliveryRouteSchema.extend({
|
|
|
32
33
|
orderNumber: zod_1.z.number(),
|
|
33
34
|
orderStatus: zod_1.z.nativeEnum(enum_1.OrderStatusEnum),
|
|
34
35
|
orderCreatedAt: zod_1.z.coerce.date(),
|
|
35
|
-
totalCost:
|
|
36
|
+
totalCost: money_schema_1.MoneySchema,
|
|
36
37
|
clientName: zod_1.z.string(),
|
|
37
38
|
clientCity: zod_1.z.string().nullable(),
|
|
38
39
|
clientAddress: zod_1.z.string().nullable(),
|
|
@@ -5,9 +5,16 @@ const zod_1 = require("zod");
|
|
|
5
5
|
const enum_1 = require("../../enum");
|
|
6
6
|
const client_1 = require("../client");
|
|
7
7
|
const product_schema_1 = require("../product/product.schema");
|
|
8
|
+
const money_schema_1 = require("../money.schema");
|
|
9
|
+
const positive_money_schema_1 = require("../positive-money.schema");
|
|
10
|
+
// PERCENT — это процент, а не деньги: остаётся числом 0..100. FIXED — денежная величина, едет строкой.
|
|
8
11
|
exports.discountRulesModeSchema = zod_1.z.discriminatedUnion('typeDiscount', [
|
|
9
12
|
zod_1.z.object({ typeDiscount: zod_1.z.literal(enum_1.DiscountRulesModeTypeEnum.PERCENT), discountValue: zod_1.z.number().min(0).max(100) }),
|
|
10
|
-
zod_1.z.object({
|
|
13
|
+
zod_1.z.object({
|
|
14
|
+
typeDiscount: zod_1.z.literal(enum_1.DiscountRulesModeTypeEnum.FIXED),
|
|
15
|
+
// Строго положительная сумма: минус отсекаем по знаку строки, нули вида "0" / "0.00" — сравнением.
|
|
16
|
+
discountValue: positive_money_schema_1.PositiveMoneySchema,
|
|
17
|
+
}),
|
|
11
18
|
]);
|
|
12
19
|
// Rules schemas other data
|
|
13
20
|
const DiscountRulesPersonalDiscountDataSchema = zod_1.z.object({
|
|
@@ -99,7 +106,7 @@ exports.DiscountRulesSplitQuantityResponseSchema = zod_1.z.object({
|
|
|
99
106
|
productUUID: zod_1.z.string(),
|
|
100
107
|
quantity: zod_1.z.number(),
|
|
101
108
|
withDiscount: zod_1.z.boolean(),
|
|
102
|
-
price:
|
|
109
|
+
price: money_schema_1.MoneySchema,
|
|
103
110
|
})
|
|
104
111
|
.array()
|
|
105
112
|
.nullable(),
|
package/build/schemas/index.js
CHANGED
|
@@ -93,4 +93,7 @@ __exportStar(require("./account-deletion-request/account-deletion-request.schema
|
|
|
93
93
|
__exportStar(require("./consignment-transfer"), exports);
|
|
94
94
|
__exportStar(require("./api-error.schema"), exports);
|
|
95
95
|
__exportStar(require("./access-policy"), exports);
|
|
96
|
+
__exportStar(require("./money.schema"), exports);
|
|
97
|
+
__exportStar(require("./non-negative-money.schema"), exports);
|
|
98
|
+
__exportStar(require("./positive-money.schema"), exports);
|
|
96
99
|
__exportStar(require("./report/report-order-filter.schema"), exports);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MoneyAccountWithBalanceSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
4
|
const money_account_schema_1 = require("./money-account.schema");
|
|
5
|
+
const money_schema_1 = require("../money.schema");
|
|
6
6
|
/**
|
|
7
7
|
* Денежный счёт в ответах списков. `balance` — текущий остаток счёта (приход минус расход),
|
|
8
8
|
* приходит только при `?withBalance=true`: поле аддитивное, клиенты без этого параметра
|
|
9
9
|
* получают ровно прежнюю форму ответа.
|
|
10
10
|
*/
|
|
11
11
|
exports.MoneyAccountWithBalanceSchema = money_account_schema_1.MoneyAccountSchema.extend({
|
|
12
|
-
balance:
|
|
12
|
+
balance: money_schema_1.MoneySchema.optional(),
|
|
13
13
|
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MoneySchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
/**
|
|
6
|
+
* Единственное описание денежной величины в контрактах.
|
|
7
|
+
*
|
|
8
|
+
* Деньги пересекают границу строкой — точным десятичным представлением, а не float64.
|
|
9
|
+
* `"8755.48"` доезжает до получателя ровно таким, каким его отправили: ни JSON.parse, ни
|
|
10
|
+
* арифметика на `number` больше не участвуют в передаче, поэтому двоичный мусор вида
|
|
11
|
+
* `8755.479000000001` физически неоткуда взяться. Каждая сторона разбирает строку своей
|
|
12
|
+
* реализацией Decimal: сервер — Prisma.Decimal, клиент — своей библиотекой.
|
|
13
|
+
*
|
|
14
|
+
* В `libs/contracts` намеренно НЕТ зависимости от decimal-библиотеки: пакет публикуется как
|
|
15
|
+
* `@floristcloud/api-lib` и ставится в браузерные бандлы, где лишняя зависимость — это лишние
|
|
16
|
+
* килобайты и риск конфликта версий с той Decimal-реализацией, которую уже выбрал клиент.
|
|
17
|
+
* Контракт описывает формат провода, а не арифметику.
|
|
18
|
+
*
|
|
19
|
+
* Формат: необязательный минус, целая часть, до двух знаков после точки. Знак минуса —
|
|
20
|
+
* единственный признак отрицательной величины.
|
|
21
|
+
*
|
|
22
|
+
* Сама по себе схема знак не ограничивает: разницы, сальдо и балансы клиентов законно уходят
|
|
23
|
+
* в минус. Там, где величина не может быть отрицательной или нулевой, берите готовые
|
|
24
|
+
* `NonNegativeMoneySchema` и `PositiveMoneySchema` — не повторяйте `refine` по месту.
|
|
25
|
+
* Модификаторы `.optional()` и `.nullable()` работают напрямую.
|
|
26
|
+
*/
|
|
27
|
+
exports.MoneySchema = zod_1.z.string().regex(/^-?\d+(\.\d{1,2})?$/);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NonNegativeMoneySchema = void 0;
|
|
4
|
+
const money_schema_1 = require("./money.schema");
|
|
5
|
+
/**
|
|
6
|
+
* Денежная величина, которая не может быть отрицательной: цена, стоимость доставки, сумма позиции.
|
|
7
|
+
*
|
|
8
|
+
* На строковом формате знак проверяется по первому символу — это единственный признак
|
|
9
|
+
* отрицательности в `MoneySchema` (`^-?\d+(\.\d{1,2})?$`), поэтому приводить величину к числу ради
|
|
10
|
+
* сравнения не нужно и не следует.
|
|
11
|
+
*
|
|
12
|
+
* Разницу с [[PositiveMoneySchema]] стоит держать в голове: здесь ноль допустим (бесплатная доставка,
|
|
13
|
+
* позиция с нулевой ценой), а там — нет.
|
|
14
|
+
*/
|
|
15
|
+
exports.NonNegativeMoneySchema = money_schema_1.MoneySchema.refine(value => !value.startsWith('-'), {
|
|
16
|
+
message: 'validation.money.nonNegative',
|
|
17
|
+
});
|
|
@@ -7,20 +7,21 @@ const client_1 = require("../client");
|
|
|
7
7
|
const branch_schema_1 = require("../branch/branch.schema");
|
|
8
8
|
const order_delivery_schema_1 = require("../order-delivery/order-delivery.schema");
|
|
9
9
|
const delivery_route_schema_1 = require("../delivery-route/delivery-route.schema");
|
|
10
|
+
const money_schema_1 = require("../money.schema");
|
|
10
11
|
exports.OrderSchema = zod_1.z.object({
|
|
11
12
|
uuid: zod_1.z.uuid(),
|
|
12
13
|
orderNumber: zod_1.z.number(),
|
|
13
14
|
clientUUID: zod_1.z.uuid(),
|
|
14
15
|
branchUUID: zod_1.z.uuid().nullable(),
|
|
15
16
|
creatorUserUUID: zod_1.z.uuid(),
|
|
16
|
-
totalCost:
|
|
17
|
-
subtotal:
|
|
18
|
-
deliveryCost:
|
|
19
|
-
deliveryCheckAmount:
|
|
20
|
-
deliveryVatAmount:
|
|
17
|
+
totalCost: money_schema_1.MoneySchema,
|
|
18
|
+
subtotal: money_schema_1.MoneySchema,
|
|
19
|
+
deliveryCost: money_schema_1.MoneySchema,
|
|
20
|
+
deliveryCheckAmount: money_schema_1.MoneySchema,
|
|
21
|
+
deliveryVatAmount: money_schema_1.MoneySchema,
|
|
21
22
|
deliveryVat: zod_1.z.number().nullable(),
|
|
22
|
-
vatAmount:
|
|
23
|
-
discountAmount:
|
|
23
|
+
vatAmount: money_schema_1.MoneySchema,
|
|
24
|
+
discountAmount: money_schema_1.MoneySchema,
|
|
24
25
|
discount: zod_1.z.number().nullable(),
|
|
25
26
|
status: zod_1.z.nativeEnum(enum_1.OrderStatusEnum),
|
|
26
27
|
type: zod_1.z.nativeEnum(enum_1.OrderTypeEnum),
|
|
@@ -61,9 +62,9 @@ exports.OrderExtendedForClientSchema = exports.OrderForClientSchema.extend({
|
|
|
61
62
|
client: client_1.ClientSchema,
|
|
62
63
|
branch: branch_schema_1.BranchSchema.nullable(),
|
|
63
64
|
delivery: order_delivery_schema_1.OrderDeliverySchema.nullable(),
|
|
64
|
-
writeOffSum:
|
|
65
|
+
writeOffSum: money_schema_1.MoneySchema.nullable(),
|
|
65
66
|
consignmentDeliveryDates: zod_1.z.union([zod_1.z.date(), zod_1.z.literal('in-stock')]).array(),
|
|
66
67
|
// Server-computed delivery cost for the current subtotal when the tier rule is on (null when off).
|
|
67
68
|
// Convenience preview for the cart page; the storefront still recomputes locally on the delivery/pickup toggle.
|
|
68
|
-
deliveryCostPreview:
|
|
69
|
+
deliveryCostPreview: money_schema_1.MoneySchema.nullable(),
|
|
69
70
|
});
|
|
@@ -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(),
|