@floristcloud/api-lib 1.2.109 → 1.2.111
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/commands/client/get-client-calculate.query.js +6 -4
- package/build/commands/consignment/execute-consignment-product-update.command.js +5 -4
- package/build/commands/integration/moysklad/execute-moysklad-import.command.js +3 -2
- package/build/commands/integration/moysklad/preview-moysklad-products.query.js +3 -2
- package/build/commands/integration/moysklad/scan-moysklad-import.query.js +3 -2
- package/build/commands/order/create-order.command.js +2 -1
- package/build/commands/order/update-order.command.js +3 -2
- package/build/commands/order/webshop/get-order-sales-by-month.query.js +2 -1
- package/build/commands/order-product/create-order-product.command.js +2 -1
- package/build/commands/order-product/group/price-valuation-execute.command.js +3 -1
- package/build/commands/order-product/update-order-product.command.js +2 -1
- package/build/commands/payment-invoice/create-payment-invoice.command.js +3 -1
- package/build/commands/payment-invoice/pay-payment-invoice.command.js +3 -1
- package/build/commands/pre-order-collection-item/execute-pre-order-collection-item-update.command.js +3 -2
- package/build/commands/pre-order-collection-item/get-pre-order-collection-item-grouped-list-for-client.query.js +1 -0
- package/build/commands/pre-order-collection-item/get-pre-order-collection-item-list-filter-values-for-client.query.js +2 -0
- package/build/commands/pre-order-collection-item/get-pre-order-collection-item-list-filter-values.query.js +2 -0
- package/build/commands/pre-order-collection-item/get-pre-order-collection-item-list-for-client.query.js +1 -0
- package/build/commands/pre-order-collection-item/get-pre-order-collection-item-list.query.js +1 -0
- package/build/commands/pre-order-collection-item/multiplicity-option/create-pre-order-collection-item-multiplicity-option.command.js +2 -1
- package/build/commands/pre-order-collection-item/multiplicity-option/update-pre-order-collection-item-multiplicity-option.command.js +2 -1
- package/build/commands/product/create-product.command.js +4 -3
- package/build/commands/product/group/update-group-product-prices.command.js +3 -2
- package/build/commands/product/group/update-group-product-update-batch.command.js +4 -3
- package/build/commands/product/multiplicity-option/create-product-multiplicity-option.command.js +2 -1
- package/build/commands/product/multiplicity-option/update-product-multiplicity-option.command.js +2 -1
- package/build/commands/product/update-product.command.js +4 -3
- package/build/commands/report/get-cash-flow.query.js +8 -5
- package/build/commands/report/get-daily-orders-summary.query.js +2 -1
- package/build/commands/report/get-report-for-period.query.js +10 -9
- package/build/commands/report/get-report-group-by-client.query.js +11 -10
- package/build/commands/report/get-report-group-by-position.query.js +15 -14
- package/build/commands/report/get-sales-summary.query.js +13 -11
- package/build/commands/transaction/generate-check-transaction.command.js +2 -1
- package/build/commands/transaction/generate-pre-payment-check.command.js +2 -1
- package/build/commands/transaction/get-sum-transaction-by-money-account.query.js +3 -1
- package/build/commands/transaction/get-transaction-summary.query.js +5 -3
- package/build/commands/write-off/get-write-off-sum-by-order.query.js +3 -1
- package/build/commands/write-off/update-write-off-price.command.js +2 -1
- package/build/schemas/action-log/action-log-money.schema.js +28 -0
- package/build/schemas/action-log/index.js +1 -0
- package/build/schemas/action-log/order-info.schema.js +3 -2
- package/build/schemas/action-log/order-product-info.schema.js +2 -1
- package/build/schemas/action-log/order-product-update-action-log.schema.js +2 -1
- package/build/schemas/action-log/pre-order-product-info.schema.js +2 -1
- package/build/schemas/action-log/pre-order-product-update-action-log.schema.js +2 -1
- package/build/schemas/action-log/transaction-info.schema.js +2 -1
- package/build/schemas/bank-payment/bank-payment.schema.js +2 -1
- package/build/schemas/client/client-debt.schema.js +8 -5
- package/build/schemas/client/client.schema.js +2 -1
- package/build/schemas/consignment/consignment.schema.js +10 -9
- package/build/schemas/consignment-transfer/accept-consignment-transfer.schema.js +3 -1
- package/build/schemas/consignment-transfer/consignment-transfer-request-item.schema.js +2 -1
- package/build/schemas/delivery-route/delivery-route.schema.js +2 -1
- package/build/schemas/discount-rules/discount-rules.schema.js +9 -2
- package/build/schemas/index.js +3 -0
- package/build/schemas/money-account/money-account-with-balance.schema.js +2 -2
- package/build/schemas/money.schema.js +27 -0
- package/build/schemas/non-negative-money.schema.js +17 -0
- package/build/schemas/order/order.schema.js +10 -9
- package/build/schemas/order-product/order-product-multiplicity-optiom.schema.js +2 -1
- package/build/schemas/order-product/order-product.schema.js +5 -4
- package/build/schemas/order-product/price-correction-analyze-item.schema.js +10 -8
- package/build/schemas/order-product/price-correction-execute-result-item.schema.js +3 -2
- package/build/schemas/order-service-line/order-service-line.schema.js +12 -5
- package/build/schemas/payment-invoice/payment-invoice.schema.js +5 -4
- package/build/schemas/positive-money.schema.js +18 -0
- package/build/schemas/pre-order/pre-order.schema.js +2 -1
- package/build/schemas/pre-order-collection-item/pre-order-collection-item-multiplicity-option.schema.js +2 -1
- package/build/schemas/pre-order-collection-item/pre-order-collection-item.schema.js +4 -3
- package/build/schemas/pre-order-product/pre-order-product.schema.js +5 -4
- package/build/schemas/product/product-multiplicity-option.schema.js +2 -1
- package/build/schemas/product/product.schema.js +6 -5
- package/build/schemas/report/client-by-weeks.schema.js +2 -1
- package/build/schemas/report/client-statement.schema.js +2 -1
- package/build/schemas/report/inventory-turnover-category-item.schema.js +1 -1
- package/build/schemas/report/inventory-turnover-detailed-item.schema.js +1 -1
- package/build/schemas/report/sales-by-client-row.schema.js +9 -8
- package/build/schemas/report/sales-by-client-top-item.schema.js +2 -1
- package/build/schemas/service/service.schema.js +8 -3
- package/build/schemas/settings/settings.schema.js +6 -2
- package/build/schemas/transaction/transaction.schema.js +2 -1
- package/commands/client/get-client-calculate.query.ts +6 -4
- package/commands/consignment/execute-consignment-product-update.command.ts +5 -4
- package/commands/integration/moysklad/execute-moysklad-import.command.ts +3 -2
- package/commands/integration/moysklad/preview-moysklad-products.query.ts +3 -2
- package/commands/integration/moysklad/scan-moysklad-import.query.ts +3 -2
- package/commands/order/create-order.command.ts +2 -1
- package/commands/order/update-order.command.ts +3 -2
- package/commands/order/webshop/get-order-sales-by-month.query.ts +3 -1
- package/commands/order-product/create-order-product.command.ts +2 -1
- package/commands/order-product/group/price-valuation-execute.command.ts +4 -1
- package/commands/order-product/update-order-product.command.ts +2 -1
- package/commands/payment-invoice/create-payment-invoice.command.ts +4 -1
- package/commands/payment-invoice/pay-payment-invoice.command.ts +4 -1
- package/commands/pre-order-collection-item/execute-pre-order-collection-item-update.command.ts +3 -2
- package/commands/pre-order-collection-item/get-pre-order-collection-item-grouped-list-for-client.query.ts +1 -0
- package/commands/pre-order-collection-item/get-pre-order-collection-item-list-filter-values-for-client.query.ts +2 -0
- package/commands/pre-order-collection-item/get-pre-order-collection-item-list-filter-values.query.ts +2 -0
- package/commands/pre-order-collection-item/get-pre-order-collection-item-list-for-client.query.ts +1 -0
- package/commands/pre-order-collection-item/get-pre-order-collection-item-list.query.ts +1 -0
- package/commands/pre-order-collection-item/multiplicity-option/create-pre-order-collection-item-multiplicity-option.command.ts +2 -1
- package/commands/pre-order-collection-item/multiplicity-option/update-pre-order-collection-item-multiplicity-option.command.ts +2 -1
- package/commands/product/create-product.command.ts +4 -3
- package/commands/product/group/update-group-product-prices.command.ts +3 -2
- package/commands/product/group/update-group-product-update-batch.command.ts +4 -3
- package/commands/product/multiplicity-option/create-product-multiplicity-option.command.ts +2 -1
- package/commands/product/multiplicity-option/update-product-multiplicity-option.command.ts +2 -1
- package/commands/product/update-product.command.ts +4 -3
- package/commands/report/get-cash-flow.query.ts +8 -5
- package/commands/report/get-daily-orders-summary.query.ts +2 -1
- package/commands/report/get-report-for-period.query.ts +10 -9
- package/commands/report/get-report-group-by-client.query.ts +11 -10
- package/commands/report/get-report-group-by-position.query.ts +15 -14
- package/commands/report/get-sales-summary.query.ts +13 -11
- package/commands/transaction/generate-check-transaction.command.ts +2 -1
- package/commands/transaction/generate-pre-payment-check.command.ts +2 -1
- package/commands/transaction/get-sum-transaction-by-money-account.query.ts +3 -1
- package/commands/transaction/get-transaction-summary.query.ts +5 -3
- package/commands/write-off/get-write-off-sum-by-order.query.ts +4 -1
- package/commands/write-off/update-write-off-price.command.ts +2 -1
- package/package.json +1 -1
- package/schemas/action-log/action-log-money.schema.ts +26 -0
- package/schemas/action-log/index.ts +1 -0
- package/schemas/action-log/order-info.schema.ts +3 -2
- package/schemas/action-log/order-product-info.schema.ts +2 -1
- package/schemas/action-log/order-product-update-action-log.schema.ts +2 -1
- package/schemas/action-log/pre-order-product-info.schema.ts +2 -1
- package/schemas/action-log/pre-order-product-update-action-log.schema.ts +2 -1
- package/schemas/action-log/transaction-info.schema.ts +2 -1
- package/schemas/bank-payment/bank-payment.schema.ts +2 -1
- package/schemas/client/client-debt.schema.ts +8 -5
- package/schemas/client/client.schema.ts +2 -1
- package/schemas/consignment/consignment.schema.ts +10 -9
- package/schemas/consignment-transfer/accept-consignment-transfer.schema.ts +4 -1
- package/schemas/consignment-transfer/consignment-transfer-request-item.schema.ts +2 -1
- package/schemas/delivery-route/delivery-route.schema.ts +2 -1
- package/schemas/discount-rules/discount-rules.schema.ts +9 -2
- package/schemas/index.ts +3 -0
- package/schemas/money-account/money-account-with-balance.schema.ts +2 -1
- package/schemas/money.schema.ts +25 -0
- package/schemas/non-negative-money.schema.ts +15 -0
- package/schemas/order/order.schema.ts +10 -9
- package/schemas/order-product/order-product-multiplicity-optiom.schema.ts +2 -1
- package/schemas/order-product/order-product.schema.ts +5 -4
- package/schemas/order-product/price-correction-analyze-item.schema.ts +10 -8
- package/schemas/order-product/price-correction-execute-result-item.schema.ts +3 -2
- package/schemas/order-service-line/order-service-line.schema.ts +13 -5
- package/schemas/payment-invoice/payment-invoice.schema.ts +5 -4
- package/schemas/positive-money.schema.ts +16 -0
- package/schemas/pre-order/pre-order.schema.ts +2 -1
- package/schemas/pre-order-collection-item/pre-order-collection-item-multiplicity-option.schema.ts +3 -1
- package/schemas/pre-order-collection-item/pre-order-collection-item.schema.ts +4 -3
- package/schemas/pre-order-product/pre-order-product.schema.ts +5 -4
- package/schemas/product/product-multiplicity-option.schema.ts +2 -1
- package/schemas/product/product.schema.ts +6 -5
- package/schemas/report/client-by-weeks.schema.ts +2 -1
- package/schemas/report/client-statement.schema.ts +2 -1
- package/schemas/report/inventory-turnover-category-item.schema.ts +1 -1
- package/schemas/report/inventory-turnover-detailed-item.schema.ts +1 -1
- package/schemas/report/sales-by-client-row.schema.ts +9 -8
- package/schemas/report/sales-by-client-top-item.schema.ts +2 -1
- package/schemas/service/service.schema.ts +9 -3
- package/schemas/settings/settings.schema.ts +7 -2
- package/schemas/transaction/transaction.schema.ts +2 -1
|
@@ -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
|
});
|
|
@@ -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(),
|