@floristcloud/api-lib 1.2.201 → 1.2.202
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/pre-order-collection-item/index.js +1 -0
- package/build/commands/pre-order-collection-item/update-group-pre-order-collection-item-products-matching.command.js +10 -0
- package/build/constant/error.js +10 -0
- package/build/enum/index.js +1 -0
- package/build/enum/pre-order-collection-item-products-matching-mode.enum.js +13 -0
- package/build/schemas/pre-order/analyze-create-orders-from-pre-orders-request.schema.js +0 -1
- package/build/schemas/pre-order/group-create-orders-from-pre-orders-request.schema.js +0 -1
- package/build/schemas/pre-order/index.js +1 -0
- package/build/schemas/pre-order/pre-order-conversion-line-comment-max-length.constant.js +5 -0
- package/build/schemas/pre-order/pre-order-conversion-match.schema.js +2 -0
- package/build/schemas/pre-order/pre-order-conversion-plan-allocation.schema.js +7 -1
- package/build/schemas/pre-order-collection-item/index.js +4 -0
- package/build/schemas/pre-order-collection-item/products-matching-group-products-limit.constant.js +5 -0
- package/build/schemas/pre-order-collection-item/update-group-pre-order-collection-item-products-matching-request.schema.js +22 -0
- package/build/schemas/pre-order-collection-item/update-group-pre-order-collection-item-products-matching-response.schema.js +9 -0
- package/build/schemas/pre-order-collection-item/update-group-pre-order-collection-item-products-matching-result.schema.js +9 -0
- package/commands/pre-order-collection-item/index.ts +1 -0
- package/commands/pre-order-collection-item/update-group-pre-order-collection-item-products-matching.command.ts +11 -0
- package/constant/error.ts +10 -0
- package/enum/index.ts +1 -0
- package/enum/pre-order-collection-item-products-matching-mode.enum.ts +9 -0
- package/package.json +1 -1
- package/schemas/pre-order/analyze-create-orders-from-pre-orders-request.schema.ts +0 -1
- package/schemas/pre-order/group-create-orders-from-pre-orders-request.schema.ts +0 -1
- package/schemas/pre-order/index.ts +1 -0
- package/schemas/pre-order/pre-order-conversion-line-comment-max-length.constant.ts +2 -0
- package/schemas/pre-order/pre-order-conversion-match.schema.ts +2 -0
- package/schemas/pre-order/pre-order-conversion-plan-allocation.schema.ts +7 -1
- package/schemas/pre-order-collection-item/index.ts +4 -0
- package/schemas/pre-order-collection-item/products-matching-group-products-limit.constant.ts +2 -0
- package/schemas/pre-order-collection-item/update-group-pre-order-collection-item-products-matching-request.schema.ts +20 -0
- package/schemas/pre-order-collection-item/update-group-pre-order-collection-item-products-matching-response.schema.ts +7 -0
- package/schemas/pre-order-collection-item/update-group-pre-order-collection-item-products-matching-result.schema.ts +7 -0
|
@@ -46,3 +46,4 @@ __exportStar(require("./supplier-add-pre-order-collection-items-analyze.command"
|
|
|
46
46
|
__exportStar(require("./supplier-add-pre-order-collection-items-execute.command"), exports);
|
|
47
47
|
__exportStar(require("./supplier-sync-pre-order-collection-items-analyze.command"), exports);
|
|
48
48
|
__exportStar(require("./supplier-sync-pre-order-collection-items-execute.command"), exports);
|
|
49
|
+
__exportStar(require("./update-group-pre-order-collection-item-products-matching.command"), exports);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateGroupPreOrderCollectionItemProductsMatchingContractCommand = void 0;
|
|
4
|
+
const update_group_pre_order_collection_item_products_matching_request_schema_1 = require("../../schemas/pre-order-collection-item/update-group-pre-order-collection-item-products-matching-request.schema");
|
|
5
|
+
const update_group_pre_order_collection_item_products_matching_response_schema_1 = require("../../schemas/pre-order-collection-item/update-group-pre-order-collection-item-products-matching-response.schema");
|
|
6
|
+
var UpdateGroupPreOrderCollectionItemProductsMatchingContractCommand;
|
|
7
|
+
(function (UpdateGroupPreOrderCollectionItemProductsMatchingContractCommand) {
|
|
8
|
+
UpdateGroupPreOrderCollectionItemProductsMatchingContractCommand.RequestSchema = update_group_pre_order_collection_item_products_matching_request_schema_1.UpdateGroupPreOrderCollectionItemProductsMatchingRequestSchema;
|
|
9
|
+
UpdateGroupPreOrderCollectionItemProductsMatchingContractCommand.ResponseSchema = update_group_pre_order_collection_item_products_matching_response_schema_1.UpdateGroupPreOrderCollectionItemProductsMatchingResponseSchema;
|
|
10
|
+
})(UpdateGroupPreOrderCollectionItemProductsMatchingContractCommand || (exports.UpdateGroupPreOrderCollectionItemProductsMatchingContractCommand = UpdateGroupPreOrderCollectionItemProductsMatchingContractCommand = {}));
|
package/build/constant/error.js
CHANGED
|
@@ -1460,6 +1460,16 @@ exports.ERRORS = {
|
|
|
1460
1460
|
message: 'Multiplicity option of the pre order collection item not found',
|
|
1461
1461
|
httpCode: 404,
|
|
1462
1462
|
},
|
|
1463
|
+
PRE_ORDER_COLLECTION_ITEM_MATCHING_PRODUCT_NOT_FOUND: {
|
|
1464
|
+
code: 'POCI041',
|
|
1465
|
+
message: 'Some of the products to link were not found in the company',
|
|
1466
|
+
httpCode: 404,
|
|
1467
|
+
},
|
|
1468
|
+
PRE_ORDER_COLLECTION_ITEM_PRODUCTS_MATCHING_GROUP_UPDATE_FAILED: {
|
|
1469
|
+
code: 'POCI042',
|
|
1470
|
+
message: 'Failed to update linked products of pre order collection items',
|
|
1471
|
+
httpCode: 500,
|
|
1472
|
+
},
|
|
1463
1473
|
// EMPLOYEE SCHEDULE
|
|
1464
1474
|
EMPLOYEE_SCHEDULE_NOT_CREATED: { code: 'ES001', message: 'Failed to create employee schedule', httpCode: 500 },
|
|
1465
1475
|
EMPLOYEE_SCHEDULE_NOT_DELETED: { code: 'ES002', message: 'Failed to delete employee schedule', httpCode: 500 },
|
package/build/enum/index.js
CHANGED
|
@@ -37,6 +37,7 @@ __exportStar(require("./client-type.enum"), exports);
|
|
|
37
37
|
__exportStar(require("./client-updated-field.enum"), exports);
|
|
38
38
|
__exportStar(require("./collection-item-multiplicity-option-operation.enum"), exports);
|
|
39
39
|
__exportStar(require("./collection-item-updated-field.enum"), exports);
|
|
40
|
+
__exportStar(require("./pre-order-collection-item-products-matching-mode.enum"), exports);
|
|
40
41
|
__exportStar(require("./color-code.enum"), exports);
|
|
41
42
|
__exportStar(require("./companyStatus.enum"), exports);
|
|
42
43
|
__exportStar(require("./consignment-access-client-status.enum"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PreOrderCollectionItemProductsMatchingModeEnum = void 0;
|
|
4
|
+
// Как групповая правка меняет связанные товары позиций коллекции.
|
|
5
|
+
var PreOrderCollectionItemProductsMatchingModeEnum;
|
|
6
|
+
(function (PreOrderCollectionItemProductsMatchingModeEnum) {
|
|
7
|
+
// Связанные товары позиции становятся ровно переданным списком; пустой список снимает все связи.
|
|
8
|
+
PreOrderCollectionItemProductsMatchingModeEnum["REPLACE"] = "REPLACE";
|
|
9
|
+
// Переданные товары добавляются к уже связанным.
|
|
10
|
+
PreOrderCollectionItemProductsMatchingModeEnum["ADD"] = "ADD";
|
|
11
|
+
// Переданные товары отвязываются, остальные связи остаются.
|
|
12
|
+
PreOrderCollectionItemProductsMatchingModeEnum["REMOVE"] = "REMOVE";
|
|
13
|
+
})(PreOrderCollectionItemProductsMatchingModeEnum || (exports.PreOrderCollectionItemProductsMatchingModeEnum = PreOrderCollectionItemProductsMatchingModeEnum = {}));
|
|
@@ -9,5 +9,4 @@ exports.AnalyzeCreateOrdersFromPreOrdersRequestSchema = zod_1.z.object({
|
|
|
9
9
|
preOrderUUIDs: zod_1.z.uuid().array(),
|
|
10
10
|
consignmentUUIDs: zod_1.z.uuid().array(),
|
|
11
11
|
matchingConfig: matching_config_schema_1.MatchingConfigSchema.optional().nullable(),
|
|
12
|
-
isProportionalAllocation: zod_1.z.coerce.boolean().optional(),
|
|
13
12
|
});
|
|
@@ -8,7 +8,6 @@ exports.GroupCreateOrdersFromPreOrdersRequestSchema = zod_1.z.object({
|
|
|
8
8
|
preOrderUUIDs: zod_1.z.uuid().array(),
|
|
9
9
|
consignmentUUIDs: zod_1.z.uuid().array(),
|
|
10
10
|
matchingConfig: matching_config_schema_1.MatchingConfigSchema.optional().nullable(),
|
|
11
|
-
isProportionalAllocation: zod_1.z.coerce.boolean().optional(),
|
|
12
11
|
orderProductTag: zod_1.z.string().nullable().optional(),
|
|
13
12
|
confirmCloseRemainder: zod_1.z.boolean().optional(),
|
|
14
13
|
// Оформляется только подтверждённый сотрудником план: без него сервер подобрал бы товары заново, и в заказы
|
|
@@ -54,6 +54,7 @@ __exportStar(require("./standing-order-conversion-result.schema"), exports);
|
|
|
54
54
|
__exportStar(require("./standing-order-conversion-target-pre-order.schema"), exports);
|
|
55
55
|
__exportStar(require("./standing-order-conversion-target.schema"), exports);
|
|
56
56
|
__exportStar(require("./pre-order-conversion-plan-allocation.schema"), exports);
|
|
57
|
+
__exportStar(require("./pre-order-conversion-line-comment-max-length.constant"), exports);
|
|
57
58
|
__exportStar(require("./pre-order-conversion-failed-error.schema"), exports);
|
|
58
59
|
__exportStar(require("./group-create-orders-from-pre-orders-data.schema"), exports);
|
|
59
60
|
__exportStar(require("./group-create-orders-from-pre-orders-request.schema"), exports);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PRE_ORDER_CONVERSION_LINE_COMMENT_MAX_LENGTH = void 0;
|
|
4
|
+
// Предел комментария строки заказа, который сотрудник задаёт в предпросмотре оформления предзаказа.
|
|
5
|
+
exports.PRE_ORDER_CONVERSION_LINE_COMMENT_MAX_LENGTH = 1000;
|
|
@@ -10,4 +10,6 @@ exports.PreOrderConversionMatchSchema = zod_1.z.object({
|
|
|
10
10
|
description: pre_order_conversion_match_description_schema_1.PreOrderConversionMatchDescriptionSchema.optional(),
|
|
11
11
|
price: zod_1.z.string().optional(),
|
|
12
12
|
remainingBalance: zod_1.z.number(),
|
|
13
|
+
// Комментарий строки заказа, который сервер запишет по умолчанию; предпросмотр показывает и даёт править.
|
|
14
|
+
suggestedComment: zod_1.z.string().nullable().optional(),
|
|
13
15
|
});
|
|
@@ -2,4 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PreOrderConversionPlanAllocationSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
|
|
5
|
+
const pre_order_conversion_line_comment_max_length_constant_1 = require("./pre-order-conversion-line-comment-max-length.constant");
|
|
6
|
+
exports.PreOrderConversionPlanAllocationSchema = zod_1.z.object({
|
|
7
|
+
productUUID: zod_1.z.uuid(),
|
|
8
|
+
quantity: zod_1.z.number().int().positive(),
|
|
9
|
+
// Комментарий строки заказа: не передан — сервер пишет комментарий по умолчанию, null — без комментария.
|
|
10
|
+
comment: zod_1.z.string().trim().max(pre_order_conversion_line_comment_max_length_constant_1.PRE_ORDER_CONVERSION_LINE_COMMENT_MAX_LENGTH).nullable().optional(),
|
|
11
|
+
});
|
|
@@ -96,3 +96,7 @@ __exportStar(require("./import-pre-order-collection-item-response.schema"), expo
|
|
|
96
96
|
__exportStar(require("./update-group-pre-order-collection-item-request.schema"), exports);
|
|
97
97
|
__exportStar(require("./update-group-pre-order-collection-item-response-data.schema"), exports);
|
|
98
98
|
__exportStar(require("./update-group-pre-order-collection-item-response.schema"), exports);
|
|
99
|
+
__exportStar(require("./products-matching-group-products-limit.constant"), exports);
|
|
100
|
+
__exportStar(require("./update-group-pre-order-collection-item-products-matching-request.schema"), exports);
|
|
101
|
+
__exportStar(require("./update-group-pre-order-collection-item-products-matching-result.schema"), exports);
|
|
102
|
+
__exportStar(require("./update-group-pre-order-collection-item-products-matching-response.schema"), exports);
|
package/build/schemas/pre-order-collection-item/products-matching-group-products-limit.constant.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PRODUCTS_MATCHING_GROUP_PRODUCTS_LIMIT = void 0;
|
|
4
|
+
// Не больше стольких товаров в одной групповой правке связей: связь пишется на каждую пару «позиция × товар».
|
|
5
|
+
exports.PRODUCTS_MATCHING_GROUP_PRODUCTS_LIMIT = 50;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateGroupPreOrderCollectionItemProductsMatchingRequestSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const pre_order_collection_item_products_matching_mode_enum_1 = require("../../enum/pre-order-collection-item-products-matching-mode.enum");
|
|
6
|
+
const products_matching_group_products_limit_constant_1 = require("./products-matching-group-products-limit.constant");
|
|
7
|
+
// Позиции выбираются списком, категориями коллекции или тем и другим сразу (объединение).
|
|
8
|
+
exports.UpdateGroupPreOrderCollectionItemProductsMatchingRequestSchema = zod_1.z
|
|
9
|
+
.object({
|
|
10
|
+
mode: zod_1.z.enum(pre_order_collection_item_products_matching_mode_enum_1.PreOrderCollectionItemProductsMatchingModeEnum),
|
|
11
|
+
productUUIDs: zod_1.z.uuid().array().max(products_matching_group_products_limit_constant_1.PRODUCTS_MATCHING_GROUP_PRODUCTS_LIMIT),
|
|
12
|
+
preOrderCollectionItemUUIDs: zod_1.z.uuid().array().optional(),
|
|
13
|
+
categoryUUIDs: zod_1.z.uuid().array().optional(),
|
|
14
|
+
})
|
|
15
|
+
.refine(value => { var _a, _b; return Boolean(((_a = value.preOrderCollectionItemUUIDs) === null || _a === void 0 ? void 0 : _a.length) || ((_b = value.categoryUUIDs) === null || _b === void 0 ? void 0 : _b.length)); }, {
|
|
16
|
+
message: 'Select collection items or categories',
|
|
17
|
+
path: ['preOrderCollectionItemUUIDs'],
|
|
18
|
+
})
|
|
19
|
+
.refine(value => value.mode === pre_order_collection_item_products_matching_mode_enum_1.PreOrderCollectionItemProductsMatchingModeEnum.REPLACE || value.productUUIDs.length > 0, {
|
|
20
|
+
message: 'Products are required to add or remove links',
|
|
21
|
+
path: ['productUUIDs'],
|
|
22
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateGroupPreOrderCollectionItemProductsMatchingResponseSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const update_group_pre_order_collection_item_products_matching_result_schema_1 = require("./update-group-pre-order-collection-item-products-matching-result.schema");
|
|
6
|
+
exports.UpdateGroupPreOrderCollectionItemProductsMatchingResponseSchema = zod_1.z.object({
|
|
7
|
+
message: zod_1.z.string().optional(),
|
|
8
|
+
data: update_group_pre_order_collection_item_products_matching_result_schema_1.UpdateGroupPreOrderCollectionItemProductsMatchingResultSchema,
|
|
9
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateGroupPreOrderCollectionItemProductsMatchingResultSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.UpdateGroupPreOrderCollectionItemProductsMatchingResultSchema = zod_1.z.object({
|
|
6
|
+
// Сколько позиций попало в выбор и у скольких связи действительно изменились.
|
|
7
|
+
selectedCount: zod_1.z.number().int().nonnegative(),
|
|
8
|
+
updatedCount: zod_1.z.number().int().nonnegative(),
|
|
9
|
+
});
|
|
@@ -30,3 +30,4 @@ export * from './supplier-add-pre-order-collection-items-analyze.command';
|
|
|
30
30
|
export * from './supplier-add-pre-order-collection-items-execute.command';
|
|
31
31
|
export * from './supplier-sync-pre-order-collection-items-analyze.command';
|
|
32
32
|
export * from './supplier-sync-pre-order-collection-items-execute.command';
|
|
33
|
+
export * from './update-group-pre-order-collection-item-products-matching.command';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import { UpdateGroupPreOrderCollectionItemProductsMatchingRequestSchema } from '../../schemas/pre-order-collection-item/update-group-pre-order-collection-item-products-matching-request.schema';
|
|
3
|
+
import { UpdateGroupPreOrderCollectionItemProductsMatchingResponseSchema } from '../../schemas/pre-order-collection-item/update-group-pre-order-collection-item-products-matching-response.schema';
|
|
4
|
+
|
|
5
|
+
export namespace UpdateGroupPreOrderCollectionItemProductsMatchingContractCommand {
|
|
6
|
+
export const RequestSchema = UpdateGroupPreOrderCollectionItemProductsMatchingRequestSchema;
|
|
7
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
8
|
+
|
|
9
|
+
export const ResponseSchema = UpdateGroupPreOrderCollectionItemProductsMatchingResponseSchema;
|
|
10
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
11
|
+
}
|
package/constant/error.ts
CHANGED
|
@@ -1504,6 +1504,16 @@ export const ERRORS = {
|
|
|
1504
1504
|
message: 'Multiplicity option of the pre order collection item not found',
|
|
1505
1505
|
httpCode: 404,
|
|
1506
1506
|
},
|
|
1507
|
+
PRE_ORDER_COLLECTION_ITEM_MATCHING_PRODUCT_NOT_FOUND: {
|
|
1508
|
+
code: 'POCI041',
|
|
1509
|
+
message: 'Some of the products to link were not found in the company',
|
|
1510
|
+
httpCode: 404,
|
|
1511
|
+
},
|
|
1512
|
+
PRE_ORDER_COLLECTION_ITEM_PRODUCTS_MATCHING_GROUP_UPDATE_FAILED: {
|
|
1513
|
+
code: 'POCI042',
|
|
1514
|
+
message: 'Failed to update linked products of pre order collection items',
|
|
1515
|
+
httpCode: 500,
|
|
1516
|
+
},
|
|
1507
1517
|
|
|
1508
1518
|
// EMPLOYEE SCHEDULE
|
|
1509
1519
|
EMPLOYEE_SCHEDULE_NOT_CREATED: { code: 'ES001', message: 'Failed to create employee schedule', httpCode: 500 },
|
package/enum/index.ts
CHANGED
|
@@ -21,6 +21,7 @@ export * from './client-type.enum';
|
|
|
21
21
|
export * from './client-updated-field.enum';
|
|
22
22
|
export * from './collection-item-multiplicity-option-operation.enum';
|
|
23
23
|
export * from './collection-item-updated-field.enum';
|
|
24
|
+
export * from './pre-order-collection-item-products-matching-mode.enum';
|
|
24
25
|
export * from './color-code.enum';
|
|
25
26
|
export * from './companyStatus.enum';
|
|
26
27
|
export * from './consignment-access-client-status.enum';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Как групповая правка меняет связанные товары позиций коллекции.
|
|
2
|
+
export enum PreOrderCollectionItemProductsMatchingModeEnum {
|
|
3
|
+
// Связанные товары позиции становятся ровно переданным списком; пустой список снимает все связи.
|
|
4
|
+
REPLACE = 'REPLACE',
|
|
5
|
+
// Переданные товары добавляются к уже связанным.
|
|
6
|
+
ADD = 'ADD',
|
|
7
|
+
// Переданные товары отвязываются, остальные связи остаются.
|
|
8
|
+
REMOVE = 'REMOVE',
|
|
9
|
+
}
|
package/package.json
CHANGED
|
@@ -7,5 +7,4 @@ export const AnalyzeCreateOrdersFromPreOrdersRequestSchema = z.object({
|
|
|
7
7
|
preOrderUUIDs: z.uuid().array(),
|
|
8
8
|
consignmentUUIDs: z.uuid().array(),
|
|
9
9
|
matchingConfig: MatchingConfigSchema.optional().nullable(),
|
|
10
|
-
isProportionalAllocation: z.coerce.boolean().optional(),
|
|
11
10
|
});
|
|
@@ -6,7 +6,6 @@ export const GroupCreateOrdersFromPreOrdersRequestSchema = z.object({
|
|
|
6
6
|
preOrderUUIDs: z.uuid().array(),
|
|
7
7
|
consignmentUUIDs: z.uuid().array(),
|
|
8
8
|
matchingConfig: MatchingConfigSchema.optional().nullable(),
|
|
9
|
-
isProportionalAllocation: z.coerce.boolean().optional(),
|
|
10
9
|
orderProductTag: z.string().nullable().optional(),
|
|
11
10
|
confirmCloseRemainder: z.boolean().optional(),
|
|
12
11
|
// Оформляется только подтверждённый сотрудником план: без него сервер подобрал бы товары заново, и в заказы
|
|
@@ -38,6 +38,7 @@ export * from './standing-order-conversion-result.schema';
|
|
|
38
38
|
export * from './standing-order-conversion-target-pre-order.schema';
|
|
39
39
|
export * from './standing-order-conversion-target.schema';
|
|
40
40
|
export * from './pre-order-conversion-plan-allocation.schema';
|
|
41
|
+
export * from './pre-order-conversion-line-comment-max-length.constant';
|
|
41
42
|
export * from './pre-order-conversion-failed-error.schema';
|
|
42
43
|
export * from './group-create-orders-from-pre-orders-data.schema';
|
|
43
44
|
export * from './group-create-orders-from-pre-orders-request.schema';
|
|
@@ -8,4 +8,6 @@ export const PreOrderConversionMatchSchema = z.object({
|
|
|
8
8
|
description: PreOrderConversionMatchDescriptionSchema.optional(),
|
|
9
9
|
price: z.string().optional(),
|
|
10
10
|
remainingBalance: z.number(),
|
|
11
|
+
// Комментарий строки заказа, который сервер запишет по умолчанию; предпросмотр показывает и даёт править.
|
|
12
|
+
suggestedComment: z.string().nullable().optional(),
|
|
11
13
|
});
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { PRE_ORDER_CONVERSION_LINE_COMMENT_MAX_LENGTH } from './pre-order-conversion-line-comment-max-length.constant';
|
|
2
3
|
|
|
3
|
-
export const PreOrderConversionPlanAllocationSchema = z.object({
|
|
4
|
+
export const PreOrderConversionPlanAllocationSchema = z.object({
|
|
5
|
+
productUUID: z.uuid(),
|
|
6
|
+
quantity: z.number().int().positive(),
|
|
7
|
+
// Комментарий строки заказа: не передан — сервер пишет комментарий по умолчанию, null — без комментария.
|
|
8
|
+
comment: z.string().trim().max(PRE_ORDER_CONVERSION_LINE_COMMENT_MAX_LENGTH).nullable().optional(),
|
|
9
|
+
});
|
|
@@ -81,3 +81,7 @@ export * from './import-pre-order-collection-item-response.schema';
|
|
|
81
81
|
export * from './update-group-pre-order-collection-item-request.schema';
|
|
82
82
|
export * from './update-group-pre-order-collection-item-response-data.schema';
|
|
83
83
|
export * from './update-group-pre-order-collection-item-response.schema';
|
|
84
|
+
export * from './products-matching-group-products-limit.constant';
|
|
85
|
+
export * from './update-group-pre-order-collection-item-products-matching-request.schema';
|
|
86
|
+
export * from './update-group-pre-order-collection-item-products-matching-result.schema';
|
|
87
|
+
export * from './update-group-pre-order-collection-item-products-matching-response.schema';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PreOrderCollectionItemProductsMatchingModeEnum } from '../../enum/pre-order-collection-item-products-matching-mode.enum';
|
|
3
|
+
import { PRODUCTS_MATCHING_GROUP_PRODUCTS_LIMIT } from './products-matching-group-products-limit.constant';
|
|
4
|
+
|
|
5
|
+
// Позиции выбираются списком, категориями коллекции или тем и другим сразу (объединение).
|
|
6
|
+
export const UpdateGroupPreOrderCollectionItemProductsMatchingRequestSchema = z
|
|
7
|
+
.object({
|
|
8
|
+
mode: z.enum(PreOrderCollectionItemProductsMatchingModeEnum),
|
|
9
|
+
productUUIDs: z.uuid().array().max(PRODUCTS_MATCHING_GROUP_PRODUCTS_LIMIT),
|
|
10
|
+
preOrderCollectionItemUUIDs: z.uuid().array().optional(),
|
|
11
|
+
categoryUUIDs: z.uuid().array().optional(),
|
|
12
|
+
})
|
|
13
|
+
.refine(value => Boolean(value.preOrderCollectionItemUUIDs?.length || value.categoryUUIDs?.length), {
|
|
14
|
+
message: 'Select collection items or categories',
|
|
15
|
+
path: ['preOrderCollectionItemUUIDs'],
|
|
16
|
+
})
|
|
17
|
+
.refine(value => value.mode === PreOrderCollectionItemProductsMatchingModeEnum.REPLACE || value.productUUIDs.length > 0, {
|
|
18
|
+
message: 'Products are required to add or remove links',
|
|
19
|
+
path: ['productUUIDs'],
|
|
20
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { UpdateGroupPreOrderCollectionItemProductsMatchingResultSchema } from './update-group-pre-order-collection-item-products-matching-result.schema';
|
|
3
|
+
|
|
4
|
+
export const UpdateGroupPreOrderCollectionItemProductsMatchingResponseSchema = z.object({
|
|
5
|
+
message: z.string().optional(),
|
|
6
|
+
data: UpdateGroupPreOrderCollectionItemProductsMatchingResultSchema,
|
|
7
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const UpdateGroupPreOrderCollectionItemProductsMatchingResultSchema = z.object({
|
|
4
|
+
// Сколько позиций попало в выбор и у скольких связи действительно изменились.
|
|
5
|
+
selectedCount: z.number().int().nonnegative(),
|
|
6
|
+
updatedCount: z.number().int().nonnegative(),
|
|
7
|
+
});
|