@floristcloud/api-lib 1.2.27 → 1.2.29

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 (35) hide show
  1. package/build/commands/integration/index.js +1 -0
  2. package/build/commands/integration/one-c/connect-one-c.command.js +15 -0
  3. package/build/commands/integration/one-c/disconnect-one-c.command.js +14 -0
  4. package/build/commands/integration/one-c/get-one-c-status.query.js +18 -0
  5. package/build/commands/integration/one-c/index.js +20 -0
  6. package/build/commands/integration/one-c/rotate-one-c-password.command.js +15 -0
  7. package/build/commands/order/group/merge-orders.command.js +26 -1
  8. package/build/commands/order/group/split-group-order.command.js +8 -0
  9. package/build/commands/order-product/group/update-group-order-product-order.command.js +8 -4
  10. package/build/constant/error.js +16 -0
  11. package/build/enum/action-log-type.enum.js +2 -0
  12. package/build/enum/index.js +1 -0
  13. package/build/enum/integration-provider.enum.js +1 -0
  14. package/build/enum/order-merge-allowed-status-list.js +11 -0
  15. package/build/schemas/consignment/consignment.schema.js +0 -1
  16. package/build/schemas/order/order.schema.js +0 -1
  17. package/build/schemas/product/product.schema.js +0 -1
  18. package/commands/integration/index.ts +1 -1
  19. package/commands/integration/one-c/connect-one-c.command.ts +14 -0
  20. package/commands/integration/one-c/disconnect-one-c.command.ts +13 -0
  21. package/commands/integration/one-c/get-one-c-status.query.ts +17 -0
  22. package/commands/integration/one-c/index.ts +4 -0
  23. package/commands/integration/one-c/rotate-one-c-password.command.ts +14 -0
  24. package/commands/order/group/merge-orders.command.ts +32 -0
  25. package/commands/order/group/split-group-order.command.ts +11 -0
  26. package/commands/order-product/group/update-group-order-product-order.command.ts +11 -6
  27. package/constant/error.ts +17 -0
  28. package/enum/action-log-type.enum.ts +2 -0
  29. package/enum/index.ts +1 -0
  30. package/enum/integration-provider.enum.ts +1 -0
  31. package/enum/order-merge-allowed-status-list.ts +9 -0
  32. package/package.json +1 -1
  33. package/schemas/consignment/consignment.schema.ts +0 -1
  34. package/schemas/order/order.schema.ts +0 -1
  35. package/schemas/product/product.schema.ts +0 -1
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./telegram"), exports);
18
18
  __exportStar(require("./telegram-staff"), exports);
19
19
  __exportStar(require("./moysklad"), exports);
