@floristcloud/api-lib 1.2.167 → 1.2.169
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/index.js +2 -0
- package/build/commands/client/profile/create-client-legal-profile.command.js +4 -15
- package/build/commands/client/profile/delete-client-legal-profile.command.js +4 -11
- package/build/commands/client/profile/get-client-legal-profile-list.query.js +10 -0
- package/build/commands/client/profile/index.js +1 -0
- package/build/commands/client/profile/update-client-legal-profile.command.js +4 -15
- package/build/commands/client/webshop/create-client-legal-profile-for-client.command.js +10 -0
- package/build/commands/client/webshop/update-client-legal-profile-for-client.command.js +10 -0
- package/build/commands/payment-invoice/create-payment-invoice.command.js +4 -29
- package/build/constant/discount-rules-pricing-type-list.constant.js +14 -0
- package/build/constant/error.js +17 -0
- package/build/constant/index.js +1 -0
- package/build/enum/discount-rules-mode-type.enum.js +2 -4
- package/build/enum/discount-rules-type.enum.js +1 -0
- package/build/schemas/client/client-extended-for-client.schema.js +2 -2
- package/build/schemas/client/client-extended.schema.js +2 -0
- package/build/schemas/client/client-legal-profile-for-client-response.schema.js +9 -0
- package/build/schemas/client/client-legal-profile-for-client.schema.js +27 -0
- package/build/schemas/client/client-legal-profile-requisites.schema.js +15 -0
- package/build/schemas/client/client-legal-profile.schema.js +3 -0
- package/build/schemas/client/create-client-legal-profile-request.schema.js +10 -0
- package/build/schemas/client/create-client-legal-profile-response.schema.js +9 -0
- package/build/schemas/client/delete-client-legal-profile-request.schema.js +5 -0
- package/build/schemas/client/delete-client-legal-profile-response.schema.js +9 -0
- package/build/schemas/client/delete-client-legal-profile-result.schema.js +9 -0
- package/build/schemas/client/get-client-legal-profile-list-request.schema.js +5 -0
- package/build/schemas/client/get-client-legal-profile-list-response.schema.js +9 -0
- package/build/schemas/client/index.js +12 -0
- package/build/schemas/client/update-client-legal-profile-request.schema.js +13 -0
- package/build/schemas/client/update-client-legal-profile-response.schema.js +9 -0
- package/build/schemas/discount-rules/discount-rules.schema.js +25 -11
- package/build/schemas/discount-rules/product-discount-price-data.schema.js +9 -0
- package/build/schemas/discount-rules/product-discount-price-multiplicity-option.schema.js +2 -0
- package/build/schemas/index.js +2 -0
- package/build/schemas/order-product/price-correction-analyze-item.schema.js +6 -0
- package/build/schemas/payment-invoice/create-payment-invoice-request.schema.js +27 -0
- package/build/schemas/payment-invoice/create-payment-invoice-response.schema.js +9 -0
- package/build/schemas/payment-invoice/payment-invoice.schema.js +2 -0
- package/commands/client/index.ts +2 -0
- package/commands/client/profile/create-client-legal-profile.command.ts +3 -15
- package/commands/client/profile/delete-client-legal-profile.command.ts +3 -12
- package/commands/client/profile/get-client-legal-profile-list.query.ts +11 -0
- package/commands/client/profile/index.ts +1 -0
- package/commands/client/profile/update-client-legal-profile.command.ts +3 -15
- package/commands/client/webshop/create-client-legal-profile-for-client.command.ts +11 -0
- package/commands/client/webshop/update-client-legal-profile-for-client.command.ts +11 -0
- package/commands/payment-invoice/create-payment-invoice.command.ts +3 -31
- package/constant/discount-rules-pricing-type-list.constant.ts +12 -0
- package/constant/error.ts +17 -0
- package/constant/index.ts +1 -0
- package/enum/discount-rules-mode-type.enum.ts +2 -4
- package/enum/discount-rules-type.enum.ts +1 -0
- package/package.json +1 -1
- package/schemas/client/client-extended-for-client.schema.ts +2 -2
- package/schemas/client/client-extended.schema.ts +2 -0
- package/schemas/client/client-legal-profile-for-client-response.schema.ts +7 -0
- package/schemas/client/client-legal-profile-for-client.schema.ts +25 -0
- package/schemas/client/client-legal-profile-requisites.schema.ts +13 -0
- package/schemas/client/client-legal-profile.schema.ts +3 -0
- package/schemas/client/create-client-legal-profile-request.schema.ts +8 -0
- package/schemas/client/create-client-legal-profile-response.schema.ts +7 -0
- package/schemas/client/delete-client-legal-profile-request.schema.ts +3 -0
- package/schemas/client/delete-client-legal-profile-response.schema.ts +7 -0
- package/schemas/client/delete-client-legal-profile-result.schema.ts +7 -0
- package/schemas/client/get-client-legal-profile-list-request.schema.ts +3 -0
- package/schemas/client/get-client-legal-profile-list-response.schema.ts +7 -0
- package/schemas/client/index.ts +12 -0
- package/schemas/client/update-client-legal-profile-request.schema.ts +11 -0
- package/schemas/client/update-client-legal-profile-response.schema.ts +7 -0
- package/schemas/discount-rules/discount-rules.schema.ts +28 -11
- package/schemas/discount-rules/product-discount-price-data.schema.ts +9 -0
- package/schemas/discount-rules/product-discount-price-multiplicity-option.schema.ts +2 -0
- package/schemas/index.ts +2 -0
- package/schemas/order-product/price-correction-analyze-item.schema.ts +7 -0
- package/schemas/payment-invoice/create-payment-invoice-request.schema.ts +26 -0
- package/schemas/payment-invoice/create-payment-invoice-response.schema.ts +7 -0
- package/schemas/payment-invoice/payment-invoice.schema.ts +2 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PositiveMoneySchema } from '../positive-money.schema';
|
|
3
|
+
|
|
4
|
+
// Потолок числа заказов в счёте. Это защита от абсурдного запроса, а не бизнес-правило: счёт за месяц
|
|
5
|
+
// клиенту с ежедневными поставками — это уже 30 строк, поэтому 10-20 отрезали бы живые сценарии.
|
|
6
|
+
// Сто строк — это 3-4 страницы таблицы, документ такого размера собирается и читается нормально.
|
|
7
|
+
const MAX_INVOICE_ORDER_COUNT = 100;
|
|
8
|
+
|
|
9
|
+
// Счёт выставляется одним из двух способов:
|
|
10
|
+
// - по заказам: orderUUIDs непустой, итог считается на бэке как сумма totalCost этих заказов,
|
|
11
|
+
// а amount — необязательная правка итога (например скидка по счёту), она уходит отдельной строкой;
|
|
12
|
+
// - вручную: orderUUIDs пуст, тогда amount обязателен и становится единственной строкой счёта.
|
|
13
|
+
export const CreatePaymentInvoiceRequestSchema = z
|
|
14
|
+
.object({
|
|
15
|
+
clientUUID: z.uuid(),
|
|
16
|
+
// Карточка реквизитов покупателя. Не передана — счёт выписывается на основную карточку клиента.
|
|
17
|
+
clientLegalProfileUUID: z.uuid().optional(),
|
|
18
|
+
invoiceDate: z.coerce.date(),
|
|
19
|
+
orderUUIDs: z.uuid().array().max(MAX_INVOICE_ORDER_COUNT).optional(),
|
|
20
|
+
// Строго положительная сумма: отсекаем минус по знаку строки и нулевые записи вида "0" / "0.00".
|
|
21
|
+
amount: PositiveMoneySchema.optional(),
|
|
22
|
+
})
|
|
23
|
+
.refine(value => Boolean(value.orderUUIDs?.length) || value.amount !== undefined, {
|
|
24
|
+
message: 'Either orderUUIDs or amount must be provided',
|
|
25
|
+
path: ['amount'],
|
|
26
|
+
});
|
|
@@ -21,6 +21,8 @@ export const PaymentInvoiceSchema = z.object({
|
|
|
21
21
|
remainingAmount: MoneySchema,
|
|
22
22
|
status: z.nativeEnum(PaymentInvoiceStatusEnum),
|
|
23
23
|
clientUUID: z.string(),
|
|
24
|
+
// Карточка реквизитов, на которую выписан счёт; null — у старых счетов и у клиентов без карточек.
|
|
25
|
+
clientLegalProfileUUID: z.string().nullable(),
|
|
24
26
|
clientName: z.string(),
|
|
25
27
|
contractNumber: z.string().nullable(),
|
|
26
28
|
contractDate: z.coerce.date().nullable(),
|