@floristcloud/api-lib 1.2.59 → 1.2.61

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.
Files changed (47) hide show
  1. package/build/commands/consignment-transfer/accept-consignment-transfer.command.js +9 -0
  2. package/build/commands/consignment-transfer/cancel-consignment-transfer.command.js +8 -0
  3. package/build/commands/consignment-transfer/create-consignment-transfer.command.js +9 -0
  4. package/build/commands/consignment-transfer/get-consignment-transfer-list.query.js +9 -0
  5. package/build/commands/consignment-transfer/get-consignment-transfer.query.js +8 -0
  6. package/build/commands/consignment-transfer/index.js +22 -0
  7. package/build/commands/consignment-transfer/reject-consignment-transfer.command.js +9 -0
  8. package/build/commands/index.js +1 -0
  9. package/build/constant/error.js +14 -0
  10. package/build/enum/consignment-transfer-direction.enum.js +8 -0
  11. package/build/enum/consignment-transfer-request-status.enum.js +10 -0
  12. package/build/enum/index.js +2 -0
  13. package/build/schemas/consignment-transfer/accept-consignment-transfer.schema.js +32 -0
  14. package/build/schemas/consignment-transfer/cancel-consignment-transfer.schema.js +9 -0
  15. package/build/schemas/consignment-transfer/consignment-transfer-request-item.schema.js +24 -0
  16. package/build/schemas/consignment-transfer/consignment-transfer-request.schema.js +21 -0
  17. package/build/schemas/consignment-transfer/create-consignment-transfer.schema.js +21 -0
  18. package/build/schemas/consignment-transfer/get-consignment-transfer-list.schema.js +19 -0
  19. package/build/schemas/consignment-transfer/get-consignment-transfer.schema.js +17 -0
  20. package/build/schemas/consignment-transfer/index.js +24 -0
  21. package/build/schemas/consignment-transfer/reject-consignment-transfer.schema.js +12 -0
  22. package/build/schemas/index.js +1 -0
  23. package/build/schemas/order-product/order-product.schema.js +1 -0
  24. package/commands/consignment-transfer/accept-consignment-transfer.command.ts +13 -0
  25. package/commands/consignment-transfer/cancel-consignment-transfer.command.ts +7 -0
  26. package/commands/consignment-transfer/create-consignment-transfer.command.ts +13 -0
  27. package/commands/consignment-transfer/get-consignment-transfer-list.query.ts +13 -0
  28. package/commands/consignment-transfer/get-consignment-transfer.query.ts +7 -0
  29. package/commands/consignment-transfer/index.ts +6 -0
  30. package/commands/consignment-transfer/reject-consignment-transfer.command.ts +13 -0
  31. package/commands/index.ts +1 -0
  32. package/constant/error.ts +15 -0
  33. package/enum/consignment-transfer-direction.enum.ts +4 -0
  34. package/enum/consignment-transfer-request-status.enum.ts +6 -0
  35. package/enum/index.ts +2 -0
  36. package/package.json +1 -1
  37. package/schemas/consignment-transfer/accept-consignment-transfer.schema.ts +33 -0
  38. package/schemas/consignment-transfer/cancel-consignment-transfer.schema.ts +7 -0
  39. package/schemas/consignment-transfer/consignment-transfer-request-item.schema.ts +22 -0
  40. package/schemas/consignment-transfer/consignment-transfer-request.schema.ts +19 -0
  41. package/schemas/consignment-transfer/create-consignment-transfer.schema.ts +22 -0
  42. package/schemas/consignment-transfer/get-consignment-transfer-list.schema.ts +18 -0
  43. package/schemas/consignment-transfer/get-consignment-transfer.schema.ts +15 -0
  44. package/schemas/consignment-transfer/index.ts +8 -0
  45. package/schemas/consignment-transfer/reject-consignment-transfer.schema.ts +11 -0
  46. package/schemas/index.ts +1 -0
  47. package/schemas/order-product/order-product.schema.ts +1 -0
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AcceptConsignmentTransferContractCommand = void 0;
4
+ const accept_consignment_transfer_schema_1 = require("../../schemas/consignment-transfer/accept-consignment-transfer.schema");
5
+ var AcceptConsignmentTransferContractCommand;
6
+ (function (AcceptConsignmentTransferContractCommand) {
7
+ AcceptConsignmentTransferContractCommand.RequestSchema = accept_consignment_transfer_schema_1.AcceptConsignmentTransferRequestSchema;
8
+ AcceptConsignmentTransferContractCommand.ResponseSchema = accept_consignment_transfer_schema_1.AcceptConsignmentTransferResponseSchema;
9
+ })(AcceptConsignmentTransferContractCommand || (exports.AcceptConsignmentTransferContractCommand = AcceptConsignmentTransferContractCommand = {}));
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CancelConsignmentTransferContractCommand = void 0;
4
+ const cancel_consignment_transfer_schema_1 = require("../../schemas/consignment-transfer/cancel-consignment-transfer.schema");
5
+ var CancelConsignmentTransferContractCommand;
6
+ (function (CancelConsignmentTransferContractCommand) {
7
+ CancelConsignmentTransferContractCommand.ResponseSchema = cancel_consignment_transfer_schema_1.CancelConsignmentTransferResponseSchema;
8
+ })(CancelConsignmentTransferContractCommand || (exports.CancelConsignmentTransferContractCommand = CancelConsignmentTransferContractCommand = {}));
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateConsignmentTransferContractCommand = void 0;
4
+ const create_consignment_transfer_schema_1 = require("../../schemas/consignment-transfer/create-consignment-transfer.schema");
5
+ var CreateConsignmentTransferContractCommand;
6
+ (function (CreateConsignmentTransferContractCommand) {
7
+ CreateConsignmentTransferContractCommand.RequestSchema = create_consignment_transfer_schema_1.CreateConsignmentTransferRequestSchema;
8
+ CreateConsignmentTransferContractCommand.ResponseSchema = create_consignment_transfer_schema_1.CreateConsignmentTransferResponseSchema;
9
+ })(CreateConsignmentTransferContractCommand || (exports.CreateConsignmentTransferContractCommand = CreateConsignmentTransferContractCommand = {}));
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetConsignmentTransferListContractQuery = void 0;
4
+ const get_consignment_transfer_list_schema_1 = require("../../schemas/consignment-transfer/get-consignment-transfer-list.schema");
5
+ var GetConsignmentTransferListContractQuery;
6
+ (function (GetConsignmentTransferListContractQuery) {
7
+ GetConsignmentTransferListContractQuery.RequestSchema = get_consignment_transfer_list_schema_1.GetConsignmentTransferListRequestSchema;
8
+ GetConsignmentTransferListContractQuery.ResponseSchema = get_consignment_transfer_list_schema_1.GetConsignmentTransferListResponseSchema;
9
+ })(GetConsignmentTransferListContractQuery || (exports.GetConsignmentTransferListContractQuery = GetConsignmentTransferListContractQuery = {}));
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetConsignmentTransferContractQuery = void 0;
4
+ const get_consignment_transfer_schema_1 = require("../../schemas/consignment-transfer/get-consignment-transfer.schema");
5
+ var GetConsignmentTransferContractQuery;
6
+ (function (GetConsignmentTransferContractQuery) {
7
+ GetConsignmentTransferContractQuery.ResponseSchema = get_consignment_transfer_schema_1.GetConsignmentTransferResponseSchema;
8
+ })(GetConsignmentTransferContractQuery || (exports.GetConsignmentTransferContractQuery = GetConsignmentTransferContractQuery = {}));
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./create-consignment-transfer.command"), exports);
18
+ __exportStar(require("./get-consignment-transfer-list.query"), exports);
19
+ __exportStar(require("./get-consignment-transfer.query"), exports);
20
+ __exportStar(require("./cancel-consignment-transfer.command"), exports);
21
+ __exportStar(require("./reject-consignment-transfer.command"), exports);
22
+ __exportStar(require("./accept-consignment-transfer.command"), exports);
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RejectConsignmentTransferContractCommand = void 0;
4
+ const reject_consignment_transfer_schema_1 = require("../../schemas/consignment-transfer/reject-consignment-transfer.schema");
5
+ var RejectConsignmentTransferContractCommand;
6
+ (function (RejectConsignmentTransferContractCommand) {
7
+ RejectConsignmentTransferContractCommand.RequestSchema = reject_consignment_transfer_schema_1.RejectConsignmentTransferRequestSchema;
8
+ RejectConsignmentTransferContractCommand.ResponseSchema = reject_consignment_transfer_schema_1.RejectConsignmentTransferResponseSchema;
9
+ })(RejectConsignmentTransferContractCommand || (exports.RejectConsignmentTransferContractCommand = RejectConsignmentTransferContractCommand = {}));
@@ -78,3 +78,4 @@ var create_ws_ticket_command_1 = require("./session/create-ws-ticket.command");
78
78
  Object.defineProperty(exports, "CreateWsTicketContractCommand", { enumerable: true, get: function () { return create_ws_ticket_command_1.CreateWsTicketContractCommand; } });