20
+ __exportStar(require("./one-c"), exports);
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConnectOneCContractCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const ConnectOneCResponseSchema = zod_1.z.object({
6
+ message: zod_1.z.string().optional(),
7
+ data: zod_1.z.object({
8
+ username: zod_1.z.string(),
9
+ password: zod_1.z.string(),
10
+ }),
11
+ });
12
+ var ConnectOneCContractCommand;
13
+ (function (ConnectOneCContractCommand) {
14
+ ConnectOneCContractCommand.ResponseSchema = ConnectOneCResponseSchema;
15
+ })(ConnectOneCContractCommand || (exports.ConnectOneCContractCommand = ConnectOneCContractCommand = {}));
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DisconnectOneCContractCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const DisconnectOneCResponseSchema = zod_1.z.object({
6
+ message: zod_1.z.string().optional(),
7
+ data: zod_1.z.object({
8
+ success: zod_1.z.literal(true),
9
+ }),
10
+ });
11
+ var DisconnectOneCContractCommand;
12
+ (function (DisconnectOneCContractCommand) {
13
+ DisconnectOneCContractCommand.ResponseSchema = DisconnectOneCResponseSchema;
14
+ })(DisconnectOneCContractCommand || (exports.DisconnectOneCContractCommand = DisconnectOneCContractCommand = {}));
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetOneCStatusContractQuery = void 0;
4
+ const zod_1 = require("zod");
5
+ const GetOneCStatusResponseSchema = zod_1.z.object({
6
+ message: zod_1.z.string().optional(),
7
+ data: zod_1.z.object({
8
+ isConnected: zod_1.z.boolean(),
9
+ isEnabled: zod_1.z.boolean(),
10
+ username: zod_1.z.string().nullable(),
11
+ lastCheckauthAt: zod_1.z.string().datetime().nullable(),
12
+ lastSyncAt: zod_1.z.string().datetime().nullable(),
13
+ }),
14
+ });
15
+ var GetOneCStatusContractQuery;
16
+ (function (GetOneCStatusContractQuery) {
17
+ GetOneCStatusContractQuery.ResponseSchema = GetOneCStatusResponseSchema;
18
+ })(GetOneCStatusContractQuery || (exports.GetOneCStatusContractQuery = GetOneCStatusContractQuery = {}));
@@ -0,0 +1,20 @@
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("./connect-one-c.command"), exports);
18
+ __exportStar(require("./rotate-one-c-password.command"), exports);
19
+ __exportStar(require("./disconnect-one-c.command"), exports);
20
+ __exportStar(require("./get-one-c-status.query"), exports);
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RotateOneCPasswordContractCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const RotateOneCPasswordResponseSchema = zod_1.z.object({
6
+ message: zod_1.z.string().optional(),
7
+ data: zod_1.z.object({
8
+ username: zod_1.z.string(),
9
+ password: zod_1.z.string(),
10
+ }),
11
+ });
12
+ var RotateOneCPasswordContractCommand;
13
+ (function (RotateOneCPasswordContractCommand) {
14
+ RotateOneCPasswordContractCommand.ResponseSchema = RotateOneCPasswordResponseSchema;
15
+ })(RotateOneCPasswordContractCommand || (exports.RotateOneCPasswordContractCommand = RotateOneCPasswordContractCommand = {}));
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MergeOrdersContractCommand = exports.MergeOrdersGroupAnalysisResponseSchema = void 0;
3
+ exports.MergeOrdersExecuteContractCommand = exports.MergeOrdersContractCommand = exports.MergeOrdersGroupAnalysisResponseSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const schemas_1 = require("../../../schemas");
6
6
  const MergeOrdersRequestSchema = zod_1.z.object({
@@ -24,3 +24,28 @@ var MergeOrdersContractCommand;
24
24
  MergeOrdersContractCommand.RequestSchema = MergeOrdersRequestSchema;
25
25
  MergeOrdersContractCommand.ResponseSchema = MergeOrdersAnalyzeResponseSchema;
26
26
  })(MergeOrdersContractCommand || (exports.MergeOrdersContractCommand = MergeOrdersContractCommand = {}));
27
+ // Группы, не прошедшие merge, перечисляются в `failedGroups` с per-group причиной — UI рендерит
28
+ // «Заказы клиента X не объединены: <message>».
29
+ const MergeOrdersExecuteFailedGroupSchema = zod_1.z.object({
30
+ clientUUID: zod_1.z.string(),
31
+ branchUUID: zod_1.z.string().nullable(),
32
+ targetOrderUUID: zod_1.z.string().nullable(),
33
+ sourceOrdersUUIDs: zod_1.z.array(zod_1.z.string()),
34
+ errorCode: zod_1.z.string(),
35
+ errorMessage: zod_1.z.string(),
36
+ });
37
+ const MergeOrdersExecuteResponseSchema = zod_1.z.object({
38
+ message: zod_1.z.string().optional(),
39
+ data: zod_1.z.object({
40
+ success: zod_1.z.boolean(),
41
+ successCount: zod_1.z.number().int().nonnegative(),
42
+ totalCount: zod_1.z.number().int().nonnegative(),
43
+ failedGroups: zod_1.z.array(MergeOrdersExecuteFailedGroupSchema),
44
+ }),
45
+ });
46
+ var MergeOrdersExecuteContractCommand;
47
+ (function (MergeOrdersExecuteContractCommand) {
48
+ MergeOrdersExecuteContractCommand.RequestSchema = MergeOrdersRequestSchema;
49
+ MergeOrdersExecuteContractCommand.ResponseSchema = MergeOrdersExecuteResponseSchema;
50
+ MergeOrdersExecuteContractCommand.FailedGroupSchema = MergeOrdersExecuteFailedGroupSchema;
51
+ })(MergeOrdersExecuteContractCommand || (exports.MergeOrdersExecuteContractCommand = MergeOrdersExecuteContractCommand = {}));
@@ -6,12 +6,20 @@ const schemas_1 = require("../../../schemas");
6
6
  const SplitGroupOrderRequestSchema = zod_1.z.object({
7
7
  orderUUIDList: zod_1.z.array(zod_1.z.string()),
8
8
  });
