@floristcloud/api-lib 1.2.109 → 1.2.110

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/build/commands/client/get-client-calculate.query.js +6 -4
  2. package/build/commands/consignment/execute-consignment-product-update.command.js +5 -4
  3. package/build/commands/integration/moysklad/execute-moysklad-import.command.js +3 -2
  4. package/build/commands/integration/moysklad/preview-moysklad-products.query.js +3 -2
  5. package/build/commands/integration/moysklad/scan-moysklad-import.query.js +3 -2
  6. package/build/commands/order/create-order.command.js +2 -1
  7. package/build/commands/order/update-order.command.js +3 -2
  8. package/build/commands/order/webshop/get-order-sales-by-month.query.js +2 -1
  9. package/build/commands/order-product/create-order-product.command.js +2 -1
  10. package/build/commands/order-product/group/price-valuation-execute.command.js +3 -1
  11. package/build/commands/order-product/update-order-product.command.js +2 -1
  12. package/build/commands/payment-invoice/create-payment-invoice.command.js +3 -1
  13. package/build/commands/payment-invoice/pay-payment-invoice.command.js +3 -1
  14. package/build/commands/pre-order-collection-item/execute-pre-order-collection-item-update.command.js +3 -2
  15. package/build/commands/pre-order-collection-item/multiplicity-option/create-pre-order-collection-item-multiplicity-option.command.js +2 -1
  16. package/build/commands/pre-order-collection-item/multiplicity-option/update-pre-order-collection-item-multiplicity-option.command.js +2 -1
  17. package/build/commands/product/create-product.command.js +4 -3
  18. package/build/commands/product/group/update-group-product-prices.command.js +3 -2
  19. package/build/commands/product/group/update-group-product-update-batch.command.js +4 -3
  20. package/build/commands/product/multiplicity-option/create-product-multiplicity-option.command.js +2 -1
  21. package/build/commands/product/multiplicity-option/update-product-multiplicity-option.command.js +2 -1
  22. package/build/commands/product/update-product.command.js +4 -3
  23. package/build/commands/report/get-cash-flow.query.js +8 -5
  24. package/build/commands/report/get-daily-orders-summary.query.js +2 -1
  25. package/build/commands/report/get-report-for-period.query.js +10 -9
  26. package/build/commands/report/get-report-group-by-client.query.js +11 -10
  27. package/build/commands/report/get-report-group-by-position.query.js +15 -14
  28. package/build/commands/report/get-sales-summary.query.js +13 -11
  29. package/build/commands/transaction/generate-check-transaction.command.js +2 -1
  30. package/build/commands/transaction/generate-pre-payment-check.command.js +2 -1
  31. package/build/commands/transaction/get-sum-transaction-by-money-account.query.js +3 -1
  32. package/build/commands/transaction/get-transaction-summary.query.js +5 -3
  33. package/build/commands/write-off/get-write-off-sum-by-order.query.js +3 -1
  34. package/build/commands/write-off/update-write-off-price.command.js +2 -1
  35. package/build/schemas/action-log/action-log-money.schema.js +28 -0
  36. package/build/schemas/action-log/index.js +1 -0
  37. package/build/schemas/action-log/order-info.schema.js +3 -2
  38. package/build/schemas/action-log/order-product-info.schema.js +2 -1
  39. package/build/schemas/action-log/order-product-update-action-log.schema.js +2 -1
  40. package/build/schemas/action-log/pre-order-product-info.schema.js +2 -1
  41. package/build/schemas/action-log/pre-order-product-update-action-log.schema.js +2 -1
  42. package/build/schemas/action-log/transaction-info.schema.js +2 -1
  43. package/build/schemas/bank-payment/bank-payment.schema.js +2 -1
  44. package/build/schemas/client/client-debt.schema.js +8 -5
  45. package/build/schemas/client/client.schema.js +2 -1
  46. package/build/schemas/consignment/consignment.schema.js +10 -9
  47. package/build/schemas/consignment-transfer/accept-consignment-transfer.schema.js +3 -1
  48. package/build/schemas/consignment-transfer/consignment-transfer-request-item.schema.js +2 -1
  49. package/build/schemas/delivery-route/delivery-route.schema.js +2 -1
  50. package/build/schemas/discount-rules/discount-rules.schema.js +9 -2
  51. package/build/schemas/index.js +3 -0
  52. package/build/schemas/money-account/money-account-with-balance.schema.js +2 -2
  53. package/build/schemas/money.schema.js +27 -0
  54. package/build/schemas/non-negative-money.schema.js +17 -0
  55. package/build/schemas/order/order.schema.js +10 -9
  56. package/build/schemas/order-product/order-product-multiplicity-optiom.schema.js +2 -1
  57. package/build/schemas/order-product/order-product.schema.js +5 -4
  58. package/build/schemas/order-product/price-correction-analyze-item.schema.js +10 -8
  59. package/build/schemas/order-product/price-correction-execute-result-item.schema.js +3 -2
  60. package/build/schemas/order-service-line/order-service-line.schema.js +12 -5
  61. package/build/schemas/payment-invoice/payment-invoice.schema.js +5 -4
  62. package/build/schemas/positive-money.schema.js +18 -0
  63. package/build/schemas/pre-order/pre-order.schema.js +2 -1
  64. package/build/schemas/pre-order-collection-item/pre-order-collection-item-multiplicity-option.schema.js +2 -1
  65. package/build/schemas/pre-order-collection-item/pre-order-collection-item.schema.js +4 -3
  66. package/build/schemas/pre-order-product/pre-order-product.schema.js +5 -4
  67. package/build/schemas/product/product-multiplicity-option.schema.js +2 -1
  68. package/build/schemas/product/product.schema.js +6 -5
  69. package/build/schemas/report/client-by-weeks.schema.js +2 -1
  70. package/build/schemas/report/client-statement.schema.js +2 -1
  71. package/build/schemas/report/inventory-turnover-category-item.schema.js +1 -1
  72. package/build/schemas/report/inventory-turnover-detailed-item.schema.js +1 -1
  73. package/build/schemas/report/sales-by-client-row.schema.js +9 -8
  74. package/build/schemas/report/sales-by-client-top-item.schema.js +2 -1
  75. package/build/schemas/service/service.schema.js +8 -3
  76. package/build/schemas/settings/settings.schema.js +6 -2
  77. package/build/schemas/transaction/transaction.schema.js +2 -1
  78. package/commands/client/get-client-calculate.query.ts +6 -4
  79. package/commands/consignment/execute-consignment-product-update.command.ts +5 -4
  80. package/commands/integration/moysklad/execute-moysklad-import.command.ts +3 -2
  81. package/commands/integration/moysklad/preview-moysklad-products.query.ts +3 -2
  82. package/commands/integration/moysklad/scan-moysklad-import.query.ts +3 -2
  83. package/commands/order/create-order.command.ts +2 -1
  84. package/commands/order/update-order.command.ts +3 -2
  85. package/commands/order/webshop/get-order-sales-by-month.query.ts +3 -1
  86. package/commands/order-product/create-order-product.command.ts +2 -1
  87. package/commands/order-product/group/price-valuation-execute.command.ts +4 -1
  88. package/commands/order-product/update-order-product.command.ts +2 -1
  89. package/commands/payment-invoice/create-payment-invoice.command.ts +4 -1
  90. package/commands/payment-invoice/pay-payment-invoice.command.ts +4 -1
  91. package/commands/pre-order-collection-item/execute-pre-order-collection-item-update.command.ts +3 -2
  92. package/commands/pre-order-collection-item/multiplicity-option/create-pre-order-collection-item-multiplicity-option.command.ts +3 -1
  93. package/commands/pre-order-collection-item/multiplicity-option/update-pre-order-collection-item-multiplicity-option.command.ts +3 -1
  94. package/commands/product/create-product.command.ts +4 -3
  95. package/commands/product/group/update-group-product-prices.command.ts +3 -2
  96. package/commands/product/group/update-group-product-update-batch.command.ts +4 -3
  97. package/commands/product/multiplicity-option/create-product-multiplicity-option.command.ts +3 -1
  98. package/commands/product/multiplicity-option/update-product-multiplicity-option.command.ts +3 -1
  99. package/commands/product/update-product.command.ts +4 -3
  100. package/commands/report/get-cash-flow.query.ts +8 -5
  101. package/commands/report/get-daily-orders-summary.query.ts +2 -1
  102. package/commands/report/get-report-for-period.query.ts +10 -9
  103. package/commands/report/get-report-group-by-client.query.ts +11 -10
  104. package/commands/report/get-report-group-by-position.query.ts +15 -14
  105. package/commands/report/get-sales-summary.query.ts +13 -11
  106. package/commands/transaction/generate-check-transaction.command.ts +2 -1
  107. package/commands/transaction/generate-pre-payment-check.command.ts +2 -1
  108. package/commands/transaction/get-sum-transaction-by-money-account.query.ts +3 -1
  109. package/commands/transaction/get-transaction-summary.query.ts +5 -3
  110. package/commands/write-off/get-write-off-sum-by-order.query.ts +4 -1
  111. package/commands/write-off/update-write-off-price.command.ts +2 -1
  112. package/package.json +1 -1
  113. package/schemas/action-log/action-log-money.schema.ts +26 -0
  114. package/schemas/action-log/index.ts +1 -0
  115. package/schemas/action-log/order-info.schema.ts +3 -2
  116. package/schemas/action-log/order-product-info.schema.ts +2 -1
  117. package/schemas/action-log/order-product-update-action-log.schema.ts +2 -1
  118. package/schemas/action-log/pre-order-product-info.schema.ts +2 -1
  119. package/schemas/action-log/pre-order-product-update-action-log.schema.ts +2 -1
  120. package/schemas/action-log/transaction-info.schema.ts +2 -1
  121. package/schemas/bank-payment/bank-payment.schema.ts +2 -1
  122. package/schemas/client/client-debt.schema.ts +8 -5
  123. package/schemas/client/client.schema.ts +2 -1
  124. package/schemas/consignment/consignment.schema.ts +10 -9
  125. package/schemas/consignment-transfer/accept-consignment-transfer.schema.ts +4 -1
  126. package/schemas/consignment-transfer/consignment-transfer-request-item.schema.ts +2 -1
  127. package/schemas/delivery-route/delivery-route.schema.ts +2 -1
  128. package/schemas/discount-rules/discount-rules.schema.ts +9 -2
  129. package/schemas/index.ts +3 -0
  130. package/schemas/money-account/money-account-with-balance.schema.ts +2 -1
  131. package/schemas/money.schema.ts +25 -0
  132. package/schemas/non-negative-money.schema.ts +15 -0
  133. package/schemas/order/order.schema.ts +10 -9
  134. package/schemas/order-product/order-product-multiplicity-optiom.schema.ts +2 -1
  135. package/schemas/order-product/order-product.schema.ts +5 -4
  136. package/schemas/order-product/price-correction-analyze-item.schema.ts +10 -8
  137. package/schemas/order-product/price-correction-execute-result-item.schema.ts +3 -2
  138. package/schemas/order-service-line/order-service-line.schema.ts +13 -5
  139. package/schemas/payment-invoice/payment-invoice.schema.ts +5 -4
  140. package/schemas/positive-money.schema.ts +16 -0
  141. package/schemas/pre-order/pre-order.schema.ts +2 -1
  142. package/schemas/pre-order-collection-item/pre-order-collection-item-multiplicity-option.schema.ts +3 -1
  143. package/schemas/pre-order-collection-item/pre-order-collection-item.schema.ts +4 -3
  144. package/schemas/pre-order-product/pre-order-product.schema.ts +5 -4
  145. package/schemas/product/product-multiplicity-option.schema.ts +2 -1
  146. package/schemas/product/product.schema.ts +6 -5
  147. package/schemas/report/client-by-weeks.schema.ts +2 -1
  148. package/schemas/report/client-statement.schema.ts +2 -1
  149. package/schemas/report/inventory-turnover-category-item.schema.ts +1 -1
  150. package/schemas/report/inventory-turnover-detailed-item.schema.ts +1 -1
  151. package/schemas/report/sales-by-client-row.schema.ts +9 -8
  152. package/schemas/report/sales-by-client-top-item.schema.ts +2 -1
  153. package/schemas/service/service.schema.ts +9 -3
  154. package/schemas/settings/settings.schema.ts +7 -2
  155. package/schemas/transaction/transaction.schema.ts +2 -1
