@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
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MoneySchema } from './money.schema';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Денежная величина, которая не может быть отрицательной: цена, стоимость доставки, сумма позиции.
|
|
5
|
+
*
|
|
6
|
+
* На строковом формате знак проверяется по первому символу — это единственный признак
|
|
7
|
+
* отрицательности в `MoneySchema` (`^-?\d+(\.\d{1,2})?$`), поэтому приводить величину к числу ради
|
|
8
|
+
* сравнения не нужно и не следует.
|
|
9
|
+
*
|
|
10
|
+
* Разницу с [[PositiveMoneySchema]] стоит держать в голове: здесь ноль допустим (бесплатная доставка,
|
|
11
|
+
* позиция с нулевой ценой), а там — нет.
|
|
12
|
+
*/
|
|
13
|
+
export const NonNegativeMoneySchema = MoneySchema.refine(value => !value.startsWith('-'), {
|
|
14
|
+
message: 'validation.money.nonNegative',
|
|
15
|
+
});
|
|
@@ -4,6 +4,7 @@ import { ClientSchema } from '../client';
|
|
|
4
4
|
import { BranchSchema } from '../branch/branch.schema';
|
|
5
5
|
import { OrderDeliverySchema } from '../order-delivery/order-delivery.schema';
|
|
6
6
|
import { DeliveryRouteSchema } from '../delivery-route/delivery-route.schema';
|
|
7
|
+
import { MoneySchema } from '../money.schema';
|
|
7
8
|
|
|
8
9
|
export const OrderSchema = z.object({
|
|
9
10
|
uuid: z.uuid(),
|
|
@@ -12,14 +13,14 @@ export const OrderSchema = z.object({
|
|
|
12
13
|
branchUUID: z.uuid().nullable(),
|
|
13
14
|
creatorUserUUID: z.uuid(),
|
|
14
15
|
|
|
15
|
-
totalCost:
|
|
16
|
-
subtotal:
|
|
17
|
-
deliveryCost:
|
|
18
|
-
deliveryCheckAmount:
|
|
19
|
-
deliveryVatAmount:
|
|
16
|
+
totalCost: MoneySchema,
|
|
17
|
+
subtotal: MoneySchema,
|
|
18
|
+
deliveryCost: MoneySchema,
|
|
19
|
+
deliveryCheckAmount: MoneySchema,
|
|
20
|
+
deliveryVatAmount: MoneySchema,
|
|
20
21
|
deliveryVat: z.number().nullable(),
|
|
21
|
-
vatAmount:
|
|
22
|
-
discountAmount:
|
|
22
|
+
vatAmount: MoneySchema,
|
|
23
|
+
discountAmount: MoneySchema,
|
|
23
24
|
discount: z.number().nullable(),
|
|
24
25
|
|
|
25
26
|
status: z.nativeEnum(OrderStatusEnum),
|
|
@@ -68,9 +69,9 @@ export const OrderExtendedForClientSchema = OrderForClientSchema.extend({
|
|
|
68
69
|
client: ClientSchema,
|
|
69
70
|
branch: BranchSchema.nullable(),
|
|
70
71
|
delivery: OrderDeliverySchema.nullable(),
|
|
71
|
-
writeOffSum:
|
|
72
|
+
writeOffSum: MoneySchema.nullable(),
|
|
72
73
|
consignmentDeliveryDates: z.union([z.date(), z.literal('in-stock')]).array(),
|
|
73
74
|
// Server-computed delivery cost for the current subtotal when the tier rule is on (null when off).
|
|
74
75
|
// Convenience preview for the cart page; the storefront still recomputes locally on the delivery/pickup toggle.
|
|
75
|
-
deliveryCostPreview:
|
|
76
|
+
deliveryCostPreview: MoneySchema.nullable(),
|
|
76
77
|
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { MoneySchema } from '../money.schema';
|
|
2
3
|
|
|
3
4
|
export const OrderProductMultiplicityOptionSchema = z.object({
|
|
4
5
|
uuid: z.uuid(),
|
|
5
6
|
title: z.string().nullable(),
|
|
6
7
|
optionMultiplicity: z.coerce.number(),
|
|
7
|
-
optionPrice:
|
|
8
|
+
optionPrice: MoneySchema.nullable(),
|
|
8
9
|
});
|
|
@@ -5,6 +5,7 @@ import { ClientSchema } from '../client';
|
|
|
5
5
|
import { BranchSchema } from '../branch/branch.schema';
|
|
6
6
|
import { DistributionSchema } from '../distribution/distribution.schema';
|
|
7
7
|
import { OrderProductMultiplicityOptionSchema } from './order-product-multiplicity-optiom.schema';
|
|
8
|
+
import { MoneySchema } from '../money.schema';
|
|
8
9
|
|
|
9
10
|
export const OrderProductSchema = z.object({
|
|
10
11
|
uuid: z.uuid(),
|
|
@@ -13,11 +14,11 @@ export const OrderProductSchema = z.object({
|
|
|
13
14
|
multiplicityOptionUUID: z.uuid().nullable().optional(),
|
|
14
15
|
|
|
15
16
|
quantity: z.number(),
|
|
16
|
-
price:
|
|
17
|
-
amount:
|
|
18
|
-
vatAmount:
|
|
17
|
+
price: MoneySchema,
|
|
18
|
+
amount: MoneySchema,
|
|
19
|
+
vatAmount: MoneySchema,
|
|
19
20
|
vat: z.number().nullable(),
|
|
20
|
-
checkAmount:
|
|
21
|
+
checkAmount: MoneySchema,
|
|
21
22
|
|
|
22
23
|
comment: z.string().nullable(),
|
|
23
24
|
tag: z.string().nullable(),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { OrderStatusEnum } from '../../enum';
|
|
3
3
|
import { ErrorMessageSchema } from '../error-message.schema';
|
|
4
|
+
import { MoneySchema } from '../money.schema';
|
|
4
5
|
|
|
5
6
|
export const PriceCorrectionAnalyzeItemSchema = z.object({
|
|
6
7
|
orderProductUUID: z.string(),
|
|
@@ -20,17 +21,18 @@ export const PriceCorrectionAnalyzeItemSchema = z.object({
|
|
|
20
21
|
article: z.string().nullable(),
|
|
21
22
|
color: z.string().nullable(),
|
|
22
23
|
|
|
23
|
-
currentPrice:
|
|
24
|
-
currentAmount:
|
|
24
|
+
currentPrice: MoneySchema,
|
|
25
|
+
currentAmount: MoneySchema,
|
|
25
26
|
quantity: z.number(),
|
|
26
27
|
|
|
27
|
-
newPriceWithoutDiscount:
|
|
28
|
-
newPriceWithDiscount:
|
|
29
|
-
newAmountWithoutDiscount:
|
|
30
|
-
newAmountWithDiscount:
|
|
28
|
+
newPriceWithoutDiscount: MoneySchema,
|
|
29
|
+
newPriceWithDiscount: MoneySchema,
|
|
30
|
+
newAmountWithoutDiscount: MoneySchema,
|
|
31
|
+
newAmountWithDiscount: MoneySchema,
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
// Разницы могут быть отрицательными — цена корректируется в обе стороны, поэтому без ограничения знака.
|
|
34
|
+
priceDifferenceWithoutDiscount: MoneySchema,
|
|
35
|
+
priceDifferenceWithDiscount: MoneySchema,
|
|
34
36
|
|
|
35
37
|
isSkipped: z.boolean(),
|
|
36
38
|
skipReason: ErrorMessageSchema.optional(),
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ErrorMessageSchema } from '../error-message.schema';
|
|
3
|
+
import { MoneySchema } from '../money.schema';
|
|
3
4
|
|
|
4
5
|
export const PriceCorrectionExecuteResultItemSchema = z.object({
|
|
5
6
|
orderProductUUID: z.string(),
|
|
6
7
|
orderUUID: z.string(),
|
|
7
8
|
isSuccess: z.boolean(),
|
|
8
9
|
error: ErrorMessageSchema.optional(),
|
|
9
|
-
oldPrice:
|
|
10
|
-
newPrice:
|
|
10
|
+
oldPrice: MoneySchema.optional(),
|
|
11
|
+
newPrice: MoneySchema.optional(),
|
|
11
12
|
});
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ServicePricingUnitEnum } from '../../enum/service-pricing-unit.enum';
|
|
3
|
+
import { MoneySchema } from '../money.schema';
|
|
4
|
+
import { NonNegativeMoneySchema } from '../non-negative-money.schema';
|
|
5
|
+
|
|
6
|
+
// Цена строки услуги: неотрицательная и не больше миллиарда. Знак берём из самой строки,
|
|
7
|
+
// потолок — из разобранного значения: до 1e9 с двумя знаками число представимо точно.
|
|
8
|
+
const OrderServiceLinePriceSchema = NonNegativeMoneySchema.refine(value => Number(value) <= 1_000_000_000, {
|
|
9
|
+
message: 'validation.money.max',
|
|
10
|
+
});
|
|
3
11
|
|
|
4
12
|
export const OrderServiceLineSchema = z.object({
|
|
5
13
|
uuid: z.uuid(),
|
|
6
14
|
orderUUID: z.uuid(),
|
|
7
15
|
serviceUUID: z.uuid().nullable(),
|
|
8
16
|
name: z.string(),
|
|
9
|
-
price:
|
|
17
|
+
price: MoneySchema,
|
|
10
18
|
quantity: z.number(),
|
|
11
|
-
amount:
|
|
19
|
+
amount: MoneySchema,
|
|
12
20
|
vat: z.number().nullable(),
|
|
13
|
-
vatAmount:
|
|
21
|
+
vatAmount: MoneySchema,
|
|
14
22
|
unit: z.nativeEnum(ServicePricingUnitEnum),
|
|
15
23
|
comment: z.string().nullable(),
|
|
16
24
|
createdAt: z.date(),
|
|
@@ -22,7 +30,7 @@ export const CreateOrderServiceLineRequestSchema = z
|
|
|
22
30
|
orderUUID: z.uuid(),
|
|
23
31
|
serviceUUID: z.uuid().optional(),
|
|
24
32
|
name: z.string().min(1).max(255).optional(),
|
|
25
|
-
price:
|
|
33
|
+
price: OrderServiceLinePriceSchema.optional(),
|
|
26
34
|
quantity: z.number().int().min(1).max(1_000_000).optional().default(1),
|
|
27
35
|
vat: z.number().int().min(0).max(100).optional(),
|
|
28
36
|
comment: z.string().max(1000).optional(),
|
|
@@ -32,7 +40,7 @@ export const CreateOrderServiceLineRequestSchema = z
|
|
|
32
40
|
});
|
|
33
41
|
|
|
34
42
|
export const UpdateOrderServiceLineRequestSchema = z.object({
|
|
35
|
-
price:
|
|
43
|
+
price: OrderServiceLinePriceSchema.optional(),
|
|
36
44
|
quantity: z.number().int().min(1).max(1_000_000).optional(),
|
|
37
45
|
comment: z.string().max(1000).nullable().optional(),
|
|
38
46
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { PaymentInvoiceStatusEnum } from '../../enum/payment-invoice-status.enum';
|
|
3
|
+
import { MoneySchema } from '../money.schema';
|
|
3
4
|
|
|
4
5
|
// Строка счёта. Для счёта, собранного из заказов, каждая строка — снимок заказа на момент
|
|
5
6
|
// выставления: заказ потом может измениться, а выставленный счёт обязан остаться прежним.
|
|
@@ -8,16 +9,16 @@ const PaymentInvoiceItemSchema = z.object({
|
|
|
8
9
|
orderId: z.number().nullable(),
|
|
9
10
|
orderDate: z.coerce.date().nullable(),
|
|
10
11
|
description: z.string(),
|
|
11
|
-
amount:
|
|
12
|
+
amount: MoneySchema,
|
|
12
13
|
});
|
|
13
14
|
|
|
14
15
|
export const PaymentInvoiceSchema = z.object({
|
|
15
16
|
uuid: z.string(),
|
|
16
17
|
number: z.string(),
|
|
17
18
|
invoiceDate: z.coerce.date(),
|
|
18
|
-
amount:
|
|
19
|
-
paidAmount:
|
|
20
|
-
remainingAmount:
|
|
19
|
+
amount: MoneySchema,
|
|
20
|
+
paidAmount: MoneySchema,
|
|
21
|
+
remainingAmount: MoneySchema,
|
|
21
22
|
status: z.nativeEnum(PaymentInvoiceStatusEnum),
|
|
22
23
|
clientUUID: z.string(),
|
|
23
24
|
clientName: z.string(),
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MoneySchema } from './money.schema';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Денежная величина строго больше нуля: сумма платежа, фиксированная скидка.
|
|
5
|
+
*
|
|
6
|
+
* Отличается от `NonNegativeMoneySchema` тем, что отвергает ноль — платёж на 0 рублей или скидка
|
|
7
|
+
* в 0 рублей это не операция, а ошибка ввода.
|
|
8
|
+
*
|
|
9
|
+
* Обе проверки строковые: знак берётся по первому символу, а ноль опознаётся по форме записи —
|
|
10
|
+
* `MoneySchema` уже гарантировал формат `^-?\d+(\.\d{1,2})?$`, поэтому нулю соответствуют ровно
|
|
11
|
+
* `0`, `0.0` и `0.00`. Через `Number()` это не проверяется намеренно: приводить деньги к float
|
|
12
|
+
* ради сравнения — то, от чего ушли.
|
|
13
|
+
*/
|
|
14
|
+
export const PositiveMoneySchema = MoneySchema.refine(value => !value.startsWith('-') && !/^0+(\.0*)?$/.test(value), {
|
|
15
|
+
message: 'validation.money.positive',
|
|
16
|
+
});
|
|
@@ -3,6 +3,7 @@ import { PreOrderStatusEnum } from '../../enum';
|
|
|
3
3
|
import { ClientSchema } from '../client';
|
|
4
4
|
import { BranchSchema } from '../branch/branch.schema';
|
|
5
5
|
import { PreOrderCollectionSchema } from '../pre-order-collection/pre-order-collection.schema';
|
|
6
|
+
import { MoneySchema } from '../money.schema';
|
|
6
7
|
|
|
7
8
|
export const PreOrderSchema = z.object({
|
|
8
9
|
uuid: z.string(),
|
|
@@ -21,7 +22,7 @@ export const PreOrderExtendedSchema = PreOrderSchema.extend({
|
|
|
21
22
|
preOrderCollection: PreOrderCollectionSchema.nullable(),
|
|
22
23
|
totalPositions: z.number(),
|
|
23
24
|
totalQuantity: z.number(),
|
|
24
|
-
totalPrice:
|
|
25
|
+
totalPrice: MoneySchema,
|
|
25
26
|
});
|
|
26
27
|
|
|
27
28
|
export const PreOrderWithClientSchema = PreOrderSchema.extend({
|
package/schemas/pre-order-collection-item/pre-order-collection-item-multiplicity-option.schema.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { MoneySchema } from '../money.schema';
|
|
3
|
+
import { NonNegativeMoneySchema } from '../non-negative-money.schema';
|
|
2
4
|
|
|
3
5
|
export const PreOrderCollectionItemMultiplicityOptionSchema = z.object({
|
|
4
6
|
uuid: z.string(),
|
|
5
7
|
title: z.string().max(100).nullable(),
|
|
6
8
|
optionMultiplicity: z.number().int().min(1),
|
|
7
|
-
optionPrice:
|
|
9
|
+
optionPrice: NonNegativeMoneySchema.nullable(),
|
|
8
10
|
rank: z.number().int().min(0),
|
|
9
11
|
});
|
|
@@ -6,6 +6,7 @@ import { ClientSchema } from '../client';
|
|
|
6
6
|
import { PreOrderProductSchema } from '../pre-order-product/pre-order-product.schema';
|
|
7
7
|
import { SalesUnitEnum } from '../../enum';
|
|
8
8
|
import { PreOrderCollectionItemMultiplicityOptionSchema } from './pre-order-collection-item-multiplicity-option.schema';
|
|
9
|
+
import { MoneySchema } from '../money.schema';
|
|
9
10
|
|
|
10
11
|
export const PreOrderCollectionItemSchema = z.object({
|
|
11
12
|
uuid: z.string(),
|
|
@@ -18,7 +19,7 @@ export const PreOrderCollectionItemSchema = z.object({
|
|
|
18
19
|
quantity: z.number().nullable(),
|
|
19
20
|
balance: z.number().nullable(),
|
|
20
21
|
imageUUID: z.string().nullable(),
|
|
21
|
-
price:
|
|
22
|
+
price: MoneySchema,
|
|
22
23
|
advancedPrice: z.string().nullable(),
|
|
23
24
|
grower: z.string().nullable(),
|
|
24
25
|
size: z.string().nullable(),
|
|
@@ -47,7 +48,7 @@ export const CreatePreOrderCollectionItemSchema = z.object({
|
|
|
47
48
|
quantity: z.coerce.number().nullable().optional(),
|
|
48
49
|
balance: z.coerce.number().nullable().optional(),
|
|
49
50
|
imageUUID: z.string().nullable().optional(),
|
|
50
|
-
price:
|
|
51
|
+
price: MoneySchema,
|
|
51
52
|
advancedPrice: z.string().nullable().optional(),
|
|
52
53
|
grower: z.string().nullable().optional(),
|
|
53
54
|
size: z.string().nullable().optional(),
|
|
@@ -76,7 +77,7 @@ export const UpdatePreOrderCollectionItemSchema = z
|
|
|
76
77
|
quantity: z.coerce.number().nullable(),
|
|
77
78
|
balance: z.coerce.number().nullable(),
|
|
78
79
|
imageUUID: z.string().nullable(),
|
|
79
|
-
price:
|
|
80
|
+
price: MoneySchema,
|
|
80
81
|
advancedPrice: z.string().nullable(),
|
|
81
82
|
grower: z.string().nullable(),
|
|
82
83
|
size: z.string().nullable(),
|
|
@@ -2,6 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { PreOrderCollectionItemExtendedSchema } from '../pre-order-collection-item/pre-order-collection-item.schema';
|
|
3
3
|
import { CategorySchema } from '../category/category.schema';
|
|
4
4
|
import { PreOrderCollectionItemMultiplicityOptionSchema } from '../pre-order-collection-item/pre-order-collection-item-multiplicity-option.schema';
|
|
5
|
+
import { MoneySchema } from '../money.schema';
|
|
5
6
|
|
|
6
7
|
export const MatchingConfigSchema = z.object({
|
|
7
8
|
matchByName: z.coerce.boolean(),
|
|
@@ -22,13 +23,13 @@ export const PreOrderProductSchema = z.object({
|
|
|
22
23
|
tag: z.string().nullable(),
|
|
23
24
|
isPurchased: z.boolean(),
|
|
24
25
|
isReplaceable: z.boolean(),
|
|
25
|
-
stopPrice:
|
|
26
|
+
stopPrice: MoneySchema.nullable(),
|
|
26
27
|
highAttention: z.boolean(),
|
|
27
28
|
categoryUUID: z.string().nullable(),
|
|
28
29
|
name: z.string().nullable(),
|
|
29
30
|
grower: z.string().nullable(),
|
|
30
31
|
size: z.string().nullable(),
|
|
31
|
-
price:
|
|
32
|
+
price: MoneySchema.nullable(),
|
|
32
33
|
color: z.string().nullable(),
|
|
33
34
|
parentPreOrderProductUUID: z.string().nullable(),
|
|
34
35
|
matchingConfig: MatchingConfigSchema.optional().nullable(),
|
|
@@ -47,7 +48,7 @@ export const CreatePreOrderProductSchema = PreOrderProductSchema.omit({ uuid: tr
|
|
|
47
48
|
name: z.string().nullable().optional(),
|
|
48
49
|
grower: z.string().nullable().optional(),
|
|
49
50
|
size: z.string().nullable().optional(),
|
|
50
|
-
price:
|
|
51
|
+
price: MoneySchema.nullable().optional(),
|
|
51
52
|
color: z.string().nullable().optional(),
|
|
52
53
|
parentPreOrderProductUUID: z.string().nullable().optional(),
|
|
53
54
|
matchingConfig: MatchingConfigSchema.optional().nullable(),
|
|
@@ -63,7 +64,7 @@ export const UpdatePreOrderProductSchema = PreOrderProductSchema.omit({
|
|
|
63
64
|
name: z.string().nullable().optional(),
|
|
64
65
|
grower: z.string().nullable().optional(),
|
|
65
66
|
size: z.string().nullable().optional(),
|
|
66
|
-
price:
|
|
67
|
+
price: MoneySchema.nullable().optional(),
|
|
67
68
|
color: z.string().nullable().optional(),
|
|
68
69
|
parentPreOrderProductUUID: z.string().nullable().optional(),
|
|
69
70
|
matchingConfig: MatchingConfigSchema.optional().nullable(),
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { MoneySchema } from '../money.schema';
|
|
2
3
|
|
|
3
4
|
export const ProductMultiplicityOptionSchema = z.object({
|
|
4
5
|
uuid: z.uuid(),
|
|
5
6
|
title: z.string().nullable(),
|
|
6
7
|
optionMultiplicity: z.number(),
|
|
7
|
-
optionPrice:
|
|
8
|
+
optionPrice: MoneySchema.nullable(),
|
|
8
9
|
rank: z.number(),
|
|
9
10
|
});
|
|
@@ -6,6 +6,7 @@ import { ConsignmentSchema } from '../consignment/consignment.schema';
|
|
|
6
6
|
import { DiscountRulesTypeEnum, ProductMarkEnum, SalesUnitEnum } from '../../enum';
|
|
7
7
|
import { discountRulesModeSchema } from '../discount-rules/discount-rules.schema';
|
|
8
8
|
import { ProductMultiplicityOptionSchema } from '../..';
|
|
9
|
+
import { MoneySchema } from '../money.schema';
|
|
9
10
|
|
|
10
11
|
export const ProductSchema = z.object({
|
|
11
12
|
uuid: z.uuid(),
|
|
@@ -15,8 +16,8 @@ export const ProductSchema = z.object({
|
|
|
15
16
|
|
|
16
17
|
balance: z.number(),
|
|
17
18
|
quantity: z.number(),
|
|
18
|
-
price:
|
|
19
|
-
costPrice:
|
|
19
|
+
price: MoneySchema,
|
|
20
|
+
costPrice: MoneySchema,
|
|
20
21
|
multiplicity: z.number(),
|
|
21
22
|
isOpen: z.boolean(),
|
|
22
23
|
|
|
@@ -27,7 +28,7 @@ export const ProductSchema = z.object({
|
|
|
27
28
|
size: z.string().nullable(),
|
|
28
29
|
size2: z.string().nullable(),
|
|
29
30
|
size3: z.string().nullable(),
|
|
30
|
-
invoicePrice:
|
|
31
|
+
invoicePrice: MoneySchema.nullable(),
|
|
31
32
|
invoiceNumber: z.string().nullable(),
|
|
32
33
|
imageUUID: z.string().nullable(),
|
|
33
34
|
country: z.string().nullable(),
|
|
@@ -56,7 +57,7 @@ export const ProductForClientSchema = z.object({
|
|
|
56
57
|
uuid: z.uuid(),
|
|
57
58
|
name: z.string(),
|
|
58
59
|
balance: z.number(),
|
|
59
|
-
price:
|
|
60
|
+
price: MoneySchema,
|
|
60
61
|
multiplicity: z.number(),
|
|
61
62
|
article: z.string().nullable(),
|
|
62
63
|
barcode: z.string().nullable(),
|
|
@@ -101,7 +102,7 @@ export const ProductExtendedForClientSchema = ProductForClientSchema.merge(
|
|
|
101
102
|
discountRulesUUID: z.string(),
|
|
102
103
|
type: z.nativeEnum(DiscountRulesTypeEnum),
|
|
103
104
|
discountValueData: discountRulesModeSchema,
|
|
104
|
-
priceWithDiscount:
|
|
105
|
+
priceWithDiscount: MoneySchema,
|
|
105
106
|
multipleQuantity: z.number().optional(),
|
|
106
107
|
})
|
|
107
108
|
.array()
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { MoneySchema } from '../money.schema';
|
|
2
3
|
|
|
3
4
|
export const ClientByWeeksSchema = z.object({
|
|
4
5
|
weekStart: z.coerce.date(),
|
|
@@ -8,5 +9,5 @@ export const ClientByWeeksSchema = z.object({
|
|
|
8
9
|
clientGroup: z.string().nullable(),
|
|
9
10
|
hasOrders: z.boolean(),
|
|
10
11
|
ordersCount: z.number(),
|
|
11
|
-
totalAmount:
|
|
12
|
+
totalAmount: MoneySchema,
|
|
12
13
|
});
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ClientStatementTypeEnum, TransactionTypeEnum } from '../../enum';
|
|
3
|
+
import { MoneySchema } from '../money.schema';
|
|
3
4
|
|
|
4
5
|
export const ClientStatementItemSchema = z.object({
|
|
5
6
|
date: z.coerce.date(),
|
|
6
7
|
type: z.nativeEnum(ClientStatementTypeEnum),
|
|
7
|
-
amount:
|
|
8
|
+
amount: MoneySchema,
|
|
8
9
|
description: z.string(),
|
|
9
10
|
documentNumber: z.string().nullable(),
|
|
10
11
|
transactionType: z.nativeEnum(TransactionTypeEnum).nullable(),
|
|
@@ -7,7 +7,7 @@ export const InventoryTurnoverCategoryItemSchema = z.object({
|
|
|
7
7
|
initialBalance: z.number(), // начальный остаток
|
|
8
8
|
receipts: z.number(), // приходы
|
|
9
9
|
sales: z.number(), // продажи
|
|
10
|
-
currentBalance: z.number(), //
|
|
10
|
+
currentBalance: z.number(), // товарный остаток (SUM по product.balance, Int), не деньги
|
|
11
11
|
daysInStock: z.number(), // дни в наличии на складе
|
|
12
12
|
turnoverRate: z.number(), // коэффициент оборачиваемости
|
|
13
13
|
});
|
|
@@ -11,7 +11,7 @@ export const InventoryTurnoverDetailedItemSchema = z.object({
|
|
|
11
11
|
initialBalance: z.number(), // начальный остаток
|
|
12
12
|
receipts: z.number(), // приходы
|
|
13
13
|
sales: z.number(), // продажи
|
|
14
|
-
currentBalance: z.number(), //
|
|
14
|
+
currentBalance: z.number(), // товарный остаток (SUM по product.balance, Int), не деньги
|
|
15
15
|
daysInStock: z.number(), // дни в наличии на складе
|
|
16
16
|
turnoverRate: z.number(), // коэффициент оборачиваемости
|
|
17
17
|
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ReportOrderDateBasisEnum } from '../../enum';
|
|
3
|
+
import { REPORT_EXCLUDE_CLIENT_LIMIT } from '../../constant/report.constant';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Общие фильтры отчётов, построенных на заказах: по какой дате заказ попадает в период и каких
|
|
7
|
+
* клиентов из него выкинуть. Схема одна на все такие отчёты — иначе `sales/summary` и
|
|
8
|
+
* `group-client` на одном экране разошлись бы в семантике при первой же правке.
|
|
9
|
+
*
|
|
10
|
+
* `excludeClientUUID` — типовой случай «отгружаем по себестоимости, в прибыли не учитываем».
|
|
11
|
+
* Принимается и CSV (`?excludeClientUUID=uuid1,uuid2`, как в get-notifications-status), и повтор
|
|
12
|
+
* параметра (`?excludeClientUUID=uuid1&excludeClientUUID=uuid2`) — Express отдаёт второй вариант
|
|
13
|
+
* массивом, и требовать от фронта именно CSV незачем.
|
|
14
|
+
*/
|
|
15
|
+
export const ReportOrderFilterSchema = z.object({
|
|
16
|
+
dateBasis: z
|
|
17
|
+
.nativeEnum(ReportOrderDateBasisEnum)
|
|
18
|
+
.default(ReportOrderDateBasisEnum.CREATED_AT)
|
|
19
|
+
.describe('Which order date puts the order into the period. Defaults to the order creation date.'),
|
|
20
|
+
excludeClientUUID: z
|
|
21
|
+
.union([z.string(), z.array(z.string())])
|
|
22
|
+
.transform(value => (Array.isArray(value) ? value : value.split(',')).map(item => item.trim()).filter(Boolean))
|
|
23
|
+
.pipe(z.array(z.string().uuid()).max(REPORT_EXCLUDE_CLIENT_LIMIT))
|
|
24
|
+
.optional()
|
|
25
|
+
.describe('Clients to drop from the report entirely — their orders, revenue and cost.'),
|
|
26
|
+
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { SalesByClientTopItemSchema } from './sales-by-client-top-item.schema';
|
|
3
|
+
import { MoneySchema } from '../money.schema';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Строка отчёта «продажи по клиентам» — те же данные, что уходят в Excel из `export/sales/clients`.
|
|
@@ -16,18 +17,18 @@ export const SalesByClientRowSchema = z.object({
|
|
|
16
17
|
PACK: z.number(),
|
|
17
18
|
BOX: z.number(),
|
|
18
19
|
}),
|
|
19
|
-
totalSales:
|
|
20
|
-
avgCheck:
|
|
21
|
-
totalWriteOff:
|
|
22
|
-
grossProfit:
|
|
20
|
+
totalSales: MoneySchema,
|
|
21
|
+
avgCheck: MoneySchema,
|
|
22
|
+
totalWriteOff: MoneySchema,
|
|
23
|
+
grossProfit: MoneySchema,
|
|
23
24
|
marginality: z.number(),
|
|
24
25
|
// Оплаты (INCOME) и предоплаты (PREPAYMENT) клиента за период
|
|
25
|
-
totalPayments:
|
|
26
|
-
totalPrepayments:
|
|
26
|
+
totalPayments: MoneySchema,
|
|
27
|
+
totalPrepayments: MoneySchema,
|
|
27
28
|
// Сумма услуг (order_service_line) за период — отдельно, вне товарных sales/margin
|
|
28
|
-
totalServiceAmount:
|
|
29
|
+
totalServiceAmount: MoneySchema,
|
|
29
30
|
// Текущий баланс клиента (на момент формирования отчёта)
|
|
30
|
-
balance:
|
|
31
|
+
balance: MoneySchema,
|
|
31
32
|
lastOrderDate: z.coerce.date().optional(),
|
|
32
33
|
// Топ-5 по сумме выручки за период
|
|
33
34
|
topCategories: z.array(SalesByClientTopItemSchema),
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { MoneySchema } from '../money.schema';
|
|
2
3
|
|
|
3
4
|
/** Элемент топа (категория или товар) внутри строки отчёта «продажи по клиентам». */
|
|
4
5
|
export const SalesByClientTopItemSchema = z.object({
|
|
5
6
|
name: z.string(),
|
|
6
|
-
amount:
|
|
7
|
+
amount: MoneySchema,
|
|
7
8
|
});
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ServicePricingUnitEnum } from '../../enum/service-pricing-unit.enum';
|
|
3
3
|
import { ServiceStatusEnum } from '../../enum/service-status.enum';
|
|
4
|
+
import { MoneySchema } from '../money.schema';
|
|
5
|
+
import { NonNegativeMoneySchema } from '../non-negative-money.schema';
|
|
6
|
+
|
|
7
|
+
// Цена услуги: неотрицательная и не больше миллиарда. Знак берём из самой строки,
|
|
8
|
+
// потолок — из разобранного значения: до 1e9 с двумя знаками число представимо точно.
|
|
9
|
+
const ServicePriceSchema = NonNegativeMoneySchema.refine(value => Number(value) <= 1_000_000_000, { message: 'validation.money.max' });
|
|
4
10
|
|
|
5
11
|
export const ServiceSchema = z.object({
|
|
6
12
|
uuid: z.uuid(),
|
|
7
13
|
name: z.string(),
|
|
8
|
-
price:
|
|
14
|
+
price: MoneySchema,
|
|
9
15
|
vat: z.number().nullable(),
|
|
10
16
|
unit: z.nativeEnum(ServicePricingUnitEnum),
|
|
11
17
|
status: z.nativeEnum(ServiceStatusEnum),
|
|
@@ -15,14 +21,14 @@ export const ServiceSchema = z.object({
|
|
|
15
21
|
|
|
16
22
|
export const CreateServiceRequestSchema = z.object({
|
|
17
23
|
name: z.string().min(1).max(255),
|
|
18
|
-
price:
|
|
24
|
+
price: ServicePriceSchema,
|
|
19
25
|
vat: z.number().int().min(0).max(100).nullable().optional(),
|
|
20
26
|
unit: z.nativeEnum(ServicePricingUnitEnum).optional().default(ServicePricingUnitEnum.FIXED),
|
|
21
27
|
});
|
|
22
28
|
|
|
23
29
|
export const UpdateServiceRequestSchema = z.object({
|
|
24
30
|
name: z.string().min(1).max(255).optional(),
|
|
25
|
-
price:
|
|
31
|
+
price: ServicePriceSchema.optional(),
|
|
26
32
|
vat: z.number().int().min(0).max(100).nullable().optional(),
|
|
27
33
|
unit: z.nativeEnum(ServicePricingUnitEnum).optional(),
|
|
28
34
|
status: z.nativeEnum(ServiceStatusEnum).optional(),
|
|
@@ -2,6 +2,8 @@ import { z } from 'zod';
|
|
|
2
2
|
import { ChatHasManagerModeEnum, ChatNoManagerModeEnum, DiscountPriceRoundingEnum, LanguageEnum, WebshopModeEnum } from '../../enum';
|
|
3
3
|
import { WebshopMainDisplayModeEnum } from '../../enum/webshop-main-display-mode.enum';
|
|
4
4
|
import { MenuItemsUrlEnum } from '../../enum/menu-items-url.enum';
|
|
5
|
+
import { MoneySchema } from '../money.schema';
|
|
6
|
+
import { NonNegativeMoneySchema } from '../non-negative-money.schema';
|
|
5
7
|
|
|
6
8
|
export const SettingsWorkingHoursSchema = z.object({
|
|
7
9
|
uuid: z.string(),
|
|
@@ -20,9 +22,12 @@ export const ImportantMessageSchema = z.object({
|
|
|
20
22
|
isActive: z.boolean(),
|
|
21
23
|
});
|
|
22
24
|
|
|
25
|
+
// Обе величины — деньги: `minSubtotal` сравнивается с суммой заказа, `cost` попадает в
|
|
26
|
+
// `order.delivery_cost`. Живут они внутри JSON-колонки, куда ALTER TABLE не достаёт, поэтому
|
|
27
|
+
// точность здесь держит не тип колонки, а формат значения — та же десятичная строка, что и на проводе.
|
|
23
28
|
export const DeliveryPricingTierSchema = z.object({
|
|
24
|
-
minSubtotal:
|
|
25
|
-
cost:
|
|
29
|
+
minSubtotal: NonNegativeMoneySchema,
|
|
30
|
+
cost: NonNegativeMoneySchema,
|
|
26
31
|
});
|
|
27
32
|
|
|
28
33
|
export const SettingsSchema = z.object({
|
|
@@ -3,12 +3,13 @@ import { TransactionTypeEnum } from '../../enum';
|
|
|
3
3
|
import { MoneyAccountSchema } from '../money-account/money-account.schema';
|
|
4
4
|
import { ClientSchema } from '../client';
|
|
5
5
|
import { OrderForClientSchema, OrderSchema } from '../order/order.schema';
|
|
6
|
+
import { MoneySchema } from '../money.schema';
|
|
6
7
|
|
|
7
8
|
export const TransactionSchema = z.object({
|
|
8
9
|
uuid: z.uuid(),
|
|
9
10
|
moneyAccountUUID: z.uuid(),
|
|
10
11
|
|
|
11
|
-
amount:
|
|
12
|
+
amount: MoneySchema,
|
|
12
13
|
comment: z.string(),
|
|
13
14
|
|
|
14
15
|
clientUUID: z.string().nullable(),
|