79
79
  var validate_ws_ticket_s2s_query_1 = require("./session/validate-ws-ticket-s2s.query");
80
80
  Object.defineProperty(exports, "ValidateWsTicketS2SContractQuery", { enumerable: true, get: function () { return validate_ws_ticket_s2s_query_1.ValidateWsTicketS2SContractQuery; } });
81
+ __exportStar(require("./consignment-transfer"), exports);
@@ -1130,4 +1130,18 @@ exports.ERRORS = {
1130
1130
  ONE_C_INVALID_CREDENTIALS: { code: 'OC003', message: '1C credentials are invalid', httpCode: 401 },
1131
1131
  ONE_C_INTEGRATION_DISABLED: { code: 'OC004', message: '1C integration is disabled for this company', httpCode: 409 },
1132
1132
  ONE_C_SESSION_INVALID: { code: 'OC005', message: '1C session is missing or expired', httpCode: 401 },
1133
+ // CONSIGNMENT TRANSFER (FC-227)
1134
+ CONSIGNMENT_TRANSFER_NOT_CREATED: { code: 'CTR001', message: 'Failed to create consignment transfer request', httpCode: 500 },
1135
+ CONSIGNMENT_TRANSFER_NOT_FOUND: { code: 'CTR002', message: 'Consignment transfer request not found', httpCode: 404 },
1136
+ CONSIGNMENT_TRANSFER_FETCH_FAILED: { code: 'CTR003', message: 'Failed to fetch consignment transfer requests', httpCode: 500 },
1137
+ CONSIGNMENT_TRANSFER_RECEIVER_NOT_FOUND: { code: 'CTR004', message: 'Receiver company not found or inactive', httpCode: 404 },
1138
+ CONSIGNMENT_TRANSFER_RECEIVER_IS_SENDER: { code: 'CTR005', message: 'Cannot transfer a consignment to your own company', httpCode: 400 },
1139
+ CONSIGNMENT_TRANSFER_PRODUCT_NOT_FOUND: { code: 'CTR006', message: 'Transfer position not found in the source consignment', httpCode: 404 },
1140
+ CONSIGNMENT_TRANSFER_QUANTITY_EXCEEDS_BALANCE: { code: 'CTR007', message: 'Requested quantity exceeds the available product balance', httpCode: 400 },
1141
+ CONSIGNMENT_TRANSFER_NOT_PENDING: { code: 'CTR008', message: 'Consignment transfer request is not pending', httpCode: 409 },
1142
+ CONSIGNMENT_TRANSFER_NOT_UPDATED: { code: 'CTR009', message: 'Failed to update consignment transfer request', httpCode: 500 },
1143
+ CONSIGNMENT_TRANSFER_ITEMS_MISMATCH: { code: 'CTR010', message: 'Accept payload must map every transfer position exactly once', httpCode: 400 },
1144
+ CONSIGNMENT_TRANSFER_CATEGORY_NOT_FOUND: { code: 'CTR011', message: 'Mapped category not found in the receiver company', httpCode: 404 },
1145
+ CONSIGNMENT_TRANSFER_TARGET_CONSIGNMENT_NOT_FOUND: { code: 'CTR012', message: 'Target consignment not found in the receiver company', httpCode: 404 },
1146
+ CONSIGNMENT_TRANSFER_ACCEPT_FAILED: { code: 'CTR013', message: 'Failed to accept consignment transfer request', httpCode: 500 },
1133
1147
  };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConsignmentTransferDirectionEnum = void 0;
4
+ var ConsignmentTransferDirectionEnum;
5
+ (function (ConsignmentTransferDirectionEnum) {
6
+ ConsignmentTransferDirectionEnum["INCOMING"] = "incoming";
7
+ ConsignmentTransferDirectionEnum["OUTGOING"] = "outgoing";
8
+ })(ConsignmentTransferDirectionEnum || (exports.ConsignmentTransferDirectionEnum = ConsignmentTransferDirectionEnum = {}));
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConsignmentTransferRequestStatusEnum = void 0;
4
+ var ConsignmentTransferRequestStatusEnum;
5
+ (function (ConsignmentTransferRequestStatusEnum) {
6
+ ConsignmentTransferRequestStatusEnum["PENDING"] = "PENDING";
7
+ ConsignmentTransferRequestStatusEnum["ACCEPTED"] = "ACCEPTED";
8
+ ConsignmentTransferRequestStatusEnum["REJECTED"] = "REJECTED";
9
+ ConsignmentTransferRequestStatusEnum["CANCELLED"] = "CANCELLED";
10
+ })(ConsignmentTransferRequestStatusEnum || (exports.ConsignmentTransferRequestStatusEnum = ConsignmentTransferRequestStatusEnum = {}));
@@ -100,4 +100,6 @@ __exportStar(require("./account-deletion-request-source.enum"), exports);
100
100
  __exportStar(require("./bulk-create-product-image-alias-skip-reason.enum"), exports);
101
101
  __exportStar(require("./bulk-create-product-image-alias-from-pre-order-collection-item-skip-reason.enum"), exports);
102
102
  __exportStar(require("./moysklad-sync-status.enum"), exports);
