@floristcloud/api-lib 1.2.154 → 1.2.155
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-product/group/create-standing-order-positions.command.js +40 -0
- package/build/commands/pre-order-product/index.js +1 -0
- package/build/constant/index.js +1 -0
- package/build/constant/standing-order-positions.constant.js +7 -0
- package/build/enum/index.js +1 -0
- package/build/enum/standing-order-position-source.enum.js +9 -0
- package/build/schemas/order-attachment/order-attachment.schema.js +3 -2
- package/commands/pre-order-product/group/create-standing-order-positions.command.ts +46 -0
- package/commands/pre-order-product/index.ts +1 -0
- package/constant/index.ts +1 -0
- package/constant/standing-order-positions.constant.ts +4 -0
- package/enum/index.ts +1 -0
- package/enum/standing-order-position-source.enum.ts +5 -0
- package/package.json +1 -1
- package/schemas/order-attachment/order-attachment.schema.ts +3 -2
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateStandingOrderPositionsContractCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const schemas_1 = require("../../../schemas");
|
|
6
|
+
const standing_order_position_source_enum_1 = require("../../../enum/standing-order-position-source.enum");
|
|
7
|
+
const standing_order_positions_constant_1 = require("../../../constant/standing-order-positions.constant");
|
|
8
|
+
// size: явное значение перекрывает источник (null — без размера); если поле не передано,
|
|
9
|
+
// размер источника переносится только для категорий с isSizeSeparate.
|
|
10
|
+
const StandingOrderPositionBaseSchema = zod_1.z.object({
|
|
11
|
+
quantity: zod_1.z.number().int().positive(),
|
|
12
|
+
size: zod_1.z.string().nullable().optional(),
|
|
13
|
+
});
|
|
14
|
+
const StandingOrderPositionSchema = zod_1.z.discriminatedUnion('source', [
|
|
15
|
+
StandingOrderPositionBaseSchema.extend({
|
|
16
|
+
source: zod_1.z.literal(standing_order_position_source_enum_1.StandingOrderPositionSourceEnum.PRE_ORDER_COLLECTION_ITEM),
|
|
17
|
+
preOrderCollectionItemUUID: zod_1.z.uuid(),
|
|
18
|
+
}),
|
|
19
|
+
StandingOrderPositionBaseSchema.extend({
|
|
20
|
+
source: zod_1.z.literal(standing_order_position_source_enum_1.StandingOrderPositionSourceEnum.PRODUCT),
|
|
21
|
+
productUUID: zod_1.z.uuid(),
|
|
22
|
+
}),
|
|
23
|
+
StandingOrderPositionBaseSchema.extend({
|
|
24
|
+
source: zod_1.z.literal(standing_order_position_source_enum_1.StandingOrderPositionSourceEnum.PRODUCT_IMAGE),
|
|
25
|
+
productImageUUID: zod_1.z.uuid(),
|
|
26
|
+
}),
|
|
27
|
+
]);
|
|
28
|
+
const CreateStandingOrderPositionsRequestSchema = zod_1.z.object({
|
|
29
|
+
positions: zod_1.z.array(StandingOrderPositionSchema).min(1).max(standing_order_positions_constant_1.STANDING_ORDER_POSITIONS_LIMITS.MAX_POSITIONS_PER_REQUEST),
|
|
30
|
+
});
|
|
31
|
+
const CreateStandingOrderPositionsResponseSchema = zod_1.z.object({
|
|
32
|
+
message: zod_1.z.string().optional(),
|
|
33
|
+
data: zod_1.z.array(schemas_1.PreOrderProductSchema),
|
|
34
|
+
});
|
|
35
|
+
var CreateStandingOrderPositionsContractCommand;
|
|
36
|
+
(function (CreateStandingOrderPositionsContractCommand) {
|
|
37
|
+
CreateStandingOrderPositionsContractCommand.PositionSchema = StandingOrderPositionSchema;
|
|
38
|
+
CreateStandingOrderPositionsContractCommand.RequestSchema = CreateStandingOrderPositionsRequestSchema;
|
|
39
|
+
CreateStandingOrderPositionsContractCommand.ResponseSchema = CreateStandingOrderPositionsResponseSchema;
|
|
40
|
+
})(CreateStandingOrderPositionsContractCommand || (exports.CreateStandingOrderPositionsContractCommand = CreateStandingOrderPositionsContractCommand = {}));
|
|
@@ -32,3 +32,4 @@ __exportStar(require("./create-manually-pre-order-product-for-standing-order.com
|
|
|
32
32
|
__exportStar(require("./get-pre-order-products-by-pre-order-list.command"), exports);
|
|
33
33
|
__exportStar(require("./set-pre-order-product-quantity-webshop.command"), exports);
|
|
34
34
|
__exportStar(require("./group/move-group-pre-order-product.command"), exports);
|
|
35
|
+
__exportStar(require("./group/create-standing-order-positions.command"), exports);
|
package/build/constant/index.js
CHANGED
|
@@ -29,3 +29,4 @@ __exportStar(require("./consignment-product-enrichment.constant"), exports);
|
|
|
29
29
|
__exportStar(require("./attribute-normalization.constant"), exports);
|
|
30
30
|
__exportStar(require("./product-image-merge.constant"), exports);
|
|
31
31
|
__exportStar(require("./client-group-actions.constant"), exports);
|
|
32
|
+
__exportStar(require("./standing-order-positions.constant"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.STANDING_ORDER_POSITIONS_LIMITS = void 0;
|
|
4
|
+
exports.STANDING_ORDER_POSITIONS_LIMITS = {
|
|
5
|
+
// Все позиции пакета создаются в одной транзакции: предел держит её короткой.
|
|
6
|
+
MAX_POSITIONS_PER_REQUEST: 200,
|
|
7
|
+
};
|
package/build/enum/index.js
CHANGED
|
@@ -144,3 +144,4 @@ __exportStar(require("./client-updated-field.enum"), exports);
|
|
|
144
144
|
__exportStar(require("./collection-item-updated-field.enum"), exports);
|
|
145
145
|
__exportStar(require("./action-log-operation.enum"), exports);
|
|
146
146
|
__exportStar(require("./collection-item-multiplicity-option-operation.enum"), exports);
|
|
147
|
+
__exportStar(require("./standing-order-position-source.enum"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StandingOrderPositionSourceEnum = void 0;
|
|
4
|
+
var StandingOrderPositionSourceEnum;
|
|
5
|
+
(function (StandingOrderPositionSourceEnum) {
|
|
6
|
+
StandingOrderPositionSourceEnum["PRE_ORDER_COLLECTION_ITEM"] = "PRE_ORDER_COLLECTION_ITEM";
|
|
7
|
+
StandingOrderPositionSourceEnum["PRODUCT"] = "PRODUCT";
|
|
8
|
+
StandingOrderPositionSourceEnum["PRODUCT_IMAGE"] = "PRODUCT_IMAGE";
|
|
9
|
+
})(StandingOrderPositionSourceEnum || (exports.StandingOrderPositionSourceEnum = StandingOrderPositionSourceEnum = {}));
|
|
@@ -4,8 +4,9 @@ exports.DeleteOrderAttachmentResponseSchema = exports.GetOrderAttachmentListResp
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const order_attachment_type_enum_1 = require("../../enum/order-attachment-type.enum");
|
|
6
6
|
/**
|
|
7
|
-
* Ссылка на файл в бакете (для FILE её отдаёт `PUT /files/upload
|
|
8
|
-
* Схему не сужаем до домена CDN: в LINK кладут ссылки на сторонние
|
|
7
|
+
* Ссылка на файл в бакете (для FILE её отдаёт загрузка в file-api, `PUT /api/v2/files/upload`) или
|
|
8
|
+
* внешний адрес (для LINK). Схему не сужаем до домена CDN: в LINK кладут ссылки на сторонние
|
|
9
|
+
* сервисы доставки.
|
|
9
10
|
*
|
|
10
11
|
* Протокол только http/https: `z.url()` сам по себе принимает и `javascript:`, и `data:text/html`,
|
|
11
12
|
* а вложение с включённой видимостью витрина отдаёт клиенту и рисует ссылкой — то есть сотрудник
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PreOrderProductSchema } from '../../../schemas';
|
|
3
|
+
import { StandingOrderPositionSourceEnum } from '../../../enum/standing-order-position-source.enum';
|
|
4
|
+
import { STANDING_ORDER_POSITIONS_LIMITS } from '../../../constant/standing-order-positions.constant';
|
|
5
|
+
|
|
6
|
+
// size: явное значение перекрывает источник (null — без размера); если поле не передано,
|
|
7
|
+
// размер источника переносится только для категорий с isSizeSeparate.
|
|
8
|
+
const StandingOrderPositionBaseSchema = z.object({
|
|
9
|
+
quantity: z.number().int().positive(),
|
|
10
|
+
size: z.string().nullable().optional(),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const StandingOrderPositionSchema = z.discriminatedUnion('source', [
|
|
14
|
+
StandingOrderPositionBaseSchema.extend({
|
|
15
|
+
source: z.literal(StandingOrderPositionSourceEnum.PRE_ORDER_COLLECTION_ITEM),
|
|
16
|
+
preOrderCollectionItemUUID: z.uuid(),
|
|
17
|
+
}),
|
|
18
|
+
StandingOrderPositionBaseSchema.extend({
|
|
19
|
+
source: z.literal(StandingOrderPositionSourceEnum.PRODUCT),
|
|
20
|
+
productUUID: z.uuid(),
|
|
21
|
+
}),
|
|
22
|
+
StandingOrderPositionBaseSchema.extend({
|
|
23
|
+
source: z.literal(StandingOrderPositionSourceEnum.PRODUCT_IMAGE),
|
|
24
|
+
productImageUUID: z.uuid(),
|
|
25
|
+
}),
|
|
26
|
+
]);
|
|
27
|
+
|
|
28
|
+
const CreateStandingOrderPositionsRequestSchema = z.object({
|
|
29
|
+
positions: z.array(StandingOrderPositionSchema).min(1).max(STANDING_ORDER_POSITIONS_LIMITS.MAX_POSITIONS_PER_REQUEST),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const CreateStandingOrderPositionsResponseSchema = z.object({
|
|
33
|
+
message: z.string().optional(),
|
|
34
|
+
data: z.array(PreOrderProductSchema),
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export namespace CreateStandingOrderPositionsContractCommand {
|
|
38
|
+
export const PositionSchema = StandingOrderPositionSchema;
|
|
39
|
+
export type Position = z.infer<typeof PositionSchema>;
|
|
40
|
+
|
|
41
|
+
export const RequestSchema = CreateStandingOrderPositionsRequestSchema;
|
|
42
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
43
|
+
|
|
44
|
+
export const ResponseSchema = CreateStandingOrderPositionsResponseSchema;
|
|
45
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
46
|
+
}
|
|
@@ -16,3 +16,4 @@ export * from './create-manually-pre-order-product-for-standing-order.command';
|
|
|
16
16
|
export * from './get-pre-order-products-by-pre-order-list.command';
|
|
17
17
|
export * from './set-pre-order-product-quantity-webshop.command';
|
|
18
18
|
export * from './group/move-group-pre-order-product.command';
|
|
19
|
+
export * from './group/create-standing-order-positions.command';
|
package/constant/index.ts
CHANGED
|
@@ -13,3 +13,4 @@ export * from './consignment-product-enrichment.constant';
|
|
|
13
13
|
export * from './attribute-normalization.constant';
|
|
14
14
|
export * from './product-image-merge.constant';
|
|
15
15
|
export * from './client-group-actions.constant';
|
|
16
|
+
export * from './standing-order-positions.constant';
|
package/enum/index.ts
CHANGED
|
@@ -128,3 +128,4 @@ export * from './client-updated-field.enum';
|
|
|
128
128
|
export * from './collection-item-updated-field.enum';
|
|
129
129
|
export * from './action-log-operation.enum';
|
|
130
130
|
export * from './collection-item-multiplicity-option-operation.enum';
|
|
131
|
+
export * from './standing-order-position-source.enum';
|
package/package.json
CHANGED
|
@@ -2,8 +2,9 @@ import { z } from 'zod';
|
|
|
2
2
|
import { OrderAttachmentTypeEnum } from '../../enum/order-attachment-type.enum';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Ссылка на файл в бакете (для FILE её отдаёт `PUT /files/upload
|
|
6
|
-
* Схему не сужаем до домена CDN: в LINK кладут ссылки на сторонние
|
|
5
|
+
* Ссылка на файл в бакете (для FILE её отдаёт загрузка в file-api, `PUT /api/v2/files/upload`) или
|
|
6
|
+
* внешний адрес (для LINK). Схему не сужаем до домена CDN: в LINK кладут ссылки на сторонние
|
|
7
|
+
* сервисы доставки.
|
|
7
8
|
*
|
|
8
9
|
* Протокол только http/https: `z.url()` сам по себе принимает и `javascript:`, и `data:text/html`,
|
|
9
10
|
* а вложение с включённой видимостью витрина отдаёт клиенту и рисует ссылкой — то есть сотрудник
|