@@ -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: z.number().nullable(),
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: z.number().nullable(),
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: z.number().nullable().optional(),
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: z.number().nullable().optional(),
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: z.number().nullable(),
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: z.number(),
19
- costPrice: z.number(),
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: z.number().nullable(),
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: z.number(),
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: z.number(),
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: z.number(),
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: z.coerce.number(),
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: z.number(),
20
- avgCheck: z.number(),
21
- totalWriteOff: z.number(),
22
- grossProfit: z.number(),
20
+ totalSales: MoneySchema,
21
+ avgCheck: MoneySchema,
22
+ totalWriteOff: MoneySchema,
23
+ grossProfit: MoneySchema,
23
24
  marginality: z.number(),
24
25
  // Оплаты (INCOME) и предоплаты (PREPAYMENT) клиента за период
25
- totalPayments: z.number(),
26
- totalPrepayments: z.number(),
26
+ totalPayments: MoneySchema,
27
+ totalPrepayments: MoneySchema,
27
28
  // Сумма услуг (order_service_line) за период — отдельно, вне товарных sales/margin
28
- totalServiceAmount: z.number(),
29
+ totalServiceAmount: MoneySchema,
29
30
  // Текущий баланс клиента (на момент формирования отчёта)
30
- balance: z.number(),
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: z.number(),
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: z.number(),
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: z.number().min(0).max(1_000_000_000),
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: z.number().min(0).max(1_000_000_000).optional(),
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: z.number().nonnegative(),
25
- cost: z.number().nonnegative(),
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: z.number(),
12
+ amount: MoneySchema,
12
13
  comment: z.string(),
13
14
 
14
15
  clientUUID: z.string().nullable(),