103
+ __exportStar(require("./consignment-transfer-request-status.enum"), exports);
104
+ __exportStar(require("./consignment-transfer-direction.enum"), exports);
103
105
  __exportStar(require("./legal-identifier-field.enum"), exports);
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AcceptConsignmentTransferResponseSchema = exports.AcceptConsignmentTransferRequestSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const consignment_transfer_request_schema_1 = require("./consignment-transfer-request.schema");
6
+ exports.AcceptConsignmentTransferRequestSchema = zod_1.z
7
+ .object({
8
+ // Accept into an existing consignment of the receiver OR create a new one — exactly one of the two.
9
+ targetConsignmentUUID: zod_1.z.uuid().optional(),
10
+ newConsignment: zod_1.z
11
+ .object({
12
+ deliveryDate: zod_1.z.coerce.date().min(new Date('2000-01-01')).max(new Date('2100-01-01')),
13
+ description: zod_1.z.string().max(2000).nullable().optional(),
14
+ label: zod_1.z.string().max(255).nullable().optional(),
15
+ })
16
+ .optional(),
17
+ items: zod_1.z
18
+ .array(zod_1.z.object({
19
+ itemUUID: zod_1.z.uuid(),
20
+ categoryUUID: zod_1.z.uuid(),
21
+ price: zod_1.z.number().min(0).optional(),
22
+ }))
23
+ .min(1),
24
+ })
25
+ .refine(data => Boolean(data.targetConsignmentUUID) !== Boolean(data.newConsignment), {
26
+ message: 'Provide either targetConsignmentUUID or newConsignment, not both',
27
+ path: ['targetConsignmentUUID'],
28
+ });
29
+ exports.AcceptConsignmentTransferResponseSchema = zod_1.z.object({
30
+ message: zod_1.z.string().optional(),
31
+ data: consignment_transfer_request_schema_1.ConsignmentTransferRequestSchema,
32
+ });
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CancelConsignmentTransferResponseSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const consignment_transfer_request_schema_1 = require("./consignment-transfer-request.schema");
6
+ exports.CancelConsignmentTransferResponseSchema = zod_1.z.object({
7
+ message: zod_1.z.string().optional(),
8
+ data: consignment_transfer_request_schema_1.ConsignmentTransferRequestSchema,
9
+ });
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConsignmentTransferRequestItemSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.ConsignmentTransferRequestItemSchema = zod_1.z.object({
6
+ uuid: zod_1.z.uuid(),
7
+ sourceProductUUID: zod_1.z.uuid(),
8
+ targetProductUUID: zod_1.z.uuid().nullable(),
9
+ name: zod_1.z.string(),
10
+ quantity: zod_1.z.number().int(),
11
+ transferPrice: zod_1.z.number(),
12
+ categoryName: zod_1.z.string().nullable(),
13
+ multiplicity: zod_1.z.number().int(),
14
+ grower: zod_1.z.string().nullable(),
15
+ size: zod_1.z.string().nullable(),
16
+ size2: zod_1.z.string().nullable(),
17
+ size3: zod_1.z.string().nullable(),
18
+ color: zod_1.z.string().nullable(),
19
+ country: zod_1.z.string().nullable(),
20
+ article: zod_1.z.string().nullable(),
21
+ barcode: zod_1.z.string().nullable(),
22
+ description: zod_1.z.string().nullable(),
23
+ quality: zod_1.z.string().nullable(),
24
+ });
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConsignmentTransferRequestSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const enum_1 = require("../../enum");
6
+ exports.ConsignmentTransferRequestSchema = zod_1.z.object({
7
+ uuid: zod_1.z.uuid(),
8
+ senderCompanyUUID: zod_1.z.uuid(),
9
+ senderCompanyName: zod_1.z.string().optional(),
10
+ receiverCompanyUUID: zod_1.z.uuid(),
11
+ receiverCompanyName: zod_1.z.string().optional(),
12
+ sourceConsignmentUUID: zod_1.z.uuid(),
13
+ targetConsignmentUUID: zod_1.z.uuid().nullable(),
14
+ status: zod_1.z.nativeEnum(enum_1.ConsignmentTransferRequestStatusEnum),
15
+ comment: zod_1.z.string().nullable(),
16
+ processedComment: zod_1.z.string().nullable(),
17
+ processedAt: zod_1.z.date().nullable(),
18
+ itemsCount: zod_1.z.number().int().optional(),
19
+ createdAt: zod_1.z.date(),
20
+ updatedAt: zod_1.z.date(),
21
+ });
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateConsignmentTransferResponseSchema = exports.CreateConsignmentTransferRequestSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const consignment_transfer_request_schema_1 = require("./consignment-transfer-request.schema");
6
+ exports.CreateConsignmentTransferRequestSchema = zod_1.z.object({
7
+ receiverCompanyUUID: zod_1.z.uuid(),
8
+ sourceConsignmentUUID: zod_1.z.uuid(),
9
+ comment: zod_1.z.string().max(2000).nullable().optional(),
10
+ items: zod_1.z
11
+ .array(zod_1.z.object({
12
+ productUUID: zod_1.z.uuid(),
13
+ quantity: zod_1.z.number().int().min(1),
14
+ }))
15
+ .min(1)
16
+ .max(500),
17
+ });
18
+ exports.CreateConsignmentTransferResponseSchema = zod_1.z.object({
19
+ message: zod_1.z.string().optional(),
20
+ data: consignment_transfer_request_schema_1.ConsignmentTransferRequestSchema,
21
+ });
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetConsignmentTransferListResponseSchema = exports.GetConsignmentTransferListRequestSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const enum_1 = require("../../enum");
6
+ const consignment_transfer_request_schema_1 = require("./consignment-transfer-request.schema");
7
+ exports.GetConsignmentTransferListRequestSchema = zod_1.z.object({
8
+ direction: zod_1.z.nativeEnum(enum_1.ConsignmentTransferDirectionEnum),
9
+ status: zod_1.z.nativeEnum(enum_1.ConsignmentTransferRequestStatusEnum).optional(),
10
+ page: zod_1.z.coerce.number().int().min(1).optional().default(1),
11
+ count: zod_1.z.coerce.number().int().min(1).max(100).optional().default(10),
12
+ });
13
+ exports.GetConsignmentTransferListResponseSchema = zod_1.z.object({
14
+ message: zod_1.z.string().optional(),
15
+ data: zod_1.z.object({
16
+ transferList: consignment_transfer_request_schema_1.ConsignmentTransferRequestSchema.array(),
17
+ total: zod_1.z.number(),
18
+ }),
19
+ });
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetConsignmentTransferResponseSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const consignment_transfer_request_schema_1 = require("./consignment-transfer-request.schema");
6
+ const consignment_transfer_request_item_schema_1 = require("./consignment-transfer-request-item.schema");
7
+ exports.GetConsignmentTransferResponseSchema = zod_1.z.object({
8
+ message: zod_1.z.string().optional(),
9
+ data: zod_1.z.object({
10
+ request: consignment_transfer_request_schema_1.ConsignmentTransferRequestSchema,
11
+ items: consignment_transfer_request_item_schema_1.ConsignmentTransferRequestItemSchema.extend({
12
+ // Receiver-side convenience: suggested local category resolved by name (null when no match).
13
+ suggestedCategoryUUID: zod_1.z.uuid().nullable().optional(),
14
+ suggestedCategoryName: zod_1.z.string().nullable().optional(),
15
+ }).array(),
16
+ }),
17
+ });
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./consignment-transfer-request.schema"), exports);
18
+ __exportStar(require("./consignment-transfer-request-item.schema"), exports);
19
+ __exportStar(require("./create-consignment-transfer.schema"), exports);
20
+ __exportStar(require("./get-consignment-transfer-list.schema"), exports);
21
+ __exportStar(require("./get-consignment-transfer.schema"), exports);
22
+ __exportStar(require("./cancel-consignment-transfer.schema"), exports);
23
+ __exportStar(require("./reject-consignment-transfer.schema"), exports);
24
+ __exportStar(require("./accept-consignment-transfer.schema"), exports);
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RejectConsignmentTransferResponseSchema = exports.RejectConsignmentTransferRequestSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const consignment_transfer_request_schema_1 = require("./consignment-transfer-request.schema");
6
+ exports.RejectConsignmentTransferRequestSchema = zod_1.z.object({
7
+ comment: zod_1.z.string().max(2000).nullable().optional(),
8
+ });
9
+ exports.RejectConsignmentTransferResponseSchema = zod_1.z.object({
10
+ message: zod_1.z.string().optional(),
11
+ data: consignment_transfer_request_schema_1.ConsignmentTransferRequestSchema,
12
+ });
@@ -78,3 +78,4 @@ __exportStar(require("./bank-payment/get-bank-payment-match-suggestions.schema")
78
78
  __exportStar(require("./messenger-profile"), exports);
79
79
  __exportStar(require("./error-message.schema"), exports);
80
80
  __exportStar(require("./account-deletion-request/account-deletion-request.schema"), exports);
81
+ __exportStar(require("./consignment-transfer"), exports);
@@ -56,6 +56,7 @@ exports.OrderProductStepperPositionSchema = zod_1.z.object({
56
56
  multiplicityOptionUUID: zod_1.z.string().nullable().optional(),
57
57
  multiplicityOptionTitle: zod_1.z.string().nullable().optional(),
58
58
  quantity: zod_1.z.number(),
59
+ balance: zod_1.z.number(),
59
60
  });
60
61
  exports.ActiveStepperPositionsForOrderResponseSchema = zod_1.z.object({
61
62
  list: exports.OrderProductStepperPositionSchema.array(),
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ import {
3
+ AcceptConsignmentTransferRequestSchema,
4
+ AcceptConsignmentTransferResponseSchema,
5
+ } from '../../schemas/consignment-transfer/accept-consignment-transfer.schema';
6
+
7
+ export namespace AcceptConsignmentTransferContractCommand {
8
+ export const RequestSchema = AcceptConsignmentTransferRequestSchema;
9
+ export type Request = z.infer<typeof RequestSchema>;
10
+
11
+ export const ResponseSchema = AcceptConsignmentTransferResponseSchema;
12
+ export type Response = z.infer<typeof ResponseSchema>;
13
+ }
@@ -0,0 +1,7 @@
1
+ import { z } from 'zod';
2
+ import { CancelConsignmentTransferResponseSchema } from '../../schemas/consignment-transfer/cancel-consignment-transfer.schema';
3
+
4
+ export namespace CancelConsignmentTransferContractCommand {
5
+ export const ResponseSchema = CancelConsignmentTransferResponseSchema;
6
+ export type Response = z.infer<typeof ResponseSchema>;
7
+ }
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ import {
3
+ CreateConsignmentTransferRequestSchema,
4
+ CreateConsignmentTransferResponseSchema,
5
+ } from '../../schemas/consignment-transfer/create-consignment-transfer.schema';
6
+
7
+ export namespace CreateConsignmentTransferContractCommand {
8
+ export const RequestSchema = CreateConsignmentTransferRequestSchema;
9
+ export type Request = z.infer<typeof RequestSchema>;
10
+
11
+ export const ResponseSchema = CreateConsignmentTransferResponseSchema;
12
+ export type Response = z.infer<typeof ResponseSchema>;
13
+ }
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ import {
3
+ GetConsignmentTransferListRequestSchema,
4
+ GetConsignmentTransferListResponseSchema,
5
+ } from '../../schemas/consignment-transfer/get-consignment-transfer-list.schema';
6
+
7
+ export namespace GetConsignmentTransferListContractQuery {
8
+ export const RequestSchema = GetConsignmentTransferListRequestSchema;
9
+ export type Request = z.infer<typeof RequestSchema>;
10
+
11
+ export const ResponseSchema = GetConsignmentTransferListResponseSchema;
12
+ export type Response = z.infer<typeof ResponseSchema>;
13
+ }
@@ -0,0 +1,7 @@
1
+ import { z } from 'zod';
2
+ import { GetConsignmentTransferResponseSchema } from '../../schemas/consignment-transfer/get-consignment-transfer.schema';
3
+
4
+ export namespace GetConsignmentTransferContractQuery {
5
+ export const ResponseSchema = GetConsignmentTransferResponseSchema;
6
+ export type Response = z.infer<typeof ResponseSchema>;
7
+ }
@@ -0,0 +1,6 @@
1
+ export * from './create-consignment-transfer.command';
2
+ export * from './get-consignment-transfer-list.query';
3
+ export * from './get-consignment-transfer.query';
4
+ export * from './cancel-consignment-transfer.command';
5
+ export * from './reject-consignment-transfer.command';
6
+ export * from './accept-consignment-transfer.command';
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ import {
3
+ RejectConsignmentTransferRequestSchema,
4
+ RejectConsignmentTransferResponseSchema,
5
+ } from '../../schemas/consignment-transfer/reject-consignment-transfer.schema';
6
+
7
+ export namespace RejectConsignmentTransferContractCommand {
8
+ export const RequestSchema = RejectConsignmentTransferRequestSchema;
9
+ export type Request = z.infer<typeof RequestSchema>;
10
+
11
+ export const ResponseSchema = RejectConsignmentTransferResponseSchema;
12
+ export type Response = z.infer<typeof ResponseSchema>;
13
+ }
package/commands/index.ts CHANGED
@@ -55,3 +55,4 @@ export { GetActiveSessionsContractQuery } from './session/get-active-sessions.qu
55
55
  export { ValidateSessionS2SContractQuery } from './session/validate-session-s2s.query';
56
56
  export { CreateWsTicketContractCommand } from './session/create-ws-ticket.command';
57
57
  export { ValidateWsTicketS2SContractQuery } from './session/validate-ws-ticket-s2s.query';
58
+ export * from './consignment-transfer';
package/constant/error.ts CHANGED
@@ -1192,4 +1192,19 @@ export const ERRORS = {
1192
1192
  ONE_C_INVALID_CREDENTIALS: { code: 'OC003', message: '1C credentials are invalid', httpCode: 401 },
1193
1193
  ONE_C_INTEGRATION_DISABLED: { code: 'OC004', message: '1C integration is disabled for this company', httpCode: 409 },
1194
1194
  ONE_C_SESSION_INVALID: { code: 'OC005', message: '1C session is missing or expired', httpCode: 401 },
1195
+
1196
+ // CONSIGNMENT TRANSFER (FC-227)
1197
+ CONSIGNMENT_TRANSFER_NOT_CREATED: { code: 'CTR001', message: 'Failed to create consignment transfer request', httpCode: 500 },
1198
+ CONSIGNMENT_TRANSFER_NOT_FOUND: { code: 'CTR002', message: 'Consignment transfer request not found', httpCode: 404 },
1199
+ CONSIGNMENT_TRANSFER_FETCH_FAILED: { code: 'CTR003', message: 'Failed to fetch consignment transfer requests', httpCode: 500 },
1200
+ CONSIGNMENT_TRANSFER_RECEIVER_NOT_FOUND: { code: 'CTR004', message: 'Receiver company not found or inactive', httpCode: 404 },
1201
+ CONSIGNMENT_TRANSFER_RECEIVER_IS_SENDER: { code: 'CTR005', message: 'Cannot transfer a consignment to your own company', httpCode: 400 },
1202
+ CONSIGNMENT_TRANSFER_PRODUCT_NOT_FOUND: { code: 'CTR006', message: 'Transfer position not found in the source consignment', httpCode: 404 },
1203
+ CONSIGNMENT_TRANSFER_QUANTITY_EXCEEDS_BALANCE: { code: 'CTR007', message: 'Requested quantity exceeds the available product balance', httpCode: 400 },
1204
+ CONSIGNMENT_TRANSFER_NOT_PENDING: { code: 'CTR008', message: 'Consignment transfer request is not pending', httpCode: 409 },
1205
+ CONSIGNMENT_TRANSFER_NOT_UPDATED: { code: 'CTR009', message: 'Failed to update consignment transfer request', httpCode: 500 },
1206
+ CONSIGNMENT_TRANSFER_ITEMS_MISMATCH: { code: 'CTR010', message: 'Accept payload must map every transfer position exactly once', httpCode: 400 },
1207
+ CONSIGNMENT_TRANSFER_CATEGORY_NOT_FOUND: { code: 'CTR011', message: 'Mapped category not found in the receiver company', httpCode: 404 },
1208
+ CONSIGNMENT_TRANSFER_TARGET_CONSIGNMENT_NOT_FOUND: { code: 'CTR012', message: 'Target consignment not found in the receiver company', httpCode: 404 },
1209
+ CONSIGNMENT_TRANSFER_ACCEPT_FAILED: { code: 'CTR013', message: 'Failed to accept consignment transfer request', httpCode: 500 },
1195
1210
  } as const;
@@ -0,0 +1,4 @@
1
+ export enum ConsignmentTransferDirectionEnum {
2
+ INCOMING = 'incoming',
3
+ OUTGOING = 'outgoing',
4
+ }
@@ -0,0 +1,6 @@
1
+ export enum ConsignmentTransferRequestStatusEnum {
2
+ PENDING = 'PENDING',
3
+ ACCEPTED = 'ACCEPTED',
4
+ REJECTED = 'REJECTED',
5
+ CANCELLED = 'CANCELLED',
6
+ }
package/enum/index.ts CHANGED
@@ -84,4 +84,6 @@ export * from './account-deletion-request-source.enum';
84
84
  export * from './bulk-create-product-image-alias-skip-reason.enum';
85
85
  export * from './bulk-create-product-image-alias-from-pre-order-collection-item-skip-reason.enum';
86
86
  export * from './moysklad-sync-status.enum';
87
+ export * from './consignment-transfer-request-status.enum';
88
+ export * from './consignment-transfer-direction.enum';
87
89
  export * from './legal-identifier-field.enum';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floristcloud/api-lib",
3
- "version": "1.2.59",
3
+ "version": "1.2.61",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -0,0 +1,33 @@
1
+ import { z } from 'zod';
2
+ import { ConsignmentTransferRequestSchema } from './consignment-transfer-request.schema';
3
+
4
+ export const AcceptConsignmentTransferRequestSchema = z
5
+ .object({
6
+ // Accept into an existing consignment of the receiver OR create a new one — exactly one of the two.
7
+ targetConsignmentUUID: z.uuid().optional(),
8
+ newConsignment: z
9
+ .object({
10
+ deliveryDate: z.coerce.date().min(new Date('2000-01-01')).max(new Date('2100-01-01')),
11
+ description: z.string().max(2000).nullable().optional(),
12
+ label: z.string().max(255).nullable().optional(),
13
+ })
14
+ .optional(),
15
+ items: z
16
+ .array(
17
+ z.object({
18
+ itemUUID: z.uuid(),
19
+ categoryUUID: z.uuid(),
20
+ price: z.number().min(0).optional(),
21
+ }),
22
+ )
23
+ .min(1),
24
+ })
25
+ .refine(data => Boolean(data.targetConsignmentUUID) !== Boolean(data.newConsignment), {
26
+ message: 'Provide either targetConsignmentUUID or newConsignment, not both',
27
+ path: ['targetConsignmentUUID'],
28
+ });
29
+
30
+ export const AcceptConsignmentTransferResponseSchema = z.object({
31
+ message: z.string().optional(),
32
+ data: ConsignmentTransferRequestSchema,
33
+ });
@@ -0,0 +1,7 @@
1
+ import { z } from 'zod';
2
+ import { ConsignmentTransferRequestSchema } from './consignment-transfer-request.schema';
3
+
4
+ export const CancelConsignmentTransferResponseSchema = z.object({
5
+ message: z.string().optional(),
6
+ data: ConsignmentTransferRequestSchema,
7
+ });
@@ -0,0 +1,22 @@
1
+ import { z } from 'zod';
2
+
3
+ export const ConsignmentTransferRequestItemSchema = z.object({
4
+ uuid: z.uuid(),
5
+ sourceProductUUID: z.uuid(),
6
+ targetProductUUID: z.uuid().nullable(),
7
+ name: z.string(),
8
+ quantity: z.number().int(),
9
+ transferPrice: z.number(),
10
+ categoryName: z.string().nullable(),
11
+ multiplicity: z.number().int(),
12
+ grower: z.string().nullable(),
13
+ size: z.string().nullable(),
14
+ size2: z.string().nullable(),
15
+ size3: z.string().nullable(),
16
+ color: z.string().nullable(),
17
+ country: z.string().nullable(),
18
+ article: z.string().nullable(),
19
+ barcode: z.string().nullable(),
20
+ description: z.string().nullable(),
21
+ quality: z.string().nullable(),
22
+ });
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ import { ConsignmentTransferRequestStatusEnum } from '../../enum';
3
+
4
+ export const ConsignmentTransferRequestSchema = z.object({
5
+ uuid: z.uuid(),
6
+ senderCompanyUUID: z.uuid(),
7
+ senderCompanyName: z.string().optional(),
8
+ receiverCompanyUUID: z.uuid(),
9
+ receiverCompanyName: z.string().optional(),
10
+ sourceConsignmentUUID: z.uuid(),
11
+ targetConsignmentUUID: z.uuid().nullable(),
12
+ status: z.nativeEnum(ConsignmentTransferRequestStatusEnum),
13
+ comment: z.string().nullable(),
14
+ processedComment: z.string().nullable(),
15
+ processedAt: z.date().nullable(),
16
+ itemsCount: z.number().int().optional(),
17
+ createdAt: z.date(),
18
+ updatedAt: z.date(),
19
+ });
@@ -0,0 +1,22 @@
1
+ import { z } from 'zod';
2
+ import { ConsignmentTransferRequestSchema } from './consignment-transfer-request.schema';
3
+
4
+ export const CreateConsignmentTransferRequestSchema = z.object({
5
+ receiverCompanyUUID: z.uuid(),
6
+ sourceConsignmentUUID: z.uuid(),
7
+ comment: z.string().max(2000).nullable().optional(),
8
+ items: z
9
+ .array(
10
+ z.object({
11
+ productUUID: z.uuid(),
12
+ quantity: z.number().int().min(1),
13
+ }),
14
+ )
15
+ .min(1)
16
+ .max(500),
17
+ });
18
+
19
+ export const CreateConsignmentTransferResponseSchema = z.object({
20
+ message: z.string().optional(),
21
+ data: ConsignmentTransferRequestSchema,
22
+ });
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ import { ConsignmentTransferDirectionEnum, ConsignmentTransferRequestStatusEnum } from '../../enum';
3
+ import { ConsignmentTransferRequestSchema } from './consignment-transfer-request.schema';
4
+
5
+ export const GetConsignmentTransferListRequestSchema = z.object({
6
+ direction: z.nativeEnum(ConsignmentTransferDirectionEnum),
7
+ status: z.nativeEnum(ConsignmentTransferRequestStatusEnum).optional(),
8
+ page: z.coerce.number().int().min(1).optional().default(1),
9
+ count: z.coerce.number().int().min(1).max(100).optional().default(10),
10
+ });
11
+
12
+ export const GetConsignmentTransferListResponseSchema = z.object({
13
+ message: z.string().optional(),
14
+ data: z.object({
15
+ transferList: ConsignmentTransferRequestSchema.array(),
16
+ total: z.number(),
17
+ }),
18
+ });
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ import { ConsignmentTransferRequestSchema } from './consignment-transfer-request.schema';
3
+ import { ConsignmentTransferRequestItemSchema } from './consignment-transfer-request-item.schema';
4
+
5
+ export const GetConsignmentTransferResponseSchema = z.object({
6
+ message: z.string().optional(),
7
+ data: z.object({
8
+ request: ConsignmentTransferRequestSchema,
9
+ items: ConsignmentTransferRequestItemSchema.extend({
10
+ // Receiver-side convenience: suggested local category resolved by name (null when no match).
11
+ suggestedCategoryUUID: z.uuid().nullable().optional(),
12
+ suggestedCategoryName: z.string().nullable().optional(),
13
+ }).array(),
14
+ }),
15
+ });
@@ -0,0 +1,8 @@
1
+ export * from './consignment-transfer-request.schema';
2
+ export * from './consignment-transfer-request-item.schema';
3
+ export * from './create-consignment-transfer.schema';
4
+ export * from './get-consignment-transfer-list.schema';
5
+ export * from './get-consignment-transfer.schema';
6
+ export * from './cancel-consignment-transfer.schema';
7
+ export * from './reject-consignment-transfer.schema';
8
+ export * from './accept-consignment-transfer.schema';
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ import { ConsignmentTransferRequestSchema } from './consignment-transfer-request.schema';
3
+
4
+ export const RejectConsignmentTransferRequestSchema = z.object({
5
+ comment: z.string().max(2000).nullable().optional(),
6
+ });
7
+
8
+ export const RejectConsignmentTransferResponseSchema = z.object({
9
+ message: z.string().optional(),
10
+ data: ConsignmentTransferRequestSchema,
11
+ });
package/schemas/index.ts CHANGED
@@ -62,3 +62,4 @@ export * from './bank-payment/get-bank-payment-match-suggestions.schema';
62
62
  export * from './messenger-profile';
63
63
  export * from './error-message.schema';
64
64
  export * from './account-deletion-request/account-deletion-request.schema';
65
+ export * from './consignment-transfer';
@@ -64,6 +64,7 @@ export const OrderProductStepperPositionSchema = z.object({
64
64
  multiplicityOptionUUID: z.string().nullable().optional(),
65
65
  multiplicityOptionTitle: z.string().nullable().optional(),
66
66
  quantity: z.number(),
67
+ balance: z.number(),
67
68
  });
68
69
 
69
70
  export const ActiveStepperPositionsForOrderResponseSchema = z.object({