9
+ // Источники, которые не удалось разделить, попадают в `failures` с per-source причиной.
10
+ const SplitGroupOrderFailureSchema = zod_1.z.object({
11
+ sourceOrderUUID: zod_1.z.string(),
12
+ errorCode: zod_1.z.string(),
13
+ errorMessage: zod_1.z.string(),
14
+ });
9
15
  const SplitGroupOrderResponseSchema = zod_1.z.object({
10
16
  message: zod_1.z.string().optional(),
11
17
  data: schemas_1.OrderSchema.array(),
18
+ failures: zod_1.z.array(SplitGroupOrderFailureSchema).optional(),
12
19
  });
13
20
  var SplitGroupOrderContractCommand;
14
21
  (function (SplitGroupOrderContractCommand) {
15
22
  SplitGroupOrderContractCommand.RequestSchema = SplitGroupOrderRequestSchema;
16
23
  SplitGroupOrderContractCommand.ResponseSchema = SplitGroupOrderResponseSchema;
24
+ SplitGroupOrderContractCommand.FailureSchema = SplitGroupOrderFailureSchema;
17
25
  })(SplitGroupOrderContractCommand || (exports.SplitGroupOrderContractCommand = SplitGroupOrderContractCommand = {}));
@@ -1,12 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UpdateGroupOrderProductOrderContractCommand = void 0;
3
+ exports.UpdateGroupOrderProductOrderContractCommand = exports.BULK_MOVE_ORDER_PRODUCT_LIMIT = void 0;
4
4
  const zod_1 = require("zod");
5
+ exports.BULK_MOVE_ORDER_PRODUCT_LIMIT = 200;
5
6
  const UpdateGroupOrderProductOrderRequestSchema = zod_1.z.object({
6
- orderProductUUIDList: zod_1.z.array(zod_1.z.object({
7
+ orderProductUUIDList: zod_1.z
8
+ .array(zod_1.z.object({
7
9
  uuid: zod_1.z.string(),
8
- quantity: zod_1.z.coerce.number(),
9
- })),
10
+ quantity: zod_1.z.coerce.number().int().positive(),
11
+ }))
12
+ .min(1)
13
+ .max(exports.BULK_MOVE_ORDER_PRODUCT_LIMIT),
10
14
  newOrderUUID: zod_1.z.uuid(),
11
15
  isDelete: zod_1.z.coerce.boolean().optional().default(true),
12
16
  isComment: zod_1.z.coerce.boolean().optional().default(true),
@@ -430,6 +430,16 @@ exports.ERRORS = {
430
430
  message: 'Another bulk operation on this order is in progress, retry later',
431
431
  httpCode: 409,
432
432
  },
433
+ ORDER_PRODUCT_HAS_WRITE_OFF: {
434
+ code: 'OP019',
435
+ message: 'Cannot move order-product: it has a write-off attached',
436
+ httpCode: 400,
437
+ },
438
+ ORDER_MOVE_BULK_OPERATION_IN_PROGRESS: {
439
+ code: 'OP020',
440
+ message: 'Another bulk-move operation on this pair of orders is in progress, retry later',
441
+ httpCode: 409,
442
+ },
433
443
  //TRANSACTION
434
444
  TRANSACTION_NOT_CREATED: { code: 'TR001', message: 'Failed to transaction product', httpCode: 500 },
435
445
  TRANSACTION_FETCH_FAILED: { code: 'TR002', message: 'Error when retrieving a transaction', httpCode: 500 },
@@ -1048,4 +1058,10 @@ exports.ERRORS = {
1048
1058
  message: 'MoySklad integration is disabled for this company',
1049
1059
  httpCode: 409,
1050
1060
  },
1061
+ // 1C COMMERCEML INTEGRATION
1062
+ ONE_C_NOT_CONNECTED: { code: 'OC001', message: '1C integration is not connected for this company', httpCode: 404 },
1063
+ ONE_C_CONNECT_FAILED: { code: 'OC002', message: 'Failed to connect 1C integration', httpCode: 500 },
1064
+ ONE_C_INVALID_CREDENTIALS: { code: 'OC003', message: '1C credentials are invalid', httpCode: 401 },
1065
+ ONE_C_INTEGRATION_DISABLED: { code: 'OC004', message: '1C integration is disabled for this company', httpCode: 409 },
1066
+ ONE_C_SESSION_INVALID: { code: 'OC005', message: '1C session is missing or expired', httpCode: 401 },
1051
1067
  };
@@ -9,6 +9,8 @@ var ActionLogTypeEnum;
9
9
  ActionLogTypeEnum["DELETE_ORDER"] = "DELETE_ORDER";
10
10
  ActionLogTypeEnum["DELETE_ORDER_ITEM"] = "DELETE_ORDER_ITEM";
11
11
  ActionLogTypeEnum["UPDATE_ORDER_ITEM"] = "UPDATE_ORDER_ITEM";
12
+ ActionLogTypeEnum["MOVE_ORDER_ITEM"] = "MOVE_ORDER_ITEM";
13
+ ActionLogTypeEnum["MERGE_ORDER"] = "MERGE_ORDER";
12
14
  ActionLogTypeEnum["ADD_PAYMENT"] = "ADD_PAYMENT";
13
15
  ActionLogTypeEnum["DELETE_PAYMENT"] = "DELETE_PAYMENT";
14
16
  ActionLogTypeEnum["CREATE_PREORDER"] = "CREATE_PREORDER";
@@ -23,6 +23,7 @@ __exportStar(require("./order-type.enum"), exports);
23
23
  __exportStar(require("./order-status.enum"), exports);
24
24
  __exportStar(require("./order-restricted-status-list"), exports);
25
25
  __exportStar(require("./order-balance-status-list"), exports);
26
+ __exportStar(require("./order-merge-allowed-status-list"), exports);
26
27
  __exportStar(require("./transaction-type.enum"), exports);
27
28
  __exportStar(require("./consignment-import-schema-relation-entity-property.enum"), exports);
28
29
  __exportStar(require("./consignment-import-errors.enum"), exports);
@@ -4,4 +4,5 @@ exports.IntegrationProviderEnum = void 0;
4
4
  var IntegrationProviderEnum;
5
5
  (function (IntegrationProviderEnum) {
6
6
  IntegrationProviderEnum["MOYSKLAD"] = "MOYSKLAD";
7
+ IntegrationProviderEnum["ONE_C"] = "ONE_C";
7
8
  })(IntegrationProviderEnum || (exports.IntegrationProviderEnum = IntegrationProviderEnum = {}));
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OrderMergeAllowedStatusList = void 0;
4
+ const order_status_enum_1 = require("./order-status.enum");
5
+ exports.OrderMergeAllowedStatusList = [
6
+ order_status_enum_1.OrderStatusEnum.NEW,
7
+ order_status_enum_1.OrderStatusEnum.UNDER_REVIEW,
8
+ order_status_enum_1.OrderStatusEnum.ACCEPTED,
9
+ order_status_enum_1.OrderStatusEnum.IMPORTED,
10
+ order_status_enum_1.OrderStatusEnum.TEMPLATE,
11
+ ];
@@ -15,7 +15,6 @@ exports.ConsignmentSchema = zod_1.z.object({
15
15
  isInStock: zod_1.z.boolean(),
16
16
  status: zod_1.z.nativeEnum(enum_1.ConsignmentStatusEnum),
17
17
  url: zod_1.z.string().nullable(),
18
- isWithSync: zod_1.z.boolean(),
19
18
  createdAt: zod_1.z.date(),
20
19
  updatedAt: zod_1.z.date(),
21
20
  deletedAt: zod_1.z.date().nullable(),
@@ -13,7 +13,6 @@ exports.OrderSchema = zod_1.z.object({
13
13
  clientUUID: zod_1.z.uuid(),
14
14
  branchUUID: zod_1.z.uuid().nullable(),
15
15
  creatorUserUUID: zod_1.z.uuid(),
16
- isSync: zod_1.z.boolean(),
17
16
  totalCost: zod_1.z.number(),
18
17
  subtotal: zod_1.z.number(),
19
18
  deliveryCost: zod_1.z.number(),
@@ -11,7 +11,6 @@ const discount_rules_schema_1 = require("../discount-rules/discount-rules.schema
11
11
  const __1 = require("../..");
12
12
  exports.ProductSchema = zod_1.z.object({
13
13
  uuid: zod_1.z.uuid(),
14
- dataSyncId: zod_1.z.string().nullable(),
15
14
  consignmentUUID: zod_1.z.uuid(),
16
15
  categoryUUID: zod_1.z.uuid().nullable(),
17
16
  name: zod_1.z.string(),
@@ -1,4 +1,4 @@
1
1
  export * from './telegram';
2
2
  export * from './telegram-staff';
3
3
  export * from './moysklad';
4
-
4
+ export * from './one-c';
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+
3
+ const ConnectOneCResponseSchema = z.object({
4
+ message: z.string().optional(),
5
+ data: z.object({
6
+ username: z.string(),
7
+ password: z.string(),
8
+ }),
9
+ });
10
+
11
+ export namespace ConnectOneCContractCommand {
12
+ export const ResponseSchema = ConnectOneCResponseSchema;
13
+ export type Response = z.infer<typeof ResponseSchema>;
14
+ }
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+
3
+ const DisconnectOneCResponseSchema = z.object({
4
+ message: z.string().optional(),
5
+ data: z.object({
6
+ success: z.literal(true),
7
+ }),
8
+ });
9
+
10
+ export namespace DisconnectOneCContractCommand {
11
+ export const ResponseSchema = DisconnectOneCResponseSchema;
12
+ export type Response = z.infer<typeof ResponseSchema>;
13
+ }
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+
3
+ const GetOneCStatusResponseSchema = z.object({
4
+ message: z.string().optional(),
5
+ data: z.object({
6
+ isConnected: z.boolean(),
7
+ isEnabled: z.boolean(),
8
+ username: z.string().nullable(),
9
+ lastCheckauthAt: z.string().datetime().nullable(),
10
+ lastSyncAt: z.string().datetime().nullable(),
11
+ }),
12
+ });
13
+
14
+ export namespace GetOneCStatusContractQuery {
15
+ export const ResponseSchema = GetOneCStatusResponseSchema;
16
+ export type Response = z.infer<typeof ResponseSchema>;
17
+ }
@@ -0,0 +1,4 @@
1
+ export * from './connect-one-c.command';
2
+ export * from './rotate-one-c-password.command';
3
+ export * from './disconnect-one-c.command';
4
+ export * from './get-one-c-status.query';
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+
3
+ const RotateOneCPasswordResponseSchema = z.object({
4
+ message: z.string().optional(),
5
+ data: z.object({
6
+ username: z.string(),
7
+ password: z.string(),
8
+ }),
9
+ });
10
+
11
+ export namespace RotateOneCPasswordContractCommand {
12
+ export const ResponseSchema = RotateOneCPasswordResponseSchema;
13
+ export type Response = z.infer<typeof ResponseSchema>;
14
+ }
@@ -27,3 +27,35 @@ export namespace MergeOrdersContractCommand {
27
27
  export const ResponseSchema = MergeOrdersAnalyzeResponseSchema;
28
28
  export type Response = z.infer<typeof ResponseSchema>;
29
29
  }
30
+
31
+ // Группы, не прошедшие merge, перечисляются в `failedGroups` с per-group причиной — UI рендерит
32
+ // «Заказы клиента X не объединены: <message>».
33
+ const MergeOrdersExecuteFailedGroupSchema = z.object({
34
+ clientUUID: z.string(),
35
+ branchUUID: z.string().nullable(),
36
+ targetOrderUUID: z.string().nullable(),
37
+ sourceOrdersUUIDs: z.array(z.string()),
38
+ errorCode: z.string(),
39
+ errorMessage: z.string(),
40
+ });
41
+
42
+ const MergeOrdersExecuteResponseSchema = z.object({
43
+ message: z.string().optional(),
44
+ data: z.object({
45
+ success: z.boolean(),
46
+ successCount: z.number().int().nonnegative(),
47
+ totalCount: z.number().int().nonnegative(),
48
+ failedGroups: z.array(MergeOrdersExecuteFailedGroupSchema),
49
+ }),
50
+ });
51
+
52
+ export namespace MergeOrdersExecuteContractCommand {
53
+ export const RequestSchema = MergeOrdersRequestSchema;
54
+ export type Request = z.infer<typeof RequestSchema>;
55
+
56
+ export const ResponseSchema = MergeOrdersExecuteResponseSchema;
57
+ export type Response = z.infer<typeof ResponseSchema>;
58
+
59
+ export const FailedGroupSchema = MergeOrdersExecuteFailedGroupSchema;
60
+ export type FailedGroup = z.infer<typeof FailedGroupSchema>;
61
+ }
@@ -5,9 +5,17 @@ const SplitGroupOrderRequestSchema = z.object({
5
5
  orderUUIDList: z.array(z.string()),
6
6
  });
7
7
 
8
+ // Источники, которые не удалось разделить, попадают в `failures` с per-source причиной.
9
+ const SplitGroupOrderFailureSchema = z.object({
10
+ sourceOrderUUID: z.string(),
11
+ errorCode: z.string(),
12
+ errorMessage: z.string(),
13
+ });
14
+
8
15
  const SplitGroupOrderResponseSchema = z.object({
9
16
  message: z.string().optional(),
10
17
  data: OrderSchema.array(),
18
+ failures: z.array(SplitGroupOrderFailureSchema).optional(),
11
19
  });
12
20
 
13
21
  export namespace SplitGroupOrderContractCommand {
@@ -16,4 +24,7 @@ export namespace SplitGroupOrderContractCommand {
16
24
 
17
25
  export const ResponseSchema = SplitGroupOrderResponseSchema;
18
26
  export type Response = z.infer<typeof ResponseSchema>;
27
+
28
+ export const FailureSchema = SplitGroupOrderFailureSchema;
29
+ export type Failure = z.infer<typeof FailureSchema>;
19
30
  }
@@ -1,12 +1,17 @@
1
1
  import { z } from 'zod';
2
2
 
3
+ export const BULK_MOVE_ORDER_PRODUCT_LIMIT = 200;
4
+
3
5
  const UpdateGroupOrderProductOrderRequestSchema = z.object({
4
- orderProductUUIDList: z.array(
5
- z.object({
6
- uuid: z.string(),
7
- quantity: z.coerce.number(),
8
- }),
9
- ),
6
+ orderProductUUIDList: z
7
+ .array(
8
+ z.object({
9
+ uuid: z.string(),
10
+ quantity: z.coerce.number().int().positive(),
11
+ }),
12
+ )
13
+ .min(1)
14
+ .max(BULK_MOVE_ORDER_PRODUCT_LIMIT),
10
15
  newOrderUUID: z.uuid(),
11
16
  isDelete: z.coerce.boolean().optional().default(true),
12
17
  isComment: z.coerce.boolean().optional().default(true),
package/constant/error.ts CHANGED
@@ -446,6 +446,16 @@ export const ERRORS = {
446
446
  message: 'Another bulk operation on this order is in progress, retry later',
447
447
  httpCode: 409,
448
448
  },
449
+ ORDER_PRODUCT_HAS_WRITE_OFF: {
450
+ code: 'OP019',
451
+ message: 'Cannot move order-product: it has a write-off attached',
452
+ httpCode: 400,
453
+ },
454
+ ORDER_MOVE_BULK_OPERATION_IN_PROGRESS: {
455
+ code: 'OP020',
456
+ message: 'Another bulk-move operation on this pair of orders is in progress, retry later',
457
+ httpCode: 409,
458
+ },
449
459
 
450
460
  //TRANSACTION
451
461
  TRANSACTION_NOT_CREATED: { code: 'TR001', message: 'Failed to transaction product', httpCode: 500 },
@@ -1108,4 +1118,11 @@ export const ERRORS = {
1108
1118
  message: 'MoySklad integration is disabled for this company',
1109
1119
  httpCode: 409,
1110
1120
  },
1121
+
1122
+ // 1C COMMERCEML INTEGRATION
1123
+ ONE_C_NOT_CONNECTED: { code: 'OC001', message: '1C integration is not connected for this company', httpCode: 404 },
1124
+ ONE_C_CONNECT_FAILED: { code: 'OC002', message: 'Failed to connect 1C integration', httpCode: 500 },
1125
+ ONE_C_INVALID_CREDENTIALS: { code: 'OC003', message: '1C credentials are invalid', httpCode: 401 },
1126
+ ONE_C_INTEGRATION_DISABLED: { code: 'OC004', message: '1C integration is disabled for this company', httpCode: 409 },
1127
+ ONE_C_SESSION_INVALID: { code: 'OC005', message: '1C session is missing or expired', httpCode: 401 },
1111
1128
  } as const;
@@ -5,6 +5,8 @@ export enum ActionLogTypeEnum {
5
5
  DELETE_ORDER = 'DELETE_ORDER',
6
6
  DELETE_ORDER_ITEM = 'DELETE_ORDER_ITEM',
7
7
  UPDATE_ORDER_ITEM = 'UPDATE_ORDER_ITEM',
8
+ MOVE_ORDER_ITEM = 'MOVE_ORDER_ITEM',
9
+ MERGE_ORDER = 'MERGE_ORDER',
8
10
  ADD_PAYMENT = 'ADD_PAYMENT',
9
11
  DELETE_PAYMENT = 'DELETE_PAYMENT',
10
12
  CREATE_PREORDER = 'CREATE_PREORDER',
package/enum/index.ts CHANGED
@@ -7,6 +7,7 @@ export * from './order-type.enum';
7
7
  export * from './order-status.enum';
8
8
  export * from './order-restricted-status-list';
9
9
  export * from './order-balance-status-list';
10
+ export * from './order-merge-allowed-status-list';
10
11
  export * from './transaction-type.enum';
11
12
  export * from './consignment-import-schema-relation-entity-property.enum';
12
13
  export * from './consignment-import-errors.enum';
@@ -1,3 +1,4 @@
1
1
  export enum IntegrationProviderEnum {
2
2
  MOYSKLAD = 'MOYSKLAD',
3
+ ONE_C = 'ONE_C',
3
4
  }
@@ -0,0 +1,9 @@
1
+ import { OrderStatusEnum } from './order-status.enum';
2
+
3
+ export const OrderMergeAllowedStatusList: OrderStatusEnum[] = [
4
+ OrderStatusEnum.NEW,
5
+ OrderStatusEnum.UNDER_REVIEW,
6
+ OrderStatusEnum.ACCEPTED,
7
+ OrderStatusEnum.IMPORTED,
8
+ OrderStatusEnum.TEMPLATE,
9
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floristcloud/api-lib",
3
- "version": "1.2.27",
3
+ "version": "1.2.29",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -13,7 +13,6 @@ export const ConsignmentSchema = z.object({
13
13
  isInStock: z.boolean(),
14
14
  status: z.nativeEnum(ConsignmentStatusEnum),
15
15
  url: z.string().nullable(),
16
- isWithSync: z.boolean(),
17
16
  createdAt: z.date(),
18
17
  updatedAt: z.date(),
19
18
  deletedAt: z.date().nullable(),
@@ -12,7 +12,6 @@ export const OrderSchema = z.object({
12
12
  branchUUID: z.uuid().nullable(),
13
13
  creatorUserUUID: z.uuid(),
14
14
 
15
- isSync: z.boolean(),
16
15
  totalCost: z.number(),
17
16
  subtotal: z.number(),
18
17
  deliveryCost: z.number(),
@@ -9,7 +9,6 @@ import { ProductMultiplicityOptionSchema } from '../..';
9
9
 
10
10
  export const ProductSchema = z.object({
11
11
  uuid: z.uuid(),
12
- dataSyncId: z.string().nullable(),
13
12
  consignmentUUID: z.uuid(),
14
13
  categoryUUID: z.uuid().nullable(),
15
14
  name: z.string(),