@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
|
@@ -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(),
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { OrderStatusEnum, OrderTypeEnum } from '../../enum';
|
|
3
3
|
import { OrderSchema } from '../../schemas';
|
|
4
|
+
import { MoneySchema } from '../../schemas/money.schema';
|
|
4
5
|
|
|
5
6
|
const UpdateOrderRequestSchema = z.object({
|
|
6
7
|
clientUUID: z.uuid(),
|
|
7
8
|
branchUUID: z.uuid().nullable(),
|
|
8
|
-
deliveryCost:
|
|
9
|
+
deliveryCost: MoneySchema,
|
|
9
10
|
type: z.nativeEnum(OrderTypeEnum),
|
|
10
11
|
comment: z.string().nullable(),
|
|
11
12
|
clientComment: z.string().nullable(),
|
|
@@ -13,7 +14,7 @@ const UpdateOrderRequestSchema = z.object({
|
|
|
13
14
|
status: z.nativeEnum(OrderStatusEnum),
|
|
14
15
|
isPaid: z.coerce.boolean(),
|
|
15
16
|
deliveryVat: z.coerce.number().nullable(),
|
|
16
|
-
deliveryVatAmount:
|
|
17
|
+
deliveryVatAmount: MoneySchema,
|
|
17
18
|
completedAt: z.coerce.date().nullable().optional(),
|
|
18
19
|
paymentDueAt: z.coerce.date().nullable().optional(),
|
|
19
20
|
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { MoneySchema } from '../../../schemas/money.schema';
|
|
3
|
+
import { NonNegativeMoneySchema } from '../../../schemas/non-negative-money.schema';
|
|
2
4
|
|
|
3
5
|
const GetOrderSalesByMonthRequestSchema = z.object({
|
|
4
6
|
month: z.coerce.number().int().min(1).max(12),
|
|
@@ -6,7 +8,7 @@ const GetOrderSalesByMonthRequestSchema = z.object({
|
|
|
6
8
|
|
|
7
9
|
const GetOrderSalesByMonthResponseSchema = z.object({
|
|
8
10
|
message: z.string().optional(),
|
|
9
|
-
data:
|
|
11
|
+
data: NonNegativeMoneySchema,
|
|
10
12
|
});
|
|
11
13
|
|
|
12
14
|
export namespace GetOrderSalesByMonthContractQuery {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { OrderProductSchema } from '../../schemas';
|
|
3
|
+
import { MoneySchema } from '../../schemas/money.schema';
|
|
3
4
|
|
|
4
5
|
const CreateOrderProductRequestSchema = z.object({
|
|
5
6
|
quantity: z.number(),
|
|
6
|
-
price:
|
|
7
|
+
price: MoneySchema,
|
|
7
8
|
comment: z.string().nullable(),
|
|
8
9
|
tag: z.string().nullable(),
|
|
9
10
|
isEditable: z.coerce.boolean(),
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { PriceCorrectionExecuteResultItemSchema } from '../../../schemas';
|
|
3
|
+
import { MoneySchema } from '../../../schemas/money.schema';
|
|
4
|
+
import { NonNegativeMoneySchema } from '../../../schemas/non-negative-money.schema';
|
|
3
5
|
|
|
4
6
|
const PRICE_VALUATION_BATCH_LIMIT = 50;
|
|
5
7
|
|
|
6
8
|
const PriceValuationExecuteItemSchema = z.object({
|
|
7
9
|
orderProductUUID: z.string().uuid(),
|
|
8
|
-
|
|
10
|
+
// Неотрицательность проверяем по знаку строки: минус — единственный признак отрицательной суммы.
|
|
11
|
+
price: NonNegativeMoneySchema,
|
|
9
12
|
});
|
|
10
13
|
|
|
11
14
|
const PriceValuationExecuteRequestSchema = z.object({
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { OrderProductSchema } from '../../schemas';
|
|
3
|
+
import { MoneySchema } from '../../schemas/money.schema';
|
|
3
4
|
|
|
4
5
|
const UpdateOrderProductRequestSchema = z.object({
|
|
5
6
|
productUUID: z.uuid(),
|
|
6
7
|
quantity: z.number(),
|
|
7
|
-
price:
|
|
8
|
+
price: MoneySchema,
|
|
8
9
|
comment: z.string().nullable(),
|
|
9
10
|
tag: z.string().nullable(),
|
|
10
11
|
isEditable: z.coerce.boolean(),
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { PaymentInvoiceSchema } from '../../schemas/payment-invoice/payment-invoice.schema';
|
|
3
|
+
import { MoneySchema } from '../../schemas/money.schema';
|
|
4
|
+
import { PositiveMoneySchema } from '../../schemas/positive-money.schema';
|
|
3
5
|
|
|
4
6
|
// Потолок числа заказов в счёте. Это защита от абсурдного запроса, а не бизнес-правило: счёт за месяц
|
|
5
7
|
// клиенту с ежедневными поставками — это уже 30 строк, поэтому 10-20 отрезали бы живые сценарии.
|
|
@@ -15,7 +17,8 @@ const CreatePaymentInvoiceRequestSchema = z
|
|
|
15
17
|
clientUUID: z.uuid(),
|
|
16
18
|
invoiceDate: z.coerce.date(),
|
|
17
19
|
orderUUIDs: z.uuid().array().max(MAX_INVOICE_ORDER_COUNT).optional(),
|
|
18
|
-
|
|
20
|
+
// Строго положительная сумма: отсекаем минус по знаку строки и нулевые записи вида "0" / "0.00".
|
|
21
|
+
amount: PositiveMoneySchema.optional(),
|
|
19
22
|
})
|
|
20
23
|
.refine(value => Boolean(value.orderUUIDs?.length) || value.amount !== undefined, {
|
|
21
24
|
message: 'Either orderUUIDs or amount must be provided',
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { PaymentInvoiceSchema } from '../../schemas/payment-invoice/payment-invoice.schema';
|
|
3
|
+
import { MoneySchema } from '../../schemas/money.schema';
|
|
4
|
+
import { PositiveMoneySchema } from '../../schemas/positive-money.schema';
|
|
3
5
|
|
|
4
6
|
// Оплата по счёту. amount не передан — гасим остаток целиком; передан — частичная оплата.
|
|
5
7
|
const PayPaymentInvoiceRequestSchema = z.object({
|
|
6
8
|
moneyAccountUUID: z.uuid(),
|
|
7
|
-
|
|
9
|
+
// Строго положительная сумма: отсекаем минус по знаку строки и нулевые записи вида "0" / "0.00".
|
|
10
|
+
amount: PositiveMoneySchema.optional(),
|
|
8
11
|
comment: z.string().optional(),
|
|
9
12
|
cashFlowItemUUID: z.uuid().nullable().optional(),
|
|
10
13
|
createdAt: z.coerce.date().optional(),
|
package/commands/pre-order-collection-item/execute-pre-order-collection-item-update.command.ts
CHANGED
|
@@ -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 PositionUpdateSchema = z.object({
|
|
@@ -12,7 +13,7 @@ const PositionUpdateSchema = 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
|
+
price: MoneySchema.nullable().optional(),
|
|
16
17
|
advancedPrice: z.string().nullable().optional(),
|
|
17
18
|
grower: z.string().nullable().optional(),
|
|
18
19
|
size: z.string().nullable().optional(),
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { PreOrderCollectionItemMultiplicityOptionSchema } from '../../../schemas';
|
|
3
|
+
import { MoneySchema } from '../../../schemas/money.schema';
|
|
4
|
+
import { NonNegativeMoneySchema } from '../../../schemas/non-negative-money.schema';
|
|
3
5
|
|
|
4
6
|
const CreatePreOrderCollectionItemMultiplicityOptionRequestSchema = z.object({
|
|
5
7
|
title: z.string().max(100).nullable().optional(),
|
|
6
8
|
optionMultiplicity: z.coerce.number().int().min(1),
|
|
7
|
-
optionPrice:
|
|
9
|
+
optionPrice: NonNegativeMoneySchema.nullable().optional(),
|
|
8
10
|
rank: z.coerce.number().int().min(0).default(0).optional(),
|
|
9
11
|
});
|
|
10
12
|
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { PreOrderCollectionItemMultiplicityOptionSchema } from '../../../schemas';
|
|
3
|
+
import { MoneySchema } from '../../../schemas/money.schema';
|
|
4
|
+
import { NonNegativeMoneySchema } from '../../../schemas/non-negative-money.schema';
|
|
3
5
|
|
|
4
6
|
const UpdatePreOrderCollectionItemMultiplicityOptionRequestSchema = z
|
|
5
7
|
.object({
|
|
6
8
|
title: z.string().max(100).nullable(),
|
|
7
9
|
optionMultiplicity: z.coerce.number().int().min(1),
|
|
8
|
-
optionPrice:
|
|
10
|
+
optionPrice: NonNegativeMoneySchema.nullable(),
|
|
9
11
|
rank: z.coerce.number().int().min(0).default(0),
|
|
10
12
|
})
|
|
11
13
|
.partial();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ProductMarkEnum, SalesUnitEnum } from '../../enum';
|
|
3
3
|
import { ProductExtendedForAdminSchema } from '../../schemas';
|
|
4
|
+
import { MoneySchema } from '../../schemas/money.schema';
|
|
4
5
|
|
|
5
6
|
const CreateProductRequestSchema = z.object({
|
|
6
7
|
name: z.string(),
|
|
@@ -8,8 +9,8 @@ const CreateProductRequestSchema = z.object({
|
|
|
8
9
|
categoryUUID: z.string(),
|
|
9
10
|
balance: z.number(),
|
|
10
11
|
quantity: z.number(),
|
|
11
|
-
price:
|
|
12
|
-
costPrice:
|
|
12
|
+
price: MoneySchema,
|
|
13
|
+
costPrice: MoneySchema,
|
|
13
14
|
multiplicity: z.number(),
|
|
14
15
|
isOpen: z.coerce.boolean(),
|
|
15
16
|
|
|
@@ -20,7 +21,7 @@ const CreateProductRequestSchema = z.object({
|
|
|
20
21
|
size: z.string().nullable(),
|
|
21
22
|
size2: z.string().nullable(),
|
|
22
23
|
size3: z.string().nullable(),
|
|
23
|
-
invoicePrice:
|
|
24
|
+
invoicePrice: MoneySchema.nullable(),
|
|
24
25
|
invoiceNumber: z.string().nullable(),
|
|
25
26
|
imageUUID: z.string().nullable(),
|
|
26
27
|
country: z.string().nullable(),
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { MoneySchema } from '../../../schemas/money.schema';
|
|
2
3
|
|
|
3
4
|
const UpdateGroupProductPricesRequestSchema = z.object({
|
|
4
5
|
data: z
|
|
5
6
|
.object({
|
|
6
7
|
productUUID: z.string(),
|
|
7
|
-
newCost:
|
|
8
|
-
newPrice:
|
|
8
|
+
newCost: MoneySchema,
|
|
9
|
+
newPrice: MoneySchema.optional(),
|
|
9
10
|
})
|
|
10
11
|
.array(),
|
|
11
12
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { SalesUnitEnum } from '../../../enum';
|
|
3
3
|
import { ErrorMessageSchema } from '../../../schemas/error-message.schema';
|
|
4
|
+
import { MoneySchema } from '../../../schemas/money.schema';
|
|
4
5
|
|
|
5
6
|
const UpdateGroupProductUpdateBatchRequestSchema = z.object({
|
|
6
7
|
productUUIDList: z.array(z.string()),
|
|
@@ -8,15 +9,15 @@ const UpdateGroupProductUpdateBatchRequestSchema = z.object({
|
|
|
8
9
|
.object({
|
|
9
10
|
name: z.string(),
|
|
10
11
|
categoryUUID: z.string(),
|
|
11
|
-
price:
|
|
12
|
-
costPrice:
|
|
12
|
+
price: MoneySchema,
|
|
13
|
+
costPrice: MoneySchema,
|
|
13
14
|
color: z.string().nullable(),
|
|
14
15
|
size: z.string().nullable(),
|
|
15
16
|
multiplicity: z.coerce.number(),
|
|
16
17
|
size2: z.string().nullable(),
|
|
17
18
|
grower: z.string().nullable(),
|
|
18
19
|
country: z.string().nullable(),
|
|
19
|
-
invoicePrice:
|
|
20
|
+
invoicePrice: MoneySchema.nullable(),
|
|
20
21
|
invoiceNumber: z.string().nullable(),
|
|
21
22
|
imageUUID: z.string().nullable(),
|
|
22
23
|
multiplicityDescription: z.string().nullable(),
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ProductMultiplicityOptionSchema } from '../../../schemas';
|
|
3
|
+
import { MoneySchema } from '../../../schemas/money.schema';
|
|
4
|
+
import { NonNegativeMoneySchema } from '../../../schemas/non-negative-money.schema';
|
|
3
5
|
|
|
4
6
|
const CreateProductMultiplicityOptionRequestSchema = z.object({
|
|
5
7
|
title: z.string().max(100).nullable().optional(),
|
|
6
8
|
optionMultiplicity: z.coerce.number().int().min(1),
|
|
7
|
-
optionPrice:
|
|
9
|
+
optionPrice: NonNegativeMoneySchema.nullable().optional(),
|
|
8
10
|
rank: z.coerce.number().int().min(0).default(0).optional(),
|
|
9
11
|
});
|
|
10
12
|
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ProductMultiplicityOptionSchema } from '../../../schemas';
|
|
3
|
+
import { MoneySchema } from '../../../schemas/money.schema';
|
|
4
|
+
import { NonNegativeMoneySchema } from '../../../schemas/non-negative-money.schema';
|
|
3
5
|
|
|
4
6
|
const UpdateProductMultiplicityOptionRequestSchema = z
|
|
5
7
|
.object({
|
|
6
8
|
title: z.string().max(100).nullable(),
|
|
7
9
|
optionMultiplicity: z.coerce.number().int().min(1),
|
|
8
|
-
optionPrice:
|
|
10
|
+
optionPrice: NonNegativeMoneySchema.nullable(),
|
|
9
11
|
rank: z.coerce.number().int().min(0).default(0),
|
|
10
12
|
})
|
|
11
13
|
.partial();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ProductMarkEnum, SalesUnitEnum } from '../../enum';
|
|
3
3
|
import { ProductExtendedForAdminSchema } from '../../schemas';
|
|
4
|
+
import { MoneySchema } from '../../schemas/money.schema';
|
|
4
5
|
|
|
5
6
|
const UpdateProductRequestSchema = z.object({
|
|
6
7
|
name: z.string(),
|
|
@@ -8,8 +9,8 @@ const UpdateProductRequestSchema = z.object({
|
|
|
8
9
|
categoryUUID: z.string(),
|
|
9
10
|
balance: z.number(),
|
|
10
11
|
quantity: z.number(),
|
|
11
|
-
price:
|
|
12
|
-
costPrice:
|
|
12
|
+
price: MoneySchema,
|
|
13
|
+
costPrice: MoneySchema,
|
|
13
14
|
multiplicity: z.number(),
|
|
14
15
|
isOpen: z.coerce.boolean(),
|
|
15
16
|
|
|
@@ -20,7 +21,7 @@ const UpdateProductRequestSchema = z.object({
|
|
|
20
21
|
size: z.string().nullable(),
|
|
21
22
|
size2: z.string().nullable(),
|
|
22
23
|
size3: z.string().nullable(),
|
|
23
|
-
invoicePrice:
|
|
24
|
+
invoicePrice: MoneySchema.nullable(),
|
|
24
25
|
invoiceNumber: z.string().nullable(),
|
|
25
26
|
imageUUID: z.string().nullable(),
|
|
26
27
|
country: z.string().nullable(),
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { dateRangeCheck, isStatementPeriodWithinLimit } from '../../helpers/date.helper';
|
|
3
|
+
import { ReportOrderFilterSchema } from '../../schemas/report/report-order-filter.schema';
|
|
3
4
|
|
|
4
5
|
const ExportSalesByClientRequestSchema = z
|
|
5
6
|
.object({
|
|
6
7
|
startDate: z.coerce.date(),
|
|
7
8
|
endDate: z.coerce.date(),
|
|
8
9
|
})
|
|
10
|
+
// dateBasis / excludeClientUUID — те же, что у JSON-эндпоинтов отчётов по заказам.
|
|
11
|
+
.merge(ReportOrderFilterSchema)
|
|
9
12
|
.refine(value => dateRangeCheck(value.startDate, value.endDate), {
|
|
10
13
|
message: 'validation.dateRange',
|
|
11
14
|
path: ['endDate', 'startDate'],
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { dateRangeCheck, isStatementPeriodWithinLimit } from '../../helpers/date.helper';
|
|
3
3
|
import { SalesByPositionGroupByEnum } from '../../enum/sales-by-position-group-by.enum';
|
|
4
|
+
import { ReportOrderFilterSchema } from '../../schemas/report/report-order-filter.schema';
|
|
4
5
|
|
|
5
6
|
const ExportSalesByPositionRequestSchema = z
|
|
6
7
|
.object({
|
|
@@ -8,6 +9,8 @@ const ExportSalesByPositionRequestSchema = z
|
|
|
8
9
|
endDate: z.coerce.date(),
|
|
9
10
|
groupBy: z.nativeEnum(SalesByPositionGroupByEnum).default(SalesByPositionGroupByEnum.PRODUCT),
|
|
10
11
|
})
|
|
12
|
+
// dateBasis / excludeClientUUID — те же, что у JSON-эндпоинтов отчётов по заказам.
|
|
13
|
+
.merge(ReportOrderFilterSchema)
|
|
11
14
|
.refine(value => dateRangeCheck(value.startDate, value.endDate), {
|
|
12
15
|
message: 'validation.dateRange',
|
|
13
16
|
path: ['endDate', 'startDate'],
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { dateRangeCheck } from '../../helpers/date.helper';
|
|
3
3
|
import { ReportPeriodTypeEnum } from '../../enum/report-period-type.enum';
|
|
4
|
+
import { ReportOrderFilterSchema } from '../../schemas/report/report-order-filter.schema';
|
|
4
5
|
|
|
5
6
|
const ExportSalesRevenueRequestSchema = z
|
|
6
7
|
.object({
|
|
@@ -8,6 +9,8 @@ const ExportSalesRevenueRequestSchema = z
|
|
|
8
9
|
endDate: z.coerce.date().optional(),
|
|
9
10
|
periodType: z.nativeEnum(ReportPeriodTypeEnum).default(ReportPeriodTypeEnum.DAY),
|
|
10
11
|
})
|
|
12
|
+
// dateBasis / excludeClientUUID — те же, что у JSON-эндпоинтов отчётов по заказам.
|
|
13
|
+
.merge(ReportOrderFilterSchema)
|
|
11
14
|
.refine(
|
|
12
15
|
value => {
|
|
13
16
|
const { startDate, endDate } = value;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { dateRangeCheck, isStatementPeriodWithinLimit } from '../../helpers/date.helper';
|
|
3
|
+
import { MoneySchema } from '../../schemas/money.schema';
|
|
3
4
|
|
|
4
5
|
const GetCashFlowRequestSchema = z
|
|
5
6
|
.object({
|
|
@@ -28,8 +29,8 @@ const CashFlowItemRowSchema = z.object({
|
|
|
28
29
|
// null — строка "Без статьи": платежи, которым статью ещё не проставили.
|
|
29
30
|
cashFlowItemUUID: z.string().nullable(),
|
|
30
31
|
cashFlowItemName: z.string().nullable(),
|
|
31
|
-
income:
|
|
32
|
-
expense:
|
|
32
|
+
income: MoneySchema,
|
|
33
|
+
expense: MoneySchema,
|
|
33
34
|
transactionCount: z.number(),
|
|
34
35
|
});
|
|
35
36
|
|
|
@@ -43,9 +44,11 @@ const GetCashFlowResponseSchema = z.object({
|
|
|
43
44
|
byItem: CashFlowItemRowSchema.array(),
|
|
44
45
|
byMonth: CashFlowMonthRowSchema.array(),
|
|
45
46
|
totals: z.object({
|
|
46
|
-
income:
|
|
47
|
-
expense:
|
|
48
|
-
|
|
47
|
+
income: MoneySchema,
|
|
48
|
+
expense: MoneySchema,
|
|
49
|
+
// Сальдо (`income - expense`) — знаковая величина, минус здесь легален,
|
|
50
|
+
// поэтому ограничения на знак нет и быть не должно.
|
|
51
|
+
total: MoneySchema,
|
|
49
52
|
}),
|
|
50
53
|
}),
|
|
51
54
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { dateRangeCheck, isStatementPeriodWithinLimit } from '../../helpers/date.helper';
|
|
3
|
+
import { MoneySchema } from '../../schemas/money.schema';
|
|
3
4
|
|
|
4
5
|
const GetDailyOrdersSummaryRequestSchema = z
|
|
5
6
|
.object({
|
|
@@ -24,7 +25,7 @@ const UnitsByMeasureSchema = z.object({
|
|
|
24
25
|
const metricsShape = {
|
|
25
26
|
ordersCreated: z.number(),
|
|
26
27
|
ordersCompleted: z.number(),
|
|
27
|
-
totalSum:
|
|
28
|
+
totalSum: MoneySchema,
|
|
28
29
|
unitsByMeasure: UnitsByMeasureSchema,
|
|
29
30
|
};
|
|
30
31
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { dateRangeCheck } from '../../helpers/date.helper';
|
|
3
|
+
import { MoneySchema } from '../../schemas/money.schema';
|
|
3
4
|
|
|
4
5
|
const GetReportForPeriodRequestSchema = z
|
|
5
6
|
.object({
|
|
@@ -25,17 +26,17 @@ const GetReportForPeriodResponseSchema = z.object({
|
|
|
25
26
|
data: z.object({
|
|
26
27
|
totalOrders: z.number(),
|
|
27
28
|
soldUnits: z.number(),
|
|
28
|
-
totalSales:
|
|
29
|
-
totalCost:
|
|
29
|
+
totalSales: MoneySchema,
|
|
30
|
+
totalCost: MoneySchema,
|
|
30
31
|
totalUnits: z.number(),
|
|
31
|
-
totalWriteOff: z.number(),
|
|
32
|
-
totalWriteOffCost:
|
|
32
|
+
totalWriteOff: z.number(), // количество списанных единиц (SUM по quantity), не деньги
|
|
33
|
+
totalWriteOffCost: MoneySchema,
|
|
33
34
|
totalWriteOffByOrder: z.number(),
|
|
34
|
-
totalWriteOffCostByOrder:
|
|
35
|
-
totalVatAmount:
|
|
36
|
-
totalDeliveryCost:
|
|
37
|
-
middlePrice:
|
|
38
|
-
grossProfit:
|
|
35
|
+
totalWriteOffCostByOrder: MoneySchema,
|
|
36
|
+
totalVatAmount: MoneySchema,
|
|
37
|
+
totalDeliveryCost: MoneySchema,
|
|
38
|
+
middlePrice: MoneySchema,
|
|
39
|
+
grossProfit: MoneySchema,
|
|
39
40
|
marginality: z.number(),
|
|
40
41
|
}),
|
|
41
42
|
});
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { OrderByEnum, ReportSortByEnum } from '../../enum';
|
|
3
3
|
import { dateRangeCheck } from '../../helpers/date.helper';
|
|
4
|
+
import { MoneySchema } from '../../schemas/money.schema';
|
|
5
|
+
import { ReportOrderFilterSchema } from '../../schemas/report/report-order-filter.schema';
|
|
4
6
|
|
|
5
7
|
const GetReportGroupByClientRequestSchema = z
|
|
6
8
|
.object({
|
|
@@ -21,6 +23,9 @@ const GetReportGroupByClientRequestSchema = z
|
|
|
21
23
|
// Без значения — ограничения нет: панель по-прежнему получает все строки.
|
|
22
24
|
limit: z.coerce.number().int().positive().optional().describe('Keep only the top N rows; implies sorting by gross profit desc.'),
|
|
23
25
|
})
|
|
26
|
+
// dateBasis / excludeClientUUID общие с sales/summary: обе цифры живут на одном экране и должны
|
|
27
|
+
// сужаться одинаково.
|
|
28
|
+
.merge(ReportOrderFilterSchema)
|
|
24
29
|
.refine(
|
|
25
30
|
value => {
|
|
26
31
|
const { startDate, endDate } = value;
|
|
@@ -45,16 +50,16 @@ const GetReportGroupByClientResponseSchema = z.object({
|
|
|
45
50
|
clientName: z.string(),
|
|
46
51
|
totalOrders: z.number(),
|
|
47
52
|
soldUnits: z.number(),
|
|
48
|
-
totalSales:
|
|
49
|
-
totalSalesCost:
|
|
50
|
-
totalWriteOff: z.number(),
|
|
51
|
-
totalWriteOffSales:
|
|
52
|
-
totalVatAmount:
|
|
53
|
-
totalDeliveryCost:
|
|
54
|
-
totalServiceAmount:
|
|
55
|
-
totalPayments:
|
|
56
|
-
middlePrice:
|
|
57
|
-
grossProfit:
|
|
53
|
+
totalSales: MoneySchema,
|
|
54
|
+
totalSalesCost: MoneySchema,
|
|
55
|
+
totalWriteOff: z.number(), // количество списанных единиц (SUM по quantity), не деньги
|
|
56
|
+
totalWriteOffSales: MoneySchema, // деньги: SUM(write_off.quantity * order_product.price)
|
|
57
|
+
totalVatAmount: MoneySchema,
|
|
58
|
+
totalDeliveryCost: MoneySchema,
|
|
59
|
+
totalServiceAmount: MoneySchema,
|
|
60
|
+
totalPayments: MoneySchema,
|
|
61
|
+
middlePrice: MoneySchema,
|
|
62
|
+
grossProfit: MoneySchema,
|
|
58
63
|
marginality: z.number(),
|
|
59
64
|
}),
|
|
60
65
|
),
|