@floristcloud/api-lib 1.2.225 → 1.2.227
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/integration/moysklad/index.js +0 -4
- package/build/commands/order/get-order-list.query.js +70 -4
- package/build/constant/error.js +7 -30
- package/build/constant/index.js +0 -1
- package/build/constant/settings.constant.js +6 -1
- package/build/constant/validation-i18n-key.js +1 -0
- package/build/constant/validation-i18n-message.js +1 -0
- package/build/enum/external-entity-type.enum.js +0 -1
- package/build/enum/index.js +2 -2
- package/build/enum/notification-type.enum.js +0 -3
- package/build/enum/webshop-menu-item-color.enum.js +12 -0
- package/build/enum/webshop-menu-item-target.enum.js +9 -0
- package/build/schemas/client/register-client-webshop-request.schema.js +4 -5
- package/build/schemas/index.js +5 -0
- package/build/schemas/integration/moysklad/enable-moysklad-request.schema.js +0 -2
- package/build/schemas/integration/moysklad/index.js +0 -9
- package/build/schemas/integration/moysklad/moysklad-status.schema.js +0 -1
- package/build/schemas/order/index.js +0 -4
- package/build/schemas/order/order-extended.schema.js +0 -4
- package/build/schemas/pre-order/get-pre-order-list-request.schema.js +0 -2
- package/build/schemas/pre-order/pre-order.schema.js +0 -4
- package/build/schemas/settings/settings.schema.js +6 -1
- package/build/schemas/settings/webshop-featured-menu-item-badge-translations.schema.js +8 -0
- package/build/schemas/settings/webshop-featured-menu-item-name-translations.schema.js +9 -0
- package/build/schemas/settings/webshop-featured-menu-item-target.schema.js +16 -0
- package/build/schemas/settings/webshop-featured-menu-item.schema.js +36 -0
- package/build/schemas/settings/webshop-featured-menu-items.schema.js +23 -0
- package/commands/integration/moysklad/index.ts +0 -5
- package/commands/order/get-order-list.query.ts +76 -3
- package/constant/error.ts +7 -30
- package/constant/index.ts +0 -1
- package/constant/settings.constant.ts +7 -0
- package/constant/validation-i18n-key.ts +1 -0
- package/constant/validation-i18n-message.ts +1 -0
- package/enum/external-entity-type.enum.ts +0 -1
- package/enum/index.ts +2 -3
- package/enum/notification-type.enum.ts +0 -3
- package/enum/webshop-menu-item-color.enum.ts +8 -0
- package/enum/webshop-menu-item-target.enum.ts +5 -0
- package/package.json +1 -1
- package/schemas/client/register-client-webshop-request.schema.ts +4 -10
- package/schemas/index.ts +5 -0
- package/schemas/integration/moysklad/enable-moysklad-request.schema.ts +0 -2
- package/schemas/integration/moysklad/index.ts +0 -10
- package/schemas/integration/moysklad/moysklad-status.schema.ts +0 -1
- package/schemas/order/index.ts +0 -8
- package/schemas/order/order-extended.schema.ts +0 -4
- package/schemas/pre-order/get-pre-order-list-request.schema.ts +0 -2
- package/schemas/pre-order/pre-order.schema.ts +0 -4
- package/schemas/settings/settings.schema.ts +6 -0
- package/schemas/settings/webshop-featured-menu-item-badge-translations.schema.ts +9 -0
- package/schemas/settings/webshop-featured-menu-item-name-translations.schema.ts +10 -0
- package/schemas/settings/webshop-featured-menu-item-target.schema.ts +14 -0
- package/schemas/settings/webshop-featured-menu-item.schema.ts +34 -0
- package/schemas/settings/webshop-featured-menu-items.schema.ts +21 -0
- package/build/commands/integration/moysklad/get-moysklad-money-account-links.query.js +0 -8
- package/build/commands/integration/moysklad/get-moysklad-payment-sync-check.query.js +0 -10
- package/build/commands/integration/moysklad/list-moysklad-money-targets.query.js +0 -8
- package/build/commands/integration/moysklad/save-moysklad-money-account-link.command.js +0 -10
- package/build/constant/client-registration.constant.js +0 -11
- package/build/enum/money-account-integration-link-kind.enum.js +0 -9
- package/build/enum/order-source.enum.js +0 -9
- package/build/enum/payment-invoice-file-deletion-status.enum.js +0 -9
- package/build/schemas/integration/moysklad/moysklad-money-account-link.schema.js +0 -11
- package/build/schemas/integration/moysklad/moysklad-money-account-links-response.schema.js +0 -6
- package/build/schemas/integration/moysklad/moysklad-money-target-ref.schema.js +0 -17
- package/build/schemas/integration/moysklad/moysklad-money-target.schema.js +0 -14
- package/build/schemas/integration/moysklad/moysklad-money-targets-response.schema.js +0 -6
- package/build/schemas/integration/moysklad/moysklad-payment-sync-check-request.schema.js +0 -8
- package/build/schemas/integration/moysklad/moysklad-payment-sync-check-response.schema.js +0 -6
- package/build/schemas/integration/moysklad/moysklad-payment-sync-check.schema.js +0 -10
- package/build/schemas/integration/moysklad/save-moysklad-money-account-link-request.schema.js +0 -10
- package/build/schemas/order/get-order-list-request.schema.js +0 -67
- package/build/schemas/order/get-order-list-response-data.schema.js +0 -6
- package/build/schemas/order/get-order-list-response.schema.js +0 -6
- package/build/schemas/order/order-creator.schema.js +0 -5
- package/commands/integration/moysklad/get-moysklad-money-account-links.query.ts +0 -7
- package/commands/integration/moysklad/get-moysklad-payment-sync-check.query.ts +0 -10
- package/commands/integration/moysklad/list-moysklad-money-targets.query.ts +0 -7
- package/commands/integration/moysklad/save-moysklad-money-account-link.command.ts +0 -10
- package/constant/client-registration.constant.ts +0 -8
- package/enum/money-account-integration-link-kind.enum.ts +0 -5
- package/enum/order-source.enum.ts +0 -8
- package/enum/payment-invoice-file-deletion-status.enum.ts +0 -5
- package/schemas/integration/moysklad/moysklad-money-account-link.schema.ts +0 -9
- package/schemas/integration/moysklad/moysklad-money-account-links-response.schema.ts +0 -4
- package/schemas/integration/moysklad/moysklad-money-target-ref.schema.ts +0 -15
- package/schemas/integration/moysklad/moysklad-money-target.schema.ts +0 -12
- package/schemas/integration/moysklad/moysklad-money-targets-response.schema.ts +0 -4
- package/schemas/integration/moysklad/moysklad-payment-sync-check-request.schema.ts +0 -6
- package/schemas/integration/moysklad/moysklad-payment-sync-check-response.schema.ts +0 -4
- package/schemas/integration/moysklad/moysklad-payment-sync-check.schema.ts +0 -8
- package/schemas/integration/moysklad/save-moysklad-money-account-link-request.schema.ts +0 -8
- package/schemas/order/get-order-list-request.schema.ts +0 -71
- package/schemas/order/get-order-list-response-data.schema.ts +0 -3
- package/schemas/order/get-order-list-response.schema.ts +0 -3
- package/schemas/order/order-creator.schema.ts +0 -2
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GetOrderListRequestSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const date_helper_1 = require("../../helpers/date.helper");
|
|
6
|
-
const query_boolean_helper_1 = require("../../helpers/query-boolean.helper");
|
|
7
|
-
const enum_1 = require("../../enum");
|
|
8
|
-
exports.GetOrderListRequestSchema = zod_1.z
|
|
9
|
-
.object({
|
|
10
|
-
page: zod_1.z.string().transform(val => Number(val) || 1),
|
|
11
|
-
count: zod_1.z.string().transform(val => Number(val) || 10),
|
|
12
|
-
startDate: zod_1.z.coerce.date().optional(),
|
|
13
|
-
endDate: zod_1.z.coerce.date().optional(),
|
|
14
|
-
isDelivery: zod_1.z.coerce.boolean().optional(),
|
|
15
|
-
isPaid: zod_1.z.coerce.boolean().optional(),
|
|
16
|
-
consignmentUUID: zod_1.z.string().optional(),
|
|
17
|
-
tag: zod_1.z.string().optional(),
|
|
18
|
-
clientUUID: zod_1.z.string().optional(),
|
|
19
|
-
// Филиал клиента (`Order.branchUUID`). Точное совпадение; осмысленно вместе с `clientUUID`,
|
|
20
|
-
// но не требует его — филиал и так принадлежит одному клиенту.
|
|
21
|
-
branchUUID: zod_1.z.uuid().optional(),
|
|
22
|
-
searchQuery: zod_1.z.string().optional(),
|
|
23
|
-
consignmentDeliveryDate: zod_1.z.coerce.date().optional(),
|
|
24
|
-
/**
|
|
25
|
-
* @deprecated Используйте `deliveryDateFrom` / `deliveryDateTo`. Оставлен ради сохранённых
|
|
26
|
-
* ссылок и MCP-клиентов: трактуется как период из одного дня (from = to = deliveryDate).
|
|
27
|
-
*/
|
|
28
|
-
deliveryDate: zod_1.z.coerce.date().optional(),
|
|
29
|
-
// Период даты отгрузки/выдачи заказа (`plannedShipmentDate`) — и доставка, и самовывоз; имена
|
|
30
|
-
// остались от фильтра по дате доставки. Календарные дни `YYYY-MM-DD`, обе границы включительно.
|
|
31
|
-
deliveryDateFrom: zod_1.z.coerce.date().optional(),
|
|
32
|
-
deliveryDateTo: zod_1.z.coerce.date().optional(),
|
|
33
|
-
byProductSearchQuery: zod_1.z.string().optional(),
|
|
34
|
-
statuses: zod_1.z.nativeEnum(enum_1.OrderStatusEnum).array().optional(),
|
|
35
|
-
source: zod_1.z.nativeEnum(enum_1.OrderSourceEnum).optional(),
|
|
36
|
-
type: zod_1.z.nativeEnum(enum_1.OrderTypeEnum).optional(),
|
|
37
|
-
city: zod_1.z.string().optional(),
|
|
38
|
-
responsibleUserUUID: zod_1.z.string().optional(),
|
|
39
|
-
group: zod_1.z.string().optional(),
|
|
40
|
-
// Только заказы, ещё не включённые ни в один счёт на оплату — список для пикера при
|
|
41
|
-
// выставлении счёта. Комбинируется с остальными критериями обычным AND.
|
|
42
|
-
withoutPaymentInvoice: zod_1.z.coerce.boolean().optional(),
|
|
43
|
-
// То же для передаточного документа — пикер заказов при выпуске УПД. Здесь `queryBooleanSchema`,
|
|
44
|
-
// а не `z.coerce.boolean()`: в query всегда приходит текст, и `Boolean('false') === true`,
|
|
45
|
-
// то есть флаг соседа невозможно выключить явным значением, только опустив параметр.
|
|
46
|
-
withoutTransferDocument: query_boolean_helper_1.queryBooleanSchema,
|
|
47
|
-
})
|
|
48
|
-
.refine(value => {
|
|
49
|
-
const { startDate, endDate } = value;
|
|
50
|
-
if (startDate && endDate) {
|
|
51
|
-
return (0, date_helper_1.dateRangeCheck)(startDate, endDate);
|
|
52
|
-
}
|
|
53
|
-
return true;
|
|
54
|
-
}, {
|
|
55
|
-
message: 'validation.dateRange',
|
|
56
|
-
path: ['endDate', 'startDate'],
|
|
57
|
-
})
|
|
58
|
-
.refine(value => {
|
|
59
|
-
const { deliveryDateFrom, deliveryDateTo } = value;
|
|
60
|
-
if (deliveryDateFrom && deliveryDateTo) {
|
|
61
|
-
return (0, date_helper_1.dateRangeCheck)(deliveryDateFrom, deliveryDateTo);
|
|
62
|
-
}
|
|
63
|
-
return true;
|
|
64
|
-
}, {
|
|
65
|
-
message: 'validation.dateRange',
|
|
66
|
-
path: ['deliveryDateTo', 'deliveryDateFrom'],
|
|
67
|
-
});
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GetOrderListResponseDataSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const order_extended_schema_1 = require("./order-extended.schema");
|
|
6
|
-
exports.GetOrderListResponseDataSchema = zod_1.z.object({ orderList: order_extended_schema_1.OrderExtendedSchema.array(), total: zod_1.z.number() });
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GetOrderListResponseSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const get_order_list_response_data_schema_1 = require("./get-order-list-response-data.schema");
|
|
6
|
-
exports.GetOrderListResponseSchema = zod_1.z.object({ message: zod_1.z.string().optional(), data: get_order_list_response_data_schema_1.GetOrderListResponseDataSchema });
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OrderCreatorSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
exports.OrderCreatorSchema = zod_1.z.object({ uuid: zod_1.z.string().uuid(), name: zod_1.z.string(), isClient: zod_1.z.boolean() });
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { z } from 'zod';
|
|
2
|
-
import { MoyskladMoneyAccountLinksResponseSchema } from '../../../schemas/integration/moysklad/moysklad-money-account-links-response.schema';
|
|
3
|
-
|
|
4
|
-
export namespace GetMoyskladMoneyAccountLinksContractQuery {
|
|
5
|
-
export const ResponseSchema = MoyskladMoneyAccountLinksResponseSchema;
|
|
6
|
-
export type Response = z.infer<typeof ResponseSchema>;
|
|
7
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { z } from 'zod';
|
|
2
|
-
import { MoyskladPaymentSyncCheckRequestSchema } from '../../../schemas/integration/moysklad/moysklad-payment-sync-check-request.schema';
|
|
3
|
-
import { MoyskladPaymentSyncCheckResponseSchema } from '../../../schemas/integration/moysklad/moysklad-payment-sync-check-response.schema';
|
|
4
|
-
|
|
5
|
-
export namespace GetMoyskladPaymentSyncCheckContractQuery {
|
|
6
|
-
export const RequestSchema = MoyskladPaymentSyncCheckRequestSchema;
|
|
7
|
-
export type Request = z.infer<typeof RequestSchema>;
|
|
8
|
-
export const ResponseSchema = MoyskladPaymentSyncCheckResponseSchema;
|
|
9
|
-
export type Response = z.infer<typeof ResponseSchema>;
|
|
10
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { z } from 'zod';
|
|
2
|
-
import { MoyskladMoneyTargetsResponseSchema } from '../../../schemas/integration/moysklad/moysklad-money-targets-response.schema';
|
|
3
|
-
|
|
4
|
-
export namespace ListMoyskladMoneyTargetsContractQuery {
|
|
5
|
-
export const ResponseSchema = MoyskladMoneyTargetsResponseSchema;
|
|
6
|
-
export type Response = z.infer<typeof ResponseSchema>;
|
|
7
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { z } from 'zod';
|
|
2
|
-
import { MoyskladMoneyAccountLinksResponseSchema } from '../../../schemas/integration/moysklad/moysklad-money-account-links-response.schema';
|
|
3
|
-
import { SaveMoyskladMoneyAccountLinkRequestSchema } from '../../../schemas/integration/moysklad/save-moysklad-money-account-link-request.schema';
|
|
4
|
-
|
|
5
|
-
export namespace SaveMoyskladMoneyAccountLinkContractCommand {
|
|
6
|
-
export const RequestSchema = SaveMoyskladMoneyAccountLinkRequestSchema;
|
|
7
|
-
export type Request = z.infer<typeof RequestSchema>;
|
|
8
|
-
export const ResponseSchema = MoyskladMoneyAccountLinksResponseSchema;
|
|
9
|
-
export type Response = z.infer<typeof ResponseSchema>;
|
|
10
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// Потолки полей публичной заявки на регистрацию с витрины. Тело запроса до 1 МиБ, а данные заявки уходят
|
|
2
|
-
// в письма админам и в payload уведомлений — без границы туда попадает мегабайт текста.
|
|
3
|
-
export const CLIENT_REGISTRATION_NAME_MAX_LENGTH = 255;
|
|
4
|
-
export const CLIENT_REGISTRATION_CONTACT_NAME_MAX_LENGTH = 255;
|
|
5
|
-
// Номер с кодом страны и разделителями укладывается с запасом.
|
|
6
|
-
export const CLIENT_REGISTRATION_PHONE_MAX_LENGTH = 32;
|
|
7
|
-
// Предел длины адреса по RFC 5321.
|
|
8
|
-
export const CLIENT_REGISTRATION_EMAIL_MAX_LENGTH = 254;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { MoneyAccountIntegrationLinkKindEnum } from '../../../enum/money-account-integration-link-kind.enum';
|
|
3
|
-
|
|
4
|
-
export const MoyskladMoneyAccountLinkSchema = z.object({
|
|
5
|
-
moneyAccountUUID: z.uuid(),
|
|
6
|
-
kind: z.nativeEnum(MoneyAccountIntegrationLinkKindEnum),
|
|
7
|
-
organizationId: z.string(),
|
|
8
|
-
externalAccountId: z.string().nullable(),
|
|
9
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { MoneyAccountIntegrationLinkKindEnum } from '../../../enum/money-account-integration-link-kind.enum';
|
|
3
|
-
|
|
4
|
-
// Место денег в МойСкладе: касса юрлица (CASH, своего id у неё нет) или его расчётный счёт (BANK, externalAccountId). Идентификаторы МойСклада —
|
|
5
|
-
// 8-4-4-4-12, но не RFC 9562, поэтому z.guid(), а не z.uuid().
|
|
6
|
-
export const MoyskladMoneyTargetRefSchema = z
|
|
7
|
-
.object({
|
|
8
|
-
kind: z.nativeEnum(MoneyAccountIntegrationLinkKindEnum),
|
|
9
|
-
organizationId: z.guid(),
|
|
10
|
-
externalAccountId: z.guid().nullable(),
|
|
11
|
-
})
|
|
12
|
-
.refine(target => (target.kind === MoneyAccountIntegrationLinkKindEnum.BANK) === (target.externalAccountId !== null), {
|
|
13
|
-
message: 'externalAccountId is required for BANK and must be null for CASH',
|
|
14
|
-
path: ['externalAccountId'],
|
|
15
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { MoneyAccountIntegrationLinkKindEnum } from '../../../enum/money-account-integration-link-kind.enum';
|
|
3
|
-
|
|
4
|
-
// Вариант для выпадающего списка: касса или расчётный счёт юрлица МойСклада с подписями.
|
|
5
|
-
export const MoyskladMoneyTargetSchema = z.object({
|
|
6
|
-
kind: z.nativeEnum(MoneyAccountIntegrationLinkKindEnum),
|
|
7
|
-
organizationId: z.string(),
|
|
8
|
-
organizationName: z.string(),
|
|
9
|
-
externalAccountId: z.string().nullable(),
|
|
10
|
-
accountNumber: z.string().nullable(),
|
|
11
|
-
bankName: z.string().nullable(),
|
|
12
|
-
});
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
// isSynced — оплата клиента на этот счёт уйдёт в МойСклад. isOrganizationMismatch — юрлицо счёта в МС не совпадает
|
|
4
|
-
// с юрлицом заказа: документ оплаты создастся на юрлицо счёта, но со ссылкой на заказ другого юрлица.
|
|
5
|
-
export const MoyskladPaymentSyncCheckSchema = z.object({
|
|
6
|
-
isSynced: z.boolean(),
|
|
7
|
-
isOrganizationMismatch: z.boolean(),
|
|
8
|
-
});
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { MoyskladMoneyTargetRefSchema } from './moysklad-money-target-ref.schema';
|
|
3
|
-
|
|
4
|
-
// target = null снимает связь: оплаты со счёта перестают уходить в МойСклад.
|
|
5
|
-
export const SaveMoyskladMoneyAccountLinkRequestSchema = z.object({
|
|
6
|
-
moneyAccountUUID: z.uuid(),
|
|
7
|
-
target: MoyskladMoneyTargetRefSchema.nullable(),
|
|
8
|
-
});
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { dateRangeCheck } from '../../helpers/date.helper';
|
|
3
|
-
import { queryBooleanSchema } from '../../helpers/query-boolean.helper';
|
|
4
|
-
import { OrderStatusEnum, OrderTypeEnum, OrderSourceEnum } from '../../enum';
|
|
5
|
-
|
|
6
|
-
export const GetOrderListRequestSchema = z
|
|
7
|
-
.object({
|
|
8
|
-
page: z.string().transform(val => Number(val) || 1),
|
|
9
|
-
count: z.string().transform(val => Number(val) || 10),
|
|
10
|
-
startDate: z.coerce.date().optional(),
|
|
11
|
-
endDate: z.coerce.date().optional(),
|
|
12
|
-
isDelivery: z.coerce.boolean().optional(),
|
|
13
|
-
isPaid: z.coerce.boolean().optional(),
|
|
14
|
-
consignmentUUID: z.string().optional(),
|
|
15
|
-
tag: z.string().optional(),
|
|
16
|
-
clientUUID: z.string().optional(),
|
|
17
|
-
// Филиал клиента (`Order.branchUUID`). Точное совпадение; осмысленно вместе с `clientUUID`,
|
|
18
|
-
// но не требует его — филиал и так принадлежит одному клиенту.
|
|
19
|
-
branchUUID: z.uuid().optional(),
|
|
20
|
-
searchQuery: z.string().optional(),
|
|
21
|
-
consignmentDeliveryDate: z.coerce.date().optional(),
|
|
22
|
-
/**
|
|
23
|
-
* @deprecated Используйте `deliveryDateFrom` / `deliveryDateTo`. Оставлен ради сохранённых
|
|
24
|
-
* ссылок и MCP-клиентов: трактуется как период из одного дня (from = to = deliveryDate).
|
|
25
|
-
*/
|
|
26
|
-
deliveryDate: z.coerce.date().optional(),
|
|
27
|
-
// Период даты отгрузки/выдачи заказа (`plannedShipmentDate`) — и доставка, и самовывоз; имена
|
|
28
|
-
// остались от фильтра по дате доставки. Календарные дни `YYYY-MM-DD`, обе границы включительно.
|
|
29
|
-
deliveryDateFrom: z.coerce.date().optional(),
|
|
30
|
-
deliveryDateTo: z.coerce.date().optional(),
|
|
31
|
-
byProductSearchQuery: z.string().optional(),
|
|
32
|
-
statuses: z.nativeEnum(OrderStatusEnum).array().optional(),
|
|
33
|
-
source: z.nativeEnum(OrderSourceEnum).optional(),
|
|
34
|
-
type: z.nativeEnum(OrderTypeEnum).optional(),
|
|
35
|
-
city: z.string().optional(),
|
|
36
|
-
responsibleUserUUID: z.string().optional(),
|
|
37
|
-
group: z.string().optional(),
|
|
38
|
-
// Только заказы, ещё не включённые ни в один счёт на оплату — список для пикера при
|
|
39
|
-
// выставлении счёта. Комбинируется с остальными критериями обычным AND.
|
|
40
|
-
withoutPaymentInvoice: z.coerce.boolean().optional(),
|
|
41
|
-
// То же для передаточного документа — пикер заказов при выпуске УПД. Здесь `queryBooleanSchema`,
|
|
42
|
-
// а не `z.coerce.boolean()`: в query всегда приходит текст, и `Boolean('false') === true`,
|
|
43
|
-
// то есть флаг соседа невозможно выключить явным значением, только опустив параметр.
|
|
44
|
-
withoutTransferDocument: queryBooleanSchema,
|
|
45
|
-
})
|
|
46
|
-
.refine(
|
|
47
|
-
value => {
|
|
48
|
-
const { startDate, endDate } = value;
|
|
49
|
-
if (startDate && endDate) {
|
|
50
|
-
return dateRangeCheck(startDate, endDate);
|
|
51
|
-
}
|
|
52
|
-
return true;
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
message: 'validation.dateRange',
|
|
56
|
-
path: ['endDate', 'startDate'],
|
|
57
|
-
},
|
|
58
|
-
)
|
|
59
|
-
.refine(
|
|
60
|
-
value => {
|
|
61
|
-
const { deliveryDateFrom, deliveryDateTo } = value;
|
|
62
|
-
if (deliveryDateFrom && deliveryDateTo) {
|
|
63
|
-
return dateRangeCheck(deliveryDateFrom, deliveryDateTo);
|
|
64
|
-
}
|
|
65
|
-
return true;
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
message: 'validation.dateRange',
|
|
69
|
-
path: ['deliveryDateTo', 'deliveryDateFrom'],
|
|
70
|
-
},
|
|
71
|
-
);
|