@floristcloud/api-lib 1.2.108 → 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/export-sales-by-client.query.js +3 -0
- package/build/commands/report/export-sales-by-position.query.js +3 -0
- package/build/commands/report/export-sales-revenue.query.js +3 -0
- 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 +15 -10
- package/build/commands/report/get-report-group-by-position.query.js +15 -14
- package/build/commands/report/get-sales-by-client.query.js +3 -0
- package/build/commands/report/get-sales-summary.query.js +17 -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/constant/index.js +1 -0
- package/build/constant/report.constant.js +9 -0
- package/build/enum/index.js +1 -0
- package/build/enum/report-order-date-basis.enum.js +18 -0
- 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 +4 -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/report-order-filter.schema.js +28 -0
- 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/export-sales-by-client.query.ts +3 -0
- package/commands/report/export-sales-by-position.query.ts +3 -0
- package/commands/report/export-sales-revenue.query.ts +3 -0
- 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 +15 -10
- package/commands/report/get-report-group-by-position.query.ts +15 -14
- package/commands/report/get-sales-by-client.query.ts +3 -0
- package/commands/report/get-sales-summary.query.ts +17 -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/constant/index.ts +1 -0
- package/constant/report.constant.ts +6 -0
- package/enum/index.ts +1 -0
- package/enum/report-order-date-basis.enum.ts +14 -0
- 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 +4 -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/report-order-filter.schema.ts +26 -0
- 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,13 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GetClientCalculateContractQuery = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const money_schema_1 = require("../../schemas/money.schema");
|
|
5
6
|
const GetClientCalculateResponseSchema = zod_1.z.object({
|
|
6
7
|
message: zod_1.z.string().optional(),
|
|
7
8
|
data: zod_1.z.object({
|
|
8
|
-
transactionSum:
|
|
9
|
-
ordersSum:
|
|
10
|
-
writeOffSum:
|
|
11
|
-
|
|
9
|
+
transactionSum: money_schema_1.MoneySchema,
|
|
10
|
+
ordersSum: money_schema_1.MoneySchema,
|
|
11
|
+
writeOffSum: money_schema_1.MoneySchema,
|
|
12
|
+
// Сальдо по клиенту: может быть отрицательным, поэтому знаковых ограничений нет.
|
|
13
|
+
calculation: money_schema_1.MoneySchema,
|
|
12
14
|
}),
|
|
13
15
|
});
|
|
14
16
|
var GetClientCalculateContractQuery;
|
|
@@ -3,19 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ExecuteConsignmentProductUpdateContractCommand = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const error_message_schema_1 = require("../../schemas/error-message.schema");
|
|
6
|
+
const money_schema_1 = require("../../schemas/money.schema");
|
|
6
7
|
const OptionUpdateSchema = zod_1.z.object({
|
|
7
8
|
title: zod_1.z.string().nullable().optional(),
|
|
8
9
|
optionMultiplicity: zod_1.z.number().nullable().optional(),
|
|
9
|
-
optionPrice:
|
|
10
|
+
optionPrice: money_schema_1.MoneySchema.nullable().optional(),
|
|
10
11
|
});
|
|
11
12
|
const ConsignmentProductPositionUpdateSchema = zod_1.z.object({
|
|
12
13
|
name: zod_1.z.string().nullable().optional(),
|
|
13
14
|
multiplicity: zod_1.z.number().nullable().optional(),
|
|
14
15
|
quantity: zod_1.z.number().nullable().optional(),
|
|
15
16
|
balance: zod_1.z.number().nullable().optional(),
|
|
16
|
-
price:
|
|
17
|
-
costPrice:
|
|
18
|
-
invoicePrice:
|
|
17
|
+
price: money_schema_1.MoneySchema.nullable().optional(),
|
|
18
|
+
costPrice: money_schema_1.MoneySchema.nullable().optional(),
|
|
19
|
+
invoicePrice: money_schema_1.MoneySchema.nullable().optional(),
|
|
19
20
|
invoiceNumber: zod_1.z.string().nullable().optional(),
|
|
20
21
|
multiplicityDescription: zod_1.z.string().nullable().optional(),
|
|
21
22
|
vat: zod_1.z.number().nullable().optional(),
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ExecuteMoyskladImportContractCommand = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const enum_1 = require("../../../enum");
|
|
6
|
+
const money_schema_1 = require("../../../schemas/money.schema");
|
|
6
7
|
const ExecutableItemSchema = zod_1.z.object({
|
|
7
8
|
externalSourceId: zod_1.z.string(),
|
|
8
9
|
externalHref: zod_1.z.string(),
|
|
@@ -13,8 +14,8 @@ const ExecutableItemSchema = zod_1.z.object({
|
|
|
13
14
|
color: zod_1.z.string().nullable(),
|
|
14
15
|
country: zod_1.z.string().nullable(),
|
|
15
16
|
grower: zod_1.z.string().nullable(),
|
|
16
|
-
price:
|
|
17
|
-
costPrice:
|
|
17
|
+
price: money_schema_1.MoneySchema,
|
|
18
|
+
costPrice: money_schema_1.MoneySchema,
|
|
18
19
|
balance: zod_1.z.number(),
|
|
19
20
|
vat: zod_1.z.number().nullable(),
|
|
20
21
|
salesUnit: zod_1.z.nativeEnum(enum_1.SalesUnitEnum),
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PreviewMoyskladProductsContractQuery = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const money_schema_1 = require("../../../schemas/money.schema");
|
|
5
6
|
const PreviewMoyskladProductsRequestSchema = zod_1.z.object({
|
|
6
7
|
limit: zod_1.z.coerce.number().int().min(1).max(100).default(20),
|
|
7
8
|
});
|
|
@@ -14,8 +15,8 @@ const MappedProductPreviewSchema = zod_1.z.object({
|
|
|
14
15
|
color: zod_1.z.string().nullable(),
|
|
15
16
|
country: zod_1.z.string().nullable(),
|
|
16
17
|
grower: zod_1.z.string().nullable(),
|
|
17
|
-
price:
|
|
18
|
-
costPrice:
|
|
18
|
+
price: money_schema_1.MoneySchema,
|
|
19
|
+
costPrice: money_schema_1.MoneySchema,
|
|
19
20
|
balance: zod_1.z.number(),
|
|
20
21
|
categoryName: zod_1.z.string().nullable(),
|
|
21
22
|
});
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ScanMoyskladImportContractQuery = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const enum_1 = require("../../../enum");
|
|
6
|
+
const money_schema_1 = require("../../../schemas/money.schema");
|
|
6
7
|
const ScannedItemSchema = zod_1.z.object({
|
|
7
8
|
externalSourceId: zod_1.z.string(),
|
|
8
9
|
externalHref: zod_1.z.string(),
|
|
@@ -15,8 +16,8 @@ const ScannedItemSchema = zod_1.z.object({
|
|
|
15
16
|
color: zod_1.z.string().nullable(),
|
|
16
17
|
country: zod_1.z.string().nullable(),
|
|
17
18
|
grower: zod_1.z.string().nullable(),
|
|
18
|
-
price:
|
|
19
|
-
costPrice:
|
|
19
|
+
price: money_schema_1.MoneySchema,
|
|
20
|
+
costPrice: money_schema_1.MoneySchema,
|
|
20
21
|
balance: zod_1.z.number(),
|
|
21
22
|
categoryName: zod_1.z.string().nullable(),
|
|
22
23
|
vat: zod_1.z.number().nullable(),
|
|
@@ -4,10 +4,11 @@ exports.CreateOrderContractCommand = void 0;
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const enum_1 = require("../../enum");
|
|
6
6
|
const schemas_1 = require("../../schemas");
|
|
7
|
+
const money_schema_1 = require("../../schemas/money.schema");
|
|
7
8
|
const CreateOrderRequestSchema = zod_1.z.object({
|
|
8
9
|
clientUUID: zod_1.z.uuid(),
|
|
9
10
|
branchUUID: zod_1.z.uuid().nullable(),
|
|
10
|
-
deliveryCost:
|
|
11
|
+
deliveryCost: money_schema_1.MoneySchema,
|
|
11
12
|
deliveryVat: zod_1.z.number().nullable(),
|
|
12
13
|
type: zod_1.z.nativeEnum(enum_1.OrderTypeEnum),
|
|
13
14
|
comment: zod_1.z.string().nullable(),
|
|
@@ -4,10 +4,11 @@ exports.UpdateOrderContractCommand = void 0;
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const enum_1 = require("../../enum");
|
|
6
6
|
const schemas_1 = require("../../schemas");
|
|
7
|
+
const money_schema_1 = require("../../schemas/money.schema");
|
|
7
8
|
const UpdateOrderRequestSchema = zod_1.z.object({
|
|
8
9
|
clientUUID: zod_1.z.uuid(),
|
|
9
10
|
branchUUID: zod_1.z.uuid().nullable(),
|
|
10
|
-
deliveryCost:
|
|
11
|
+
deliveryCost: money_schema_1.MoneySchema,
|
|
11
12
|
type: zod_1.z.nativeEnum(enum_1.OrderTypeEnum),
|
|
12
13
|
comment: zod_1.z.string().nullable(),
|
|
13
14
|
clientComment: zod_1.z.string().nullable(),
|
|
@@ -15,7 +16,7 @@ const UpdateOrderRequestSchema = zod_1.z.object({
|
|
|
15
16
|
status: zod_1.z.nativeEnum(enum_1.OrderStatusEnum),
|
|
16
17
|
isPaid: zod_1.z.coerce.boolean(),
|
|
17
18
|
deliveryVat: zod_1.z.coerce.number().nullable(),
|
|
18
|
-
deliveryVatAmount:
|
|
19
|
+
deliveryVatAmount: money_schema_1.MoneySchema,
|
|
19
20
|
completedAt: zod_1.z.coerce.date().nullable().optional(),
|
|
20
21
|
paymentDueAt: zod_1.z.coerce.date().nullable().optional(),
|
|
21
22
|
});
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GetOrderSalesByMonthContractQuery = 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 GetOrderSalesByMonthRequestSchema = zod_1.z.object({
|
|
6
7
|
month: zod_1.z.coerce.number().int().min(1).max(12),
|
|
7
8
|
});
|
|
8
9
|
const GetOrderSalesByMonthResponseSchema = zod_1.z.object({
|
|
9
10
|
message: zod_1.z.string().optional(),
|
|
10
|
-
data:
|
|
11
|
+
data: non_negative_money_schema_1.NonNegativeMoneySchema,
|
|
11
12
|
});
|
|
12
13
|
var GetOrderSalesByMonthContractQuery;
|
|
13
14
|
(function (GetOrderSalesByMonthContractQuery) {
|
|
@@ -3,9 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CreateOrderProductContractCommand = 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 CreateOrderProductRequestSchema = zod_1.z.object({
|
|
7
8
|
quantity: zod_1.z.number(),
|
|
8
|
-
price:
|
|
9
|
+
price: money_schema_1.MoneySchema,
|
|
9
10
|
comment: zod_1.z.string().nullable(),
|
|
10
11
|
tag: zod_1.z.string().nullable(),
|
|
11
12
|
isEditable: zod_1.z.coerce.boolean(),
|
|
@@ -3,10 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PriceValuationExecuteContractCommand = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const schemas_1 = require("../../../schemas");
|
|
6
|
+
const non_negative_money_schema_1 = require("../../../schemas/non-negative-money.schema");
|
|
6
7
|
const PRICE_VALUATION_BATCH_LIMIT = 50;
|
|
7
8
|
const PriceValuationExecuteItemSchema = zod_1.z.object({
|
|
8
9
|
orderProductUUID: zod_1.z.string().uuid(),
|
|
9
|
-
|
|
10
|
+
// Неотрицательность проверяем по знаку строки: минус — единственный признак отрицательной суммы.
|
|
11
|
+
price: non_negative_money_schema_1.NonNegativeMoneySchema,
|
|
10
12
|
});
|
|
11
13
|
const PriceValuationExecuteRequestSchema = zod_1.z.object({
|
|
12
14
|
orderUUID: zod_1.z.string().uuid(),
|
|
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.UpdateOrderProductContractCommand = 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 UpdateOrderProductRequestSchema = zod_1.z.object({
|
|
7
8
|
productUUID: zod_1.z.uuid(),
|
|
8
9
|
quantity: zod_1.z.number(),
|
|
9
|
-
price:
|
|
10
|
+
price: money_schema_1.MoneySchema,
|
|
10
11
|
comment: zod_1.z.string().nullable(),
|
|
11
12
|
tag: zod_1.z.string().nullable(),
|
|
12
13
|
isEditable: zod_1.z.coerce.boolean(),
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CreatePaymentInvoiceContractCommand = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const payment_invoice_schema_1 = require("../../schemas/payment-invoice/payment-invoice.schema");
|
|
6
|
+
const positive_money_schema_1 = require("../../schemas/positive-money.schema");
|
|
6
7
|
// Потолок числа заказов в счёте. Это защита от абсурдного запроса, а не бизнес-правило: счёт за месяц
|
|
7
8
|
// клиенту с ежедневными поставками — это уже 30 строк, поэтому 10-20 отрезали бы живые сценарии.
|
|
8
9
|
// Сто строк — это 3-4 страницы таблицы, документ такого размера собирается и читается нормально.
|
|
@@ -16,7 +17,8 @@ const CreatePaymentInvoiceRequestSchema = zod_1.z
|
|
|
16
17
|
clientUUID: zod_1.z.uuid(),
|
|
17
18
|
invoiceDate: zod_1.z.coerce.date(),
|
|
18
19
|
orderUUIDs: zod_1.z.uuid().array().max(MAX_INVOICE_ORDER_COUNT).optional(),
|
|
19
|
-
|
|
20
|
+
// Строго положительная сумма: отсекаем минус по знаку строки и нулевые записи вида "0" / "0.00".
|
|
21
|
+
amount: positive_money_schema_1.PositiveMoneySchema.optional(),
|
|
20
22
|
})
|
|
21
23
|
.refine(value => { var _a; return Boolean((_a = value.orderUUIDs) === null || _a === void 0 ? void 0 : _a.length) || value.amount !== undefined; }, {
|
|
22
24
|
message: 'Either orderUUIDs or amount must be provided',
|
|
@@ -3,10 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PayPaymentInvoiceContractCommand = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const payment_invoice_schema_1 = require("../../schemas/payment-invoice/payment-invoice.schema");
|
|
6
|
+
const positive_money_schema_1 = require("../../schemas/positive-money.schema");
|
|
6
7
|
// Оплата по счёту. amount не передан — гасим остаток целиком; передан — частичная оплата.
|
|
7
8
|
const PayPaymentInvoiceRequestSchema = zod_1.z.object({
|
|
8
9
|
moneyAccountUUID: zod_1.z.uuid(),
|
|
9
|
-
|
|
10
|
+
// Строго положительная сумма: отсекаем минус по знаку строки и нулевые записи вида "0" / "0.00".
|
|
11
|
+
amount: positive_money_schema_1.PositiveMoneySchema.optional(),
|
|
10
12
|
comment: zod_1.z.string().optional(),
|
|
11
13
|
cashFlowItemUUID: zod_1.z.uuid().nullable().optional(),
|
|
12
14
|
createdAt: zod_1.z.coerce.date().optional(),
|
package/build/commands/pre-order-collection-item/execute-pre-order-collection-item-update.command.js
CHANGED
|
@@ -3,17 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ExecutePreOrderCollectionItemUpdateContractCommand = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const error_message_schema_1 = require("../../schemas/error-message.schema");
|
|
6
|
+
const money_schema_1 = require("../../schemas/money.schema");
|
|
6
7
|
const OptionUpdateSchema = zod_1.z.object({
|
|
7
8
|
title: zod_1.z.string().nullable().optional(),
|
|
8
9
|
optionMultiplicity: zod_1.z.number().nullable().optional(),
|
|
9
|
-
optionPrice:
|
|
10
|
+
optionPrice: money_schema_1.MoneySchema.nullable().optional(),
|
|
10
11
|
});
|
|
11
12
|
const PositionUpdateSchema = zod_1.z.object({
|
|
12
13
|
name: zod_1.z.string().nullable().optional(),
|
|
13
14
|
multiplicity: zod_1.z.number().nullable().optional(),
|
|
14
15
|
quantity: zod_1.z.number().nullable().optional(),
|
|
15
16
|
balance: zod_1.z.number().nullable().optional(),
|
|
16
|
-
price:
|
|
17
|
+
price: money_schema_1.MoneySchema.nullable().optional(),
|
|
17
18
|
advancedPrice: zod_1.z.string().nullable().optional(),
|
|
18
19
|
grower: zod_1.z.string().nullable().optional(),
|
|
19
20
|
size: zod_1.z.string().nullable().optional(),
|
|
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CreatePreOrderCollectionItemMultiplicityOptionContractCommand = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const schemas_1 = require("../../../schemas");
|
|
6
|
+
const non_negative_money_schema_1 = require("../../../schemas/non-negative-money.schema");
|
|
6
7
|
const CreatePreOrderCollectionItemMultiplicityOptionRequestSchema = zod_1.z.object({
|
|
7
8
|
title: zod_1.z.string().max(100).nullable().optional(),
|
|
8
9
|
optionMultiplicity: zod_1.z.coerce.number().int().min(1),
|
|
9
|
-
optionPrice:
|
|
10
|
+
optionPrice: non_negative_money_schema_1.NonNegativeMoneySchema.nullable().optional(),
|
|
10
11
|
rank: zod_1.z.coerce.number().int().min(0).default(0).optional(),
|
|
11
12
|
});
|
|
12
13
|
const CreatePreOrderCollectionItemMultiplicityOptionResponseSchema = zod_1.z.object({
|
|
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.UpdatePreOrderCollectionItemMultiplicityOptionContractCommand = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const schemas_1 = require("../../../schemas");
|
|
6
|
+
const non_negative_money_schema_1 = require("../../../schemas/non-negative-money.schema");
|
|
6
7
|
const UpdatePreOrderCollectionItemMultiplicityOptionRequestSchema = zod_1.z
|
|
7
8
|
.object({
|
|
8
9
|
title: zod_1.z.string().max(100).nullable(),
|
|
9
10
|
optionMultiplicity: zod_1.z.coerce.number().int().min(1),
|
|
10
|
-
optionPrice:
|
|
11
|
+
optionPrice: non_negative_money_schema_1.NonNegativeMoneySchema.nullable(),
|
|
11
12
|
rank: zod_1.z.coerce.number().int().min(0).default(0),
|
|
12
13
|
})
|
|
13
14
|
.partial();
|
|
@@ -4,14 +4,15 @@ exports.CreateProductContractCommand = void 0;
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const enum_1 = require("../../enum");
|
|
6
6
|
const schemas_1 = require("../../schemas");
|
|
7
|
+
const money_schema_1 = require("../../schemas/money.schema");
|
|
7
8
|
const CreateProductRequestSchema = zod_1.z.object({
|
|
8
9
|
name: zod_1.z.string(),
|
|
9
10
|
consignmentUUID: zod_1.z.string(),
|
|
10
11
|
categoryUUID: zod_1.z.string(),
|
|
11
12
|
balance: zod_1.z.number(),
|
|
12
13
|
quantity: zod_1.z.number(),
|
|
13
|
-
price:
|
|
14
|
-
costPrice:
|
|
14
|
+
price: money_schema_1.MoneySchema,
|
|
15
|
+
costPrice: money_schema_1.MoneySchema,
|
|
15
16
|
multiplicity: zod_1.z.number(),
|
|
16
17
|
isOpen: zod_1.z.coerce.boolean(),
|
|
17
18
|
article: zod_1.z.string().nullable(),
|
|
@@ -21,7 +22,7 @@ const CreateProductRequestSchema = zod_1.z.object({
|
|
|
21
22
|
size: zod_1.z.string().nullable(),
|
|
22
23
|
size2: zod_1.z.string().nullable(),
|
|
23
24
|
size3: zod_1.z.string().nullable(),
|
|
24
|
-
invoicePrice:
|
|
25
|
+
invoicePrice: money_schema_1.MoneySchema.nullable(),
|
|
25
26
|
invoiceNumber: zod_1.z.string().nullable(),
|
|
26
27
|
imageUUID: zod_1.z.string().nullable(),
|
|
27
28
|
country: zod_1.z.string().nullable(),
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UpdateGroupProductPricesContractCommand = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const money_schema_1 = require("../../../schemas/money.schema");
|
|
5
6
|
const UpdateGroupProductPricesRequestSchema = zod_1.z.object({
|
|
6
7
|
data: zod_1.z
|
|
7
8
|
.object({
|
|
8
9
|
productUUID: zod_1.z.string(),
|
|
9
|
-
newCost:
|
|
10
|
-
newPrice:
|
|
10
|
+
newCost: money_schema_1.MoneySchema,
|
|
11
|
+
newPrice: money_schema_1.MoneySchema.optional(),
|
|
11
12
|
})
|
|
12
13
|
.array(),
|
|
13
14
|
});
|
|
@@ -4,21 +4,22 @@ exports.UpdateGroupProductUpdateBatchContractCommand = void 0;
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const enum_1 = require("../../../enum");
|
|
6
6
|
const error_message_schema_1 = require("../../../schemas/error-message.schema");
|
|
7
|
+
const money_schema_1 = require("../../../schemas/money.schema");
|
|
7
8
|
const UpdateGroupProductUpdateBatchRequestSchema = zod_1.z.object({
|
|
8
9
|
productUUIDList: zod_1.z.array(zod_1.z.string()),
|
|
9
10
|
data: zod_1.z
|
|
10
11
|
.object({
|
|
11
12
|
name: zod_1.z.string(),
|
|
12
13
|
categoryUUID: zod_1.z.string(),
|
|
13
|
-
price:
|
|
14
|
-
costPrice:
|
|
14
|
+
price: money_schema_1.MoneySchema,
|
|
15
|
+
costPrice: money_schema_1.MoneySchema,
|
|
15
16
|
color: zod_1.z.string().nullable(),
|
|
16
17
|
size: zod_1.z.string().nullable(),
|
|
17
18
|
multiplicity: zod_1.z.coerce.number(),
|
|
18
19
|
size2: zod_1.z.string().nullable(),
|
|
19
20
|
grower: zod_1.z.string().nullable(),
|
|
20
21
|
country: zod_1.z.string().nullable(),
|
|
21
|
-
invoicePrice:
|
|
22
|
+
invoicePrice: money_schema_1.MoneySchema.nullable(),
|
|
22
23
|
invoiceNumber: zod_1.z.string().nullable(),
|
|
23
24
|
imageUUID: zod_1.z.string().nullable(),
|
|
24
25
|
multiplicityDescription: zod_1.z.string().nullable(),
|
package/build/commands/product/multiplicity-option/create-product-multiplicity-option.command.js
CHANGED
|
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CreateProductMultiplicityOptionContractCommand = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const schemas_1 = require("../../../schemas");
|
|
6
|
+
const non_negative_money_schema_1 = require("../../../schemas/non-negative-money.schema");
|
|
6
7
|
const CreateProductMultiplicityOptionRequestSchema = zod_1.z.object({
|
|
7
8
|
title: zod_1.z.string().max(100).nullable().optional(),
|
|
8
9
|
optionMultiplicity: zod_1.z.coerce.number().int().min(1),
|
|
9
|
-
optionPrice:
|
|
10
|
+
optionPrice: non_negative_money_schema_1.NonNegativeMoneySchema.nullable().optional(),
|
|
10
11
|
rank: zod_1.z.coerce.number().int().min(0).default(0).optional(),
|
|
11
12
|
});
|
|
12
13
|
const CreateProductMultiplicityOptionResponseSchema = zod_1.z.object({
|
package/build/commands/product/multiplicity-option/update-product-multiplicity-option.command.js
CHANGED
|
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.UpdateProductMultiplicityOptionContractCommand = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const schemas_1 = require("../../../schemas");
|
|
6
|
+
const non_negative_money_schema_1 = require("../../../schemas/non-negative-money.schema");
|
|
6
7
|
const UpdateProductMultiplicityOptionRequestSchema = zod_1.z
|
|
7
8
|
.object({
|
|
8
9
|
title: zod_1.z.string().max(100).nullable(),
|
|
9
10
|
optionMultiplicity: zod_1.z.coerce.number().int().min(1),
|
|
10
|
-
optionPrice:
|
|
11
|
+
optionPrice: non_negative_money_schema_1.NonNegativeMoneySchema.nullable(),
|
|
11
12
|
rank: zod_1.z.coerce.number().int().min(0).default(0),
|
|
12
13
|
})
|
|
13
14
|
.partial();
|
|
@@ -4,14 +4,15 @@ exports.UpdateProductContractCommand = void 0;
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const enum_1 = require("../../enum");
|
|
6
6
|
const schemas_1 = require("../../schemas");
|
|
7
|
+
const money_schema_1 = require("../../schemas/money.schema");
|
|
7
8
|
const UpdateProductRequestSchema = zod_1.z.object({
|
|
8
9
|
name: zod_1.z.string(),
|
|
9
10
|
consignmentUUID: zod_1.z.string(),
|
|
10
11
|
categoryUUID: zod_1.z.string(),
|
|
11
12
|
balance: zod_1.z.number(),
|
|
12
13
|
quantity: zod_1.z.number(),
|
|
13
|
-
price:
|
|
14
|
-
costPrice:
|
|
14
|
+
price: money_schema_1.MoneySchema,
|
|
15
|
+
costPrice: money_schema_1.MoneySchema,
|
|
15
16
|
multiplicity: zod_1.z.number(),
|
|
16
17
|
isOpen: zod_1.z.coerce.boolean(),
|
|
17
18
|
article: zod_1.z.string().nullable(),
|
|
@@ -21,7 +22,7 @@ const UpdateProductRequestSchema = zod_1.z.object({
|
|
|
21
22
|
size: zod_1.z.string().nullable(),
|
|
22
23
|
size2: zod_1.z.string().nullable(),
|
|
23
24
|
size3: zod_1.z.string().nullable(),
|
|
24
|
-
invoicePrice:
|
|
25
|
+
invoicePrice: money_schema_1.MoneySchema.nullable(),
|
|
25
26
|
invoiceNumber: zod_1.z.string().nullable(),
|
|
26
27
|
imageUUID: zod_1.z.string().nullable(),
|
|
27
28
|
country: zod_1.z.string().nullable(),
|
|
@@ -3,11 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ExportSalesByClientContractQuery = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const date_helper_1 = require("../../helpers/date.helper");
|
|
6
|
+
const report_order_filter_schema_1 = require("../../schemas/report/report-order-filter.schema");
|
|
6
7
|
const ExportSalesByClientRequestSchema = zod_1.z
|
|
7
8
|
.object({
|
|
8
9
|
startDate: zod_1.z.coerce.date(),
|
|
9
10
|
endDate: zod_1.z.coerce.date(),
|
|
10
11
|
})
|
|
12
|
+
// dateBasis / excludeClientUUID — те же, что у JSON-эндпоинтов отчётов по заказам.
|
|
13
|
+
.merge(report_order_filter_schema_1.ReportOrderFilterSchema)
|
|
11
14
|
.refine(value => (0, date_helper_1.dateRangeCheck)(value.startDate, value.endDate), {
|
|
12
15
|
message: 'validation.dateRange',
|
|
13
16
|
path: ['endDate', 'startDate'],
|
|
@@ -4,12 +4,15 @@ exports.ExportSalesByPositionContractQuery = void 0;
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const date_helper_1 = require("../../helpers/date.helper");
|
|
6
6
|
const sales_by_position_group_by_enum_1 = require("../../enum/sales-by-position-group-by.enum");
|
|
7
|
+
const report_order_filter_schema_1 = require("../../schemas/report/report-order-filter.schema");
|
|
7
8
|
const ExportSalesByPositionRequestSchema = zod_1.z
|
|
8
9
|
.object({
|
|
9
10
|
startDate: zod_1.z.coerce.date(),
|
|
10
11
|
endDate: zod_1.z.coerce.date(),
|
|
11
12
|
groupBy: zod_1.z.nativeEnum(sales_by_position_group_by_enum_1.SalesByPositionGroupByEnum).default(sales_by_position_group_by_enum_1.SalesByPositionGroupByEnum.PRODUCT),
|
|
12
13
|
})
|
|
14
|
+
// dateBasis / excludeClientUUID — те же, что у JSON-эндпоинтов отчётов по заказам.
|
|
15
|
+
.merge(report_order_filter_schema_1.ReportOrderFilterSchema)
|
|
13
16
|
.refine(value => (0, date_helper_1.dateRangeCheck)(value.startDate, value.endDate), {
|
|
14
17
|
message: 'validation.dateRange',
|
|
15
18
|
path: ['endDate', 'startDate'],
|
|
@@ -4,12 +4,15 @@ exports.ExportSalesRevenueContractQuery = 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 report_order_filter_schema_1 = require("../../schemas/report/report-order-filter.schema");
|
|
7
8
|
const ExportSalesRevenueRequestSchema = zod_1.z
|
|
8
9
|
.object({
|
|
9
10
|
startDate: zod_1.z.coerce.date().optional(),
|
|
10
11
|
endDate: zod_1.z.coerce.date().optional(),
|
|
11
12
|
periodType: zod_1.z.nativeEnum(report_period_type_enum_1.ReportPeriodTypeEnum).default(report_period_type_enum_1.ReportPeriodTypeEnum.DAY),
|
|
12
13
|
})
|
|
14
|
+
// dateBasis / excludeClientUUID — те же, что у JSON-эндпоинтов отчётов по заказам.
|
|
15
|
+
.merge(report_order_filter_schema_1.ReportOrderFilterSchema)
|
|
13
16
|
.refine(value => {
|
|
14
17
|
const { startDate, endDate } = value;
|
|
15
18
|
if (startDate && endDate) {
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.GetCashFlowContractQuery = 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 GetCashFlowRequestSchema = zod_1.z
|
|
7
8
|
.object({
|
|
8
9
|
startDate: zod_1.z.coerce.date(),
|
|
@@ -29,8 +30,8 @@ const CashFlowItemRowSchema = zod_1.z.object({
|
|
|
29
30
|
// null — строка "Без статьи": платежи, которым статью ещё не проставили.
|
|
30
31
|
cashFlowItemUUID: zod_1.z.string().nullable(),
|
|
31
32
|
cashFlowItemName: zod_1.z.string().nullable(),
|
|
32
|
-
income:
|
|
33
|
-
expense:
|
|
33
|
+
income: money_schema_1.MoneySchema,
|
|
34
|
+
expense: money_schema_1.MoneySchema,
|
|
34
35
|
transactionCount: zod_1.z.number(),
|
|
35
36
|
});
|
|
36
37
|
const CashFlowMonthRowSchema = CashFlowItemRowSchema.extend({
|
|
@@ -42,9 +43,11 @@ const GetCashFlowResponseSchema = zod_1.z.object({
|
|
|
42
43
|
byItem: CashFlowItemRowSchema.array(),
|
|
43
44
|
byMonth: CashFlowMonthRowSchema.array(),
|
|
44
45
|
totals: zod_1.z.object({
|
|
45
|
-
income:
|
|
46
|
-
expense:
|
|
47
|
-
|
|
46
|
+
income: money_schema_1.MoneySchema,
|
|
47
|
+
expense: money_schema_1.MoneySchema,
|
|
48
|
+
// Сальдо (`income - expense`) — знаковая величина, минус здесь легален,
|
|
49
|
+
// поэтому ограничения на знак нет и быть не должно.
|
|
50
|
+
total: money_schema_1.MoneySchema,
|
|
48
51
|
}),
|
|
49
52
|
}),
|
|
50
53
|
});
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.GetDailyOrdersSummaryContractQuery = 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 GetDailyOrdersSummaryRequestSchema = zod_1.z
|
|
7
8
|
.object({
|
|
8
9
|
startDate: zod_1.z.coerce.date(),
|
|
@@ -24,7 +25,7 @@ const UnitsByMeasureSchema = zod_1.z.object({
|
|
|
24
25
|
const metricsShape = {
|
|
25
26
|
ordersCreated: zod_1.z.number(),
|
|
26
27
|
ordersCompleted: zod_1.z.number(),
|
|
27
|
-
totalSum:
|
|
28
|
+
totalSum: money_schema_1.MoneySchema,
|
|
28
29
|
unitsByMeasure: UnitsByMeasureSchema,
|
|
29
30
|
};
|
|
30
31
|
const DailyOrdersSummaryTotalsSchema = zod_1.z.object(Object.assign({}, metricsShape));
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.GetReportForPeriodContractQuery = 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 GetReportForPeriodRequestSchema = zod_1.z
|
|
7
8
|
.object({
|
|
8
9
|
startDate: zod_1.z.coerce.date(),
|
|
@@ -23,17 +24,17 @@ const GetReportForPeriodResponseSchema = zod_1.z.object({
|
|
|
23
24
|
data: zod_1.z.object({
|
|
24
25
|
totalOrders: zod_1.z.number(),
|
|
25
26
|
soldUnits: zod_1.z.number(),
|
|
26
|
-
totalSales:
|
|
27
|
-
totalCost:
|
|
27
|
+
totalSales: money_schema_1.MoneySchema,
|
|
28
|
+
totalCost: money_schema_1.MoneySchema,
|
|
28
29
|
totalUnits: zod_1.z.number(),
|
|
29
|
-
totalWriteOff: zod_1.z.number(),
|
|
30
|
-
totalWriteOffCost:
|
|
30
|
+
totalWriteOff: zod_1.z.number(), // количество списанных единиц (SUM по quantity), не деньги
|
|
31
|
+
totalWriteOffCost: money_schema_1.MoneySchema,
|
|
31
32
|
totalWriteOffByOrder: zod_1.z.number(),
|
|
32
|
-
totalWriteOffCostByOrder:
|
|
33
|
-
totalVatAmount:
|
|
34
|
-
totalDeliveryCost:
|
|
35
|
-
middlePrice:
|
|
36
|
-
grossProfit:
|
|
33
|
+
totalWriteOffCostByOrder: money_schema_1.MoneySchema,
|
|
34
|
+
totalVatAmount: money_schema_1.MoneySchema,
|
|
35
|
+
totalDeliveryCost: money_schema_1.MoneySchema,
|
|
36
|
+
middlePrice: money_schema_1.MoneySchema,
|
|
37
|
+
grossProfit: money_schema_1.MoneySchema,
|
|
37
38
|
marginality: zod_1.z.number(),
|
|
38
39
|
}),
|
|
39
40
|
});
|
|
@@ -4,6 +4,8 @@ exports.GetReportGroupByClientContactQuery = void 0;
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const enum_1 = require("../../enum");
|
|
6
6
|
const date_helper_1 = require("../../helpers/date.helper");
|
|
7
|
+
const money_schema_1 = require("../../schemas/money.schema");
|
|
8
|
+
const report_order_filter_schema_1 = require("../../schemas/report/report-order-filter.schema");
|
|
7
9
|
const GetReportGroupByClientRequestSchema = zod_1.z
|
|
8
10
|
.object({
|
|
9
11
|
// Даты приходят «сырым» днём — раскладку в полуинтервал [start, endExclusive) делает сервис
|
|
@@ -23,6 +25,9 @@ const GetReportGroupByClientRequestSchema = zod_1.z
|
|
|
23
25
|
// Без значения — ограничения нет: панель по-прежнему получает все строки.
|
|
24
26
|
limit: zod_1.z.coerce.number().int().positive().optional().describe('Keep only the top N rows; implies sorting by gross profit desc.'),
|
|
25
27
|
})
|
|
28
|
+
// dateBasis / excludeClientUUID общие с sales/summary: обе цифры живут на одном экране и должны
|
|
29
|
+
// сужаться одинаково.
|
|
30
|
+
.merge(report_order_filter_schema_1.ReportOrderFilterSchema)
|
|
26
31
|
.refine(value => {
|
|
27
32
|
const { startDate, endDate } = value;
|
|
28
33
|
if (startDate && endDate) {
|
|
@@ -41,16 +46,16 @@ const GetReportGroupByClientResponseSchema = zod_1.z.object({
|
|
|
41
46
|
clientName: zod_1.z.string(),
|
|
42
47
|
totalOrders: zod_1.z.number(),
|
|
43
48
|
soldUnits: zod_1.z.number(),
|
|
44
|
-
totalSales:
|
|
45
|
-
totalSalesCost:
|
|
46
|
-
totalWriteOff: zod_1.z.number(),
|
|
47
|
-
totalWriteOffSales:
|
|
48
|
-
totalVatAmount:
|
|
49
|
-
totalDeliveryCost:
|
|
50
|
-
totalServiceAmount:
|
|
51
|
-
totalPayments:
|
|
52
|
-
middlePrice:
|
|
53
|
-
grossProfit:
|
|
49
|
+
totalSales: money_schema_1.MoneySchema,
|
|
50
|
+
totalSalesCost: money_schema_1.MoneySchema,
|
|
51
|
+
totalWriteOff: zod_1.z.number(), // количество списанных единиц (SUM по quantity), не деньги
|
|
52
|
+
totalWriteOffSales: money_schema_1.MoneySchema, // деньги: SUM(write_off.quantity * order_product.price)
|
|
53
|
+
totalVatAmount: money_schema_1.MoneySchema,
|
|
54
|
+
totalDeliveryCost: money_schema_1.MoneySchema,
|
|
55
|
+
totalServiceAmount: money_schema_1.MoneySchema,
|
|
56
|
+
totalPayments: money_schema_1.MoneySchema,
|
|
57
|
+
middlePrice: money_schema_1.MoneySchema,
|
|
58
|
+
grossProfit: money_schema_1.MoneySchema,
|
|
54
59
|
marginality: zod_1.z.number(),
|
|
55
60
|
})),
|
|
56
61
|
// Аддитивно к прежней форме: число клиентов во ВСЁМ отчёте до усечения и применённый limit.
|