@floristcloud/api-lib 1.2.222 → 1.2.223
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/order/get-order-list.query.js +4 -70
- package/build/enum/index.js +1 -0
- package/build/enum/order-source.enum.js +9 -0
- package/build/schemas/order/get-order-list-request.schema.js +64 -0
- package/build/schemas/order/get-order-list-response-data.schema.js +6 -0
- package/build/schemas/order/get-order-list-response.schema.js +6 -0
- package/build/schemas/order/index.js +4 -0
- package/build/schemas/order/order-creator.schema.js +5 -0
- package/build/schemas/order/order-extended.schema.js +4 -0
- package/build/schemas/pre-order/get-pre-order-list-request.schema.js +2 -0
- package/build/schemas/pre-order/pre-order.schema.js +4 -0
- package/commands/order/get-order-list.query.ts +3 -76
- package/enum/index.ts +2 -0
- package/enum/order-source.enum.ts +8 -0
- package/package.json +1 -1
- package/schemas/order/get-order-list-request.schema.ts +68 -0
- package/schemas/order/get-order-list-response-data.schema.ts +3 -0
- package/schemas/order/get-order-list-response.schema.ts +3 -0
- package/schemas/order/index.ts +8 -0
- package/schemas/order/order-creator.schema.ts +2 -0
- package/schemas/order/order-extended.schema.ts +4 -0
- package/schemas/pre-order/get-pre-order-list-request.schema.ts +2 -0
- package/schemas/pre-order/pre-order.schema.ts +4 -0
|
@@ -1,76 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GetOrderListContractQuery = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const date_helper_1 = require("../../helpers/date.helper");
|
|
7
|
-
const query_boolean_helper_1 = require("../../helpers/query-boolean.helper");
|
|
8
|
-
const enum_1 = require("../../enum");
|
|
9
|
-
const GetOrderListRequestSchema = zod_1.z
|
|
10
|
-
.object({
|
|
11
|
-
page: zod_1.z.string().transform(val => Number(val) || 1),
|
|
12
|
-
count: zod_1.z.string().transform(val => Number(val) || 10),
|
|
13
|
-
startDate: zod_1.z.coerce.date().optional(),
|
|
14
|
-
endDate: zod_1.z.coerce.date().optional(),
|
|
15
|
-
isDelivery: zod_1.z.coerce.boolean().optional(),
|
|
16
|
-
isPaid: zod_1.z.coerce.boolean().optional(),
|
|
17
|
-
consignmentUUID: zod_1.z.string().optional(),
|
|
18
|
-
tag: zod_1.z.string().optional(),
|
|
19
|
-
clientUUID: zod_1.z.string().optional(),
|
|
20
|
-
searchQuery: zod_1.z.string().optional(),
|
|
21
|
-
consignmentDeliveryDate: zod_1.z.coerce.date().optional(),
|
|
22
|
-
/**
|
|
23
|
-
* @deprecated Используйте `deliveryDateFrom` / `deliveryDateTo`. Оставлен ради сохранённых
|
|
24
|
-
* ссылок и MCP-клиентов: трактуется как период из одного дня (from = to = deliveryDate).
|
|
25
|
-
*/
|
|
26
|
-
deliveryDate: zod_1.z.coerce.date().optional(),
|
|
27
|
-
// Период даты отгрузки/выдачи заказа (`plannedShipmentDate`) — и доставка, и самовывоз; имена
|
|
28
|
-
// остались от фильтра по дате доставки. Календарные дни `YYYY-MM-DD`, обе границы включительно.
|
|
29
|
-
deliveryDateFrom: zod_1.z.coerce.date().optional(),
|
|
30
|
-
deliveryDateTo: zod_1.z.coerce.date().optional(),
|
|
31
|
-
byProductSearchQuery: zod_1.z.string().optional(),
|
|
32
|
-
statuses: zod_1.z.nativeEnum(enum_1.OrderStatusEnum).array().optional(),
|
|
33
|
-
type: zod_1.z.nativeEnum(enum_1.OrderTypeEnum).optional(),
|
|
34
|
-
city: zod_1.z.string().optional(),
|
|
35
|
-
responsibleUserUUID: zod_1.z.string().optional(),
|
|
36
|
-
group: zod_1.z.string().optional(),
|
|
37
|
-
// Только заказы, ещё не включённые ни в один счёт на оплату — список для пикера при
|
|
38
|
-
// выставлении счёта. Комбинируется с остальными критериями обычным AND.
|
|
39
|
-
withoutPaymentInvoice: zod_1.z.coerce.boolean().optional(),
|
|
40
|
-
// То же для передаточного документа — пикер заказов при выпуске УПД. Здесь `queryBooleanSchema`,
|
|
41
|
-
// а не `z.coerce.boolean()`: в query всегда приходит текст, и `Boolean('false') === true`,
|
|
42
|
-
// то есть флаг соседа невозможно выключить явным значением, только опустив параметр.
|
|
43
|
-
withoutTransferDocument: query_boolean_helper_1.queryBooleanSchema,
|
|
44
|
-
})
|
|
45
|
-
.refine(value => {
|
|
46
|
-
const { startDate, endDate } = value;
|
|
47
|
-
if (startDate && endDate) {
|
|
48
|
-
return (0, date_helper_1.dateRangeCheck)(startDate, endDate);
|
|
49
|
-
}
|
|
50
|
-
return true;
|
|
51
|
-
}, {
|
|
52
|
-
message: 'validation.dateRange',
|
|
53
|
-
path: ['endDate', 'startDate'],
|
|
54
|
-
})
|
|
55
|
-
.refine(value => {
|
|
56
|
-
const { deliveryDateFrom, deliveryDateTo } = value;
|
|
57
|
-
if (deliveryDateFrom && deliveryDateTo) {
|
|
58
|
-
return (0, date_helper_1.dateRangeCheck)(deliveryDateFrom, deliveryDateTo);
|
|
59
|
-
}
|
|
60
|
-
return true;
|
|
61
|
-
}, {
|
|
62
|
-
message: 'validation.dateRange',
|
|
63
|
-
path: ['deliveryDateTo', 'deliveryDateFrom'],
|
|
64
|
-
});
|
|
65
|
-
const GetOrderListResponseSchema = zod_1.z.object({
|
|
66
|
-
message: zod_1.z.string().optional(),
|
|
67
|
-
data: zod_1.z.object({
|
|
68
|
-
orderList: schemas_1.OrderExtendedSchema.array(),
|
|
69
|
-
total: zod_1.z.number(),
|
|
70
|
-
}),
|
|
71
|
-
});
|
|
4
|
+
const get_order_list_request_schema_1 = require("../../schemas/order/get-order-list-request.schema");
|
|
5
|
+
const get_order_list_response_schema_1 = require("../../schemas/order/get-order-list-response.schema");
|
|
72
6
|
var GetOrderListContractQuery;
|
|
73
7
|
(function (GetOrderListContractQuery) {
|
|
74
|
-
GetOrderListContractQuery.RequestSchema = GetOrderListRequestSchema;
|
|
75
|
-
GetOrderListContractQuery.ResponseSchema = GetOrderListResponseSchema;
|
|
8
|
+
GetOrderListContractQuery.RequestSchema = get_order_list_request_schema_1.GetOrderListRequestSchema;
|
|
9
|
+
GetOrderListContractQuery.ResponseSchema = get_order_list_response_schema_1.GetOrderListResponseSchema;
|
|
76
10
|
})(GetOrderListContractQuery || (exports.GetOrderListContractQuery = GetOrderListContractQuery = {}));
|
package/build/enum/index.js
CHANGED
|
@@ -210,3 +210,4 @@ __exportStar(require("./product-resolution-image-reason.enum"), exports);
|
|
|
210
210
|
__exportStar(require("./product-resolution-matched-attribute.enum"), exports);
|
|
211
211
|
__exportStar(require("./product-resolution-decision-action.enum"), exports);
|
|
212
212
|
__exportStar(require("./product-resolution-write-mode.enum"), exports);
|
|
213
|
+
__exportStar(require("./order-source.enum"), exports);
|
|
@@ -0,0 +1,64 @@
|
|
|
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
|
+
searchQuery: zod_1.z.string().optional(),
|
|
20
|
+
consignmentDeliveryDate: zod_1.z.coerce.date().optional(),
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated Используйте `deliveryDateFrom` / `deliveryDateTo`. Оставлен ради сохранённых
|
|
23
|
+
* ссылок и MCP-клиентов: трактуется как период из одного дня (from = to = deliveryDate).
|
|
24
|
+
*/
|
|
25
|
+
deliveryDate: zod_1.z.coerce.date().optional(),
|
|
26
|
+
// Период даты отгрузки/выдачи заказа (`plannedShipmentDate`) — и доставка, и самовывоз; имена
|
|
27
|
+
// остались от фильтра по дате доставки. Календарные дни `YYYY-MM-DD`, обе границы включительно.
|
|
28
|
+
deliveryDateFrom: zod_1.z.coerce.date().optional(),
|
|
29
|
+
deliveryDateTo: zod_1.z.coerce.date().optional(),
|
|
30
|
+
byProductSearchQuery: zod_1.z.string().optional(),
|
|
31
|
+
statuses: zod_1.z.nativeEnum(enum_1.OrderStatusEnum).array().optional(),
|
|
32
|
+
source: zod_1.z.nativeEnum(enum_1.OrderSourceEnum).optional(),
|
|
33
|
+
type: zod_1.z.nativeEnum(enum_1.OrderTypeEnum).optional(),
|
|
34
|
+
city: zod_1.z.string().optional(),
|
|
35
|
+
responsibleUserUUID: zod_1.z.string().optional(),
|
|
36
|
+
group: zod_1.z.string().optional(),
|
|
37
|
+
// Только заказы, ещё не включённые ни в один счёт на оплату — список для пикера при
|
|
38
|
+
// выставлении счёта. Комбинируется с остальными критериями обычным AND.
|
|
39
|
+
withoutPaymentInvoice: zod_1.z.coerce.boolean().optional(),
|
|
40
|
+
// То же для передаточного документа — пикер заказов при выпуске УПД. Здесь `queryBooleanSchema`,
|
|
41
|
+
// а не `z.coerce.boolean()`: в query всегда приходит текст, и `Boolean('false') === true`,
|
|
42
|
+
// то есть флаг соседа невозможно выключить явным значением, только опустив параметр.
|
|
43
|
+
withoutTransferDocument: query_boolean_helper_1.queryBooleanSchema,
|
|
44
|
+
})
|
|
45
|
+
.refine(value => {
|
|
46
|
+
const { startDate, endDate } = value;
|
|
47
|
+
if (startDate && endDate) {
|
|
48
|
+
return (0, date_helper_1.dateRangeCheck)(startDate, endDate);
|
|
49
|
+
}
|
|
50
|
+
return true;
|
|
51
|
+
}, {
|
|
52
|
+
message: 'validation.dateRange',
|
|
53
|
+
path: ['endDate', 'startDate'],
|
|
54
|
+
})
|
|
55
|
+
.refine(value => {
|
|
56
|
+
const { deliveryDateFrom, deliveryDateTo } = value;
|
|
57
|
+
if (deliveryDateFrom && deliveryDateTo) {
|
|
58
|
+
return (0, date_helper_1.dateRangeCheck)(deliveryDateFrom, deliveryDateTo);
|
|
59
|
+
}
|
|
60
|
+
return true;
|
|
61
|
+
}, {
|
|
62
|
+
message: 'validation.dateRange',
|
|
63
|
+
path: ['deliveryDateTo', 'deliveryDateFrom'],
|
|
64
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
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() });
|
|
@@ -0,0 +1,6 @@
|
|
|
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 });
|
|
@@ -42,3 +42,7 @@ __exportStar(require("./order-vat-transition-execute-failure.schema"), exports);
|
|
|
42
42
|
__exportStar(require("./order-vat-transition-execute-result.schema"), exports);
|
|
43
43
|
__exportStar(require("./order-vat-transition-execute-response.schema"), exports);
|
|
44
44
|
__exportStar(require("./order-vat-source-confirmation.schema"), exports);
|
|
45
|
+
__exportStar(require("./get-order-list-request.schema"), exports);
|
|
46
|
+
__exportStar(require("./get-order-list-response.schema"), exports);
|
|
47
|
+
__exportStar(require("./get-order-list-response-data.schema"), exports);
|
|
48
|
+
__exportStar(require("./order-creator.schema"), exports);
|
|
@@ -0,0 +1,5 @@
|
|
|
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,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OrderExtendedSchema = void 0;
|
|
4
|
+
const order_creator_schema_1 = require("./order-creator.schema");
|
|
5
|
+
const order_source_enum_1 = require("../../enum/order-source.enum");
|
|
4
6
|
const zod_1 = require("zod");
|
|
5
7
|
const client_base_schema_1 = require("../client/client-base.schema");
|
|
6
8
|
const branch_schema_1 = require("../branch/branch.schema");
|
|
@@ -8,6 +10,8 @@ const order_delivery_schema_1 = require("../order-delivery/order-delivery.schema
|
|
|
8
10
|
const delivery_route_schema_1 = require("../delivery-route/delivery-route.schema");
|
|
9
11
|
const order_base_schema_1 = require("./order-base.schema");
|
|
10
12
|
exports.OrderExtendedSchema = order_base_schema_1.OrderSchema.extend({
|
|
13
|
+
source: zod_1.z.nativeEnum(order_source_enum_1.OrderSourceEnum).nullable(),
|
|
14
|
+
creator: order_creator_schema_1.OrderCreatorSchema.nullable(),
|
|
11
15
|
client: client_base_schema_1.ClientSchema,
|
|
12
16
|
branch: branch_schema_1.BranchSchema.nullable(),
|
|
13
17
|
delivery: order_delivery_schema_1.OrderDeliverySchema.nullable(),
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GetPreOrderListRequestSchema = void 0;
|
|
4
|
+
const order_source_enum_1 = require("../../enum/order-source.enum");
|
|
4
5
|
const zod_1 = require("zod");
|
|
5
6
|
const optional_query_boolean_helper_1 = require("../../helpers/optional-query-boolean.helper");
|
|
6
7
|
const enum_1 = require("../../enum");
|
|
7
8
|
exports.GetPreOrderListRequestSchema = zod_1.z.object({
|
|
9
|
+
source: zod_1.z.nativeEnum(order_source_enum_1.OrderSourceEnum).optional(),
|
|
8
10
|
page: zod_1.z.string().transform(val => Number(val) || 1),
|
|
9
11
|
excludeClosed: optional_query_boolean_helper_1.optionalQueryBooleanSchema,
|
|
10
12
|
count: zod_1.z.coerce.number().optional().default(10),
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UpdatePreOrderWebshopSchema = exports.CreatePreOrderWebshopSchema = exports.UpdatePreOrderSchema = exports.UpdatablePreOrderStatusSchema = exports.CreatePreOrderSchema = exports.PreOrderListSchema = exports.PreOrderWithClientSchema = exports.PreOrderExtendedSchema = exports.PreOrderSchema = void 0;
|
|
4
|
+
const order_creator_schema_1 = require("../order/order-creator.schema");
|
|
5
|
+
const order_source_enum_1 = require("../../enum/order-source.enum");
|
|
4
6
|
const pre_order_conversion_current_order_schema_1 = require("./pre-order-conversion-current-order.schema");
|
|
5
7
|
const pre_order_conversion_change_schema_1 = require("./pre-order-conversion-change.schema");
|
|
6
8
|
const pre_order_conversion_summary_schema_1 = require("./pre-order-conversion-summary.schema");
|
|
@@ -24,6 +26,8 @@ exports.PreOrderSchema = zod_1.z.object({
|
|
|
24
26
|
createdAt: zod_1.z.coerce.date(),
|
|
25
27
|
});
|
|
26
28
|
exports.PreOrderExtendedSchema = exports.PreOrderSchema.extend({
|
|
29
|
+
source: zod_1.z.nativeEnum(order_source_enum_1.OrderSourceEnum).nullable(),
|
|
30
|
+
creator: order_creator_schema_1.OrderCreatorSchema.nullable(),
|
|
27
31
|
client: client_base_schema_1.ClientSchema,
|
|
28
32
|
branch: branch_schema_1.BranchSchema.nullable(),
|
|
29
33
|
preOrderCollection: pre_order_collection_schema_1.PreOrderCollectionSchema.nullable(),
|
|
@@ -1,79 +1,6 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { queryBooleanSchema } from '../../helpers/query-boolean.helper';
|
|
5
|
-
import { OrderStatusEnum, OrderTypeEnum } from '../../enum';
|
|
6
|
-
|
|
7
|
-
const GetOrderListRequestSchema = z
|
|
8
|
-
.object({
|
|
9
|
-
page: z.string().transform(val => Number(val) || 1),
|
|
10
|
-
count: z.string().transform(val => Number(val) || 10),
|
|
11
|
-
startDate: z.coerce.date().optional(),
|
|
12
|
-
endDate: z.coerce.date().optional(),
|
|
13
|
-
isDelivery: z.coerce.boolean().optional(),
|
|
14
|
-
isPaid: z.coerce.boolean().optional(),
|
|
15
|
-
consignmentUUID: z.string().optional(),
|
|
16
|
-
tag: z.string().optional(),
|
|
17
|
-
clientUUID: z.string().optional(),
|
|
18
|
-
searchQuery: z.string().optional(),
|
|
19
|
-
consignmentDeliveryDate: z.coerce.date().optional(),
|
|
20
|
-
/**
|
|
21
|
-
* @deprecated Используйте `deliveryDateFrom` / `deliveryDateTo`. Оставлен ради сохранённых
|
|
22
|
-
* ссылок и MCP-клиентов: трактуется как период из одного дня (from = to = deliveryDate).
|
|
23
|
-
*/
|
|
24
|
-
deliveryDate: z.coerce.date().optional(),
|
|
25
|
-
// Период даты отгрузки/выдачи заказа (`plannedShipmentDate`) — и доставка, и самовывоз; имена
|
|
26
|
-
// остались от фильтра по дате доставки. Календарные дни `YYYY-MM-DD`, обе границы включительно.
|
|
27
|
-
deliveryDateFrom: z.coerce.date().optional(),
|
|
28
|
-
deliveryDateTo: z.coerce.date().optional(),
|
|
29
|
-
byProductSearchQuery: z.string().optional(),
|
|
30
|
-
statuses: z.nativeEnum(OrderStatusEnum).array().optional(),
|
|
31
|
-
type: z.nativeEnum(OrderTypeEnum).optional(),
|
|
32
|
-
city: z.string().optional(),
|
|
33
|
-
responsibleUserUUID: z.string().optional(),
|
|
34
|
-
group: z.string().optional(),
|
|
35
|
-
// Только заказы, ещё не включённые ни в один счёт на оплату — список для пикера при
|
|
36
|
-
// выставлении счёта. Комбинируется с остальными критериями обычным AND.
|
|
37
|
-
withoutPaymentInvoice: z.coerce.boolean().optional(),
|
|
38
|
-
// То же для передаточного документа — пикер заказов при выпуске УПД. Здесь `queryBooleanSchema`,
|
|
39
|
-
// а не `z.coerce.boolean()`: в query всегда приходит текст, и `Boolean('false') === true`,
|
|
40
|
-
// то есть флаг соседа невозможно выключить явным значением, только опустив параметр.
|
|
41
|
-
withoutTransferDocument: queryBooleanSchema,
|
|
42
|
-
})
|
|
43
|
-
.refine(
|
|
44
|
-
value => {
|
|
45
|
-
const { startDate, endDate } = value;
|
|
46
|
-
if (startDate && endDate) {
|
|
47
|
-
return dateRangeCheck(startDate, endDate);
|
|
48
|
-
}
|
|
49
|
-
return true;
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
message: 'validation.dateRange',
|
|
53
|
-
path: ['endDate', 'startDate'],
|
|
54
|
-
},
|
|
55
|
-
)
|
|
56
|
-
.refine(
|
|
57
|
-
value => {
|
|
58
|
-
const { deliveryDateFrom, deliveryDateTo } = value;
|
|
59
|
-
if (deliveryDateFrom && deliveryDateTo) {
|
|
60
|
-
return dateRangeCheck(deliveryDateFrom, deliveryDateTo);
|
|
61
|
-
}
|
|
62
|
-
return true;
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
message: 'validation.dateRange',
|
|
66
|
-
path: ['deliveryDateTo', 'deliveryDateFrom'],
|
|
67
|
-
},
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
const GetOrderListResponseSchema = z.object({
|
|
71
|
-
message: z.string().optional(),
|
|
72
|
-
data: z.object({
|
|
73
|
-
orderList: OrderExtendedSchema.array(),
|
|
74
|
-
total: z.number(),
|
|
75
|
-
}),
|
|
76
|
-
});
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import { GetOrderListRequestSchema } from '../../schemas/order/get-order-list-request.schema';
|
|
3
|
+
import { GetOrderListResponseSchema } from '../../schemas/order/get-order-list-response.schema';
|
|
77
4
|
|
|
78
5
|
export namespace GetOrderListContractQuery {
|
|
79
6
|
export const RequestSchema = GetOrderListRequestSchema;
|
package/enum/index.ts
CHANGED
|
@@ -203,3 +203,5 @@ export * from './product-resolution-image-reason.enum';
|
|
|
203
203
|
export * from './product-resolution-matched-attribute.enum';
|
|
204
204
|
export * from './product-resolution-decision-action.enum';
|
|
205
205
|
export * from './product-resolution-write-mode.enum';
|
|
206
|
+
|
|
207
|
+
export * from './order-source.enum';
|
package/package.json
CHANGED
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
searchQuery: z.string().optional(),
|
|
18
|
+
consignmentDeliveryDate: z.coerce.date().optional(),
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Используйте `deliveryDateFrom` / `deliveryDateTo`. Оставлен ради сохранённых
|
|
21
|
+
* ссылок и MCP-клиентов: трактуется как период из одного дня (from = to = deliveryDate).
|
|
22
|
+
*/
|
|
23
|
+
deliveryDate: z.coerce.date().optional(),
|
|
24
|
+
// Период даты отгрузки/выдачи заказа (`plannedShipmentDate`) — и доставка, и самовывоз; имена
|
|
25
|
+
// остались от фильтра по дате доставки. Календарные дни `YYYY-MM-DD`, обе границы включительно.
|
|
26
|
+
deliveryDateFrom: z.coerce.date().optional(),
|
|
27
|
+
deliveryDateTo: z.coerce.date().optional(),
|
|
28
|
+
byProductSearchQuery: z.string().optional(),
|
|
29
|
+
statuses: z.nativeEnum(OrderStatusEnum).array().optional(),
|
|
30
|
+
source: z.nativeEnum(OrderSourceEnum).optional(),
|
|
31
|
+
type: z.nativeEnum(OrderTypeEnum).optional(),
|
|
32
|
+
city: z.string().optional(),
|
|
33
|
+
responsibleUserUUID: z.string().optional(),
|
|
34
|
+
group: z.string().optional(),
|
|
35
|
+
// Только заказы, ещё не включённые ни в один счёт на оплату — список для пикера при
|
|
36
|
+
// выставлении счёта. Комбинируется с остальными критериями обычным AND.
|
|
37
|
+
withoutPaymentInvoice: z.coerce.boolean().optional(),
|
|
38
|
+
// То же для передаточного документа — пикер заказов при выпуске УПД. Здесь `queryBooleanSchema`,
|
|
39
|
+
// а не `z.coerce.boolean()`: в query всегда приходит текст, и `Boolean('false') === true`,
|
|
40
|
+
// то есть флаг соседа невозможно выключить явным значением, только опустив параметр.
|
|
41
|
+
withoutTransferDocument: queryBooleanSchema,
|
|
42
|
+
})
|
|
43
|
+
.refine(
|
|
44
|
+
value => {
|
|
45
|
+
const { startDate, endDate } = value;
|
|
46
|
+
if (startDate && endDate) {
|
|
47
|
+
return dateRangeCheck(startDate, endDate);
|
|
48
|
+
}
|
|
49
|
+
return true;
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
message: 'validation.dateRange',
|
|
53
|
+
path: ['endDate', 'startDate'],
|
|
54
|
+
},
|
|
55
|
+
)
|
|
56
|
+
.refine(
|
|
57
|
+
value => {
|
|
58
|
+
const { deliveryDateFrom, deliveryDateTo } = value;
|
|
59
|
+
if (deliveryDateFrom && deliveryDateTo) {
|
|
60
|
+
return dateRangeCheck(deliveryDateFrom, deliveryDateTo);
|
|
61
|
+
}
|
|
62
|
+
return true;
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
message: 'validation.dateRange',
|
|
66
|
+
path: ['deliveryDateTo', 'deliveryDateFrom'],
|
|
67
|
+
},
|
|
68
|
+
);
|
package/schemas/order/index.ts
CHANGED
|
@@ -29,3 +29,11 @@ export * from './order-vat-transition-execute-result.schema';
|
|
|
29
29
|
export * from './order-vat-transition-execute-response.schema';
|
|
30
30
|
|
|
31
31
|
export * from './order-vat-source-confirmation.schema';
|
|
32
|
+
|
|
33
|
+
export * from './get-order-list-request.schema';
|
|
34
|
+
|
|
35
|
+
export * from './get-order-list-response.schema';
|
|
36
|
+
|
|
37
|
+
export * from './get-order-list-response-data.schema';
|
|
38
|
+
|
|
39
|
+
export * from './order-creator.schema';
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { OrderCreatorSchema } from './order-creator.schema';
|
|
2
|
+
import { OrderSourceEnum } from '../../enum/order-source.enum';
|
|
1
3
|
import { z } from 'zod';
|
|
2
4
|
import { ClientSchema } from '../client/client-base.schema';
|
|
3
5
|
import { BranchSchema } from '../branch/branch.schema';
|
|
@@ -6,6 +8,8 @@ import { DeliveryRouteSchema } from '../delivery-route/delivery-route.schema';
|
|
|
6
8
|
import { OrderSchema } from './order-base.schema';
|
|
7
9
|
|
|
8
10
|
export const OrderExtendedSchema = OrderSchema.extend({
|
|
11
|
+
source: z.nativeEnum(OrderSourceEnum).nullable(),
|
|
12
|
+
creator: OrderCreatorSchema.nullable(),
|
|
9
13
|
client: ClientSchema,
|
|
10
14
|
branch: BranchSchema.nullable(),
|
|
11
15
|
delivery: OrderDeliverySchema.nullable(),
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { OrderSourceEnum } from '../../enum/order-source.enum';
|
|
1
2
|
import { z } from 'zod';
|
|
2
3
|
import { optionalQueryBooleanSchema } from '../../helpers/optional-query-boolean.helper';
|
|
3
4
|
import { PreOrderStatusEnum } from '../../enum';
|
|
4
5
|
|
|
5
6
|
export const GetPreOrderListRequestSchema = z.object({
|
|
7
|
+
source: z.nativeEnum(OrderSourceEnum).optional(),
|
|
6
8
|
page: z.string().transform(val => Number(val) || 1),
|
|
7
9
|
excludeClosed: optionalQueryBooleanSchema,
|
|
8
10
|
count: z.coerce.number().optional().default(10),
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { OrderCreatorSchema } from '../order/order-creator.schema';
|
|
2
|
+
import { OrderSourceEnum } from '../../enum/order-source.enum';
|
|
1
3
|
import { PreOrderConversionCurrentOrderSchema } from './pre-order-conversion-current-order.schema';
|
|
2
4
|
import { PreOrderConversionChangeSchema } from './pre-order-conversion-change.schema';
|
|
3
5
|
import { PreOrderConversionSummarySchema } from './pre-order-conversion-summary.schema';
|
|
@@ -23,6 +25,8 @@ export const PreOrderSchema = z.object({
|
|
|
23
25
|
});
|
|
24
26
|
|
|
25
27
|
export const PreOrderExtendedSchema = PreOrderSchema.extend({
|
|
28
|
+
source: z.nativeEnum(OrderSourceEnum).nullable(),
|
|
29
|
+
creator: OrderCreatorSchema.nullable(),
|
|
26
30
|
client: ClientSchema,
|
|
27
31
|
branch: BranchSchema.nullable(),
|
|
28
32
|
preOrderCollection: PreOrderCollectionSchema.nullable(),
|