@floristcloud/api-lib 1.0.54 → 1.0.56

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.
@@ -4,6 +4,7 @@ exports.DetachOrderListToDeliveryRouteContractCommand = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const DetachOrderListToDeliveryRouteRequestSchema = zod_1.z.object({
6
6
  orderUUIDList: zod_1.z.array(zod_1.z.uuid()).min(1),
7
+ isDeleteDelivery: zod_1.z.coerce.boolean().optional().default(false),
7
8
  });
8
9
  const DetachOrderListToDeliveryRouteResponseSchema = zod_1.z.object({
9
10
  message: zod_1.z.string().optional(),
@@ -8,6 +8,7 @@ const GetPreOrderListRequestSchema = zod_1.z.object({
8
8
  page: zod_1.z.string().transform(val => Number(val) || 1),
9
9
  count: zod_1.z.coerce.number().optional().default(10),
10
10
  searchQuery: zod_1.z.string().optional(),
11
+ clientUUID: zod_1.z.string().optional(),
11
12
  preOrderCollectionUUID: zod_1.z.string().optional(),
12
13
  status: zod_1.z.nativeEnum(enum_1.PreOrderStatusEnum).array().optional(),
13
14
  createdAtFrom: zod_1.z.coerce.date().optional(),
@@ -23,3 +23,4 @@ __exportStar(require("./analyze-create-orders-from-pre-orders.command"), exports
23
23
  __exportStar(require("./group-create-orders-from-pre-orders.command"), exports);
24
24
  __exportStar(require("./analyze-copy-pre-orders.command"), exports);
25
25
  __exportStar(require("./group-copy-pre-orders-to-collection.command"), exports);
26
+ __exportStar(require("./merge-pre-orders.command"), exports);
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MergePreOrdersContractCommand = exports.MergePreOrdersGroupAnalysisResponseSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const schemas_1 = require("../../../schemas");
6
+ const MergePreOrdersRequestSchema = zod_1.z.object({
7
+ preOrderUUIDList: zod_1.z.array(zod_1.z.string().uuid()).min(2),
8
+ });
9
+ exports.MergePreOrdersGroupAnalysisResponseSchema = zod_1.z.object({
10
+ clientUUID: zod_1.z.string(),
11
+ branchUUID: zod_1.z.string().nullable(),
12
+ isPossible: zod_1.z.boolean(),
13
+ targetPreOrderUUID: zod_1.z.string().nullable(),
14
+ sourcePreOrdersUUIDs: zod_1.z.array(zod_1.z.string()),
15
+ errors: zod_1.z.array(schemas_1.ErrorMessageSchema),
16
+ warnings: zod_1.z.array(schemas_1.ErrorMessageSchema),
17
+ mergeInfo: zod_1.z
18
+ .object({
19
+ willMergeTags: zod_1.z.boolean(),
20
+ willMergeComments: zod_1.z.boolean(),
21
+ totalProducts: zod_1.z.number(),
22
+ })
23
+ .optional(),
24
+ });
25
+ const MergePreOrdersResponseSchema = zod_1.z.object({
26
+ message: zod_1.z.string().optional(),
27
+ data: zod_1.z.array(exports.MergePreOrdersGroupAnalysisResponseSchema),
28
+ });
29
+ var MergePreOrdersContractCommand;
30
+ (function (MergePreOrdersContractCommand) {
31
+ MergePreOrdersContractCommand.RequestSchema = MergePreOrdersRequestSchema;
32
+ MergePreOrdersContractCommand.ResponseSchema = MergePreOrdersResponseSchema;
33
+ })(MergePreOrdersContractCommand || (exports.MergePreOrdersContractCommand = MergePreOrdersContractCommand = {}));
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MoveGroupPreOrderProductContractCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const MoveGroupPreOrderProductRequestSchema = zod_1.z.object({
6
+ preOrderProductUUIDList: zod_1.z.array(zod_1.z.string().uuid()).min(1),
7
+ newPreOrderUUID: zod_1.z.string().uuid(),
8
+ isDelete: zod_1.z.coerce.boolean().optional().default(true),
9
+ });
10
+ const MoveGroupPreOrderProductResponseSchema = zod_1.z.object({
11
+ message: zod_1.z.string().optional(),
12
+ data: zod_1.z.object({
13
+ success: zod_1.z.boolean(),
14
+ }),
15
+ });
16
+ var MoveGroupPreOrderProductContractCommand;
17
+ (function (MoveGroupPreOrderProductContractCommand) {
18
+ MoveGroupPreOrderProductContractCommand.RequestSchema = MoveGroupPreOrderProductRequestSchema;
19
+ MoveGroupPreOrderProductContractCommand.ResponseSchema = MoveGroupPreOrderProductResponseSchema;
20
+ })(MoveGroupPreOrderProductContractCommand || (exports.MoveGroupPreOrderProductContractCommand = MoveGroupPreOrderProductContractCommand = {}));
@@ -29,3 +29,4 @@ __exportStar(require("./get-pre-order-product-list.query"), exports);
29
29
  __exportStar(require("./get-pre-order-product-extended-list.query"), exports);
30
30
  __exportStar(require("./create-manually-pre-order-product-for-standing-order.command"), exports);
31
31
  __exportStar(require("./get-pre-order-products-by-pre-order-list.command"), exports);
32
+ __exportStar(require("./group/move-group-pre-order-product.command"), exports);
@@ -24,6 +24,7 @@ __exportStar(require("./get-product-quantity-calculate.query"), exports);
24
24
  __exportStar(require("./get-all-product-by-consignment.query"), exports);
25
25
  __exportStar(require("./get-product-list-filters-values.query"), exports);
26
26
  __exportStar(require("./generate-product-qr.query"), exports);
27
+ __exportStar(require("./match-images-for-products.command"), exports);
27
28
  //webshop
28
29
  __exportStar(require("./webshop/get-client-product-list-filters-values.query"), exports);
29
30
  __exportStar(require("./webshop/get-product-list-for-client.query"), exports);
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MatchImagesForProductsContractCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const MatchImagesForProductsRequestSchema = zod_1.z.object({
6
+ productUUIDList: zod_1.z.array(zod_1.z.string().uuid()).min(1),
7
+ onlyWithoutImages: zod_1.z.coerce.boolean().default(true),
8
+ });
9
+ const MatchImagesForProductsResponseSchema = zod_1.z.object({
10
+ message: zod_1.z.string().optional(),
11
+ data: zod_1.z.object({
12
+ success: zod_1.z.boolean(),
13
+ updatedItems: zod_1.z.number(),
14
+ }),
15
+ });
16
+ var MatchImagesForProductsContractCommand;
17
+ (function (MatchImagesForProductsContractCommand) {
18
+ MatchImagesForProductsContractCommand.RequestSchema = MatchImagesForProductsRequestSchema;
19
+ MatchImagesForProductsContractCommand.ResponseSchema = MatchImagesForProductsResponseSchema;
20
+ })(MatchImagesForProductsContractCommand || (exports.MatchImagesForProductsContractCommand = MatchImagesForProductsContractCommand = {}));
@@ -201,6 +201,7 @@ exports.ERRORS = {
201
201
  PRODUCT_MULTIPLICITY_OPTION_NOT_FOUND: { code: 'P017', message: 'Product multiplicity option not found', httpCode: 404 },
202
202
  PRODUCT_MULTIPLICITY_OPTION_USED_IN_ORDER: { code: 'P018', message: 'Product multiplicity option used in order', httpCode: 400 },
203
203
  PRODUCT_MULTIPLICITY_OPTION_NOT_DELETED: { code: 'P019', message: 'Failed to delete product multiplicity option', httpCode: 500 },
204
+ PRODUCT_IMAGE_MATCHING_FAILED: { code: 'P020', message: 'Failed to match images for products', httpCode: 500 },
204
205
  // PRODUCT CONFIGURATION
205
206
  PRODUCT_CONFIGURATION_NOT_CREATED: { code: 'PCFG001', message: 'Failed to create product configuration', httpCode: 500 },
206
207
  PRODUCT_CONFIGURATION_NOT_DELETED: { code: 'PCFG002', message: 'Failed to delete product configuration', httpCode: 500 },
@@ -588,6 +589,17 @@ exports.ERRORS = {
588
589
  message: 'Failed to copy pre order',
589
590
  httpCode: 500,
590
591
  },
592
+ PRE_ORDER_MERGE_FAILED: { code: 'PO013', message: 'Pre-order merge failed', httpCode: 500 },
593
+ PRE_ORDER_MERGE_ANALYSIS_FAILED: { code: 'PO014', message: 'Pre-order merge analysis failed', httpCode: 500 },
594
+ PRE_ORDER_MERGE_NO_VALID_GROUPS: { code: 'PO015', message: 'No valid groups found for merge', httpCode: 400 },
595
+ PRE_ORDER_MERGE_NO_COLLECTION: { code: 'PO016', message: 'All pre-orders must belong to a collection for merge', httpCode: 400 },
596
+ PRE_ORDER_MERGE_NOT_ENOUGH: { code: 'PO017', message: 'At least 2 pre-orders required for merge', httpCode: 400 },
597
+ PRE_ORDER_MERGE_STATUS_NOT_ALLOWED: { code: 'PO018', message: 'Pre-order status not allowed for merge', httpCode: 400 },
598
+ PRE_ORDER_MERGE_DIFFERENT_STATUSES: { code: 'PO019', message: 'Pre-orders have different statuses', httpCode: 400 },
599
+ PRE_ORDER_MERGE_DIFFERENT_COLLECTIONS: { code: 'PO020', message: 'All pre-orders must belong to the same collection', httpCode: 400 },
600
+ PRE_ORDER_MERGE_HAS_EMPTY: { code: 'PO021', message: 'Some pre-orders are empty and will be deleted', httpCode: 400 },
601
+ PRE_ORDER_MERGE_TAGS_CONCATENATE: { code: 'PO022', message: 'Pre-orders have different tags', httpCode: 400 },
602
+ PRE_ORDER_MERGE_COMMENTS_CONCATENATE: { code: 'PO023', message: 'Pre-orders have different comments', httpCode: 400 },
591
603
  STANDING_ORDER_CLIENT_NAME_REQUIRED: {
592
604
  code: 'SO001',
593
605
  message: 'Standing order client name is required',
@@ -11,6 +11,7 @@ exports.MatchingConfigSchema = zod_1.z.object({
11
11
  matchByColor: zod_1.z.coerce.boolean(),
12
12
  matchBySize: zod_1.z.coerce.boolean(),
13
13
  matchByGrower: zod_1.z.coerce.boolean(),
14
+ usePreOrderMultiplicity: zod_1.z.coerce.boolean().optional(),
14
15
  });
15
16
  exports.PreOrderProductSchema = zod_1.z.object({
16
17
  uuid: zod_1.z.string(),
@@ -2,6 +2,7 @@ import { z } from 'zod';
2
2
 
3
3
  const DetachOrderListToDeliveryRouteRequestSchema = z.object({
4
4
  orderUUIDList: z.array(z.uuid()).min(1),
5
+ isDeleteDelivery: z.coerce.boolean().optional().default(false),
5
6
  });
6
7
 
7
8
  const DetachOrderListToDeliveryRouteResponseSchema = z.object({
@@ -6,6 +6,7 @@ const GetPreOrderListRequestSchema = z.object({
6
6
  page: z.string().transform(val => Number(val) || 1),
7
7
  count: z.coerce.number().optional().default(10),
8
8
  searchQuery: z.string().optional(),
9
+ clientUUID: z.string().optional(),
9
10
  preOrderCollectionUUID: z.string().optional(),
10
11
  status: z.nativeEnum(PreOrderStatusEnum).array().optional(),
11
12
  createdAtFrom: z.coerce.date().optional(),
@@ -7,3 +7,4 @@ export * from './analyze-create-orders-from-pre-orders.command';
7
7
  export * from './group-create-orders-from-pre-orders.command';
8
8
  export * from './analyze-copy-pre-orders.command';
9
9
  export * from './group-copy-pre-orders-to-collection.command';
10
+ export * from './merge-pre-orders.command';
@@ -0,0 +1,36 @@
1
+ import { z } from 'zod';
2
+ import { ErrorMessageSchema } from '../../../schemas';
3
+
4
+ const MergePreOrdersRequestSchema = z.object({
5
+ preOrderUUIDList: z.array(z.string().uuid()).min(2),
6
+ });
7
+
8
+ export const MergePreOrdersGroupAnalysisResponseSchema = z.object({
9
+ clientUUID: z.string(),
10
+ branchUUID: z.string().nullable(),
11
+ isPossible: z.boolean(),
12
+ targetPreOrderUUID: z.string().nullable(),
13
+ sourcePreOrdersUUIDs: z.array(z.string()),
14
+ errors: z.array(ErrorMessageSchema),
15
+ warnings: z.array(ErrorMessageSchema),
16
+ mergeInfo: z
17
+ .object({
18
+ willMergeTags: z.boolean(),
19
+ willMergeComments: z.boolean(),
20
+ totalProducts: z.number(),
21
+ })
22
+ .optional(),
23
+ });
24
+
25
+ const MergePreOrdersResponseSchema = z.object({
26
+ message: z.string().optional(),
27
+ data: z.array(MergePreOrdersGroupAnalysisResponseSchema),
28
+ });
29
+
30
+ export namespace MergePreOrdersContractCommand {
31
+ export const RequestSchema = MergePreOrdersRequestSchema;
32
+ export type Request = z.infer<typeof RequestSchema>;
33
+
34
+ export const ResponseSchema = MergePreOrdersResponseSchema;
35
+ export type Response = z.infer<typeof ResponseSchema>;
36
+ }
@@ -0,0 +1,22 @@
1
+ import { z } from 'zod';
2
+
3
+ const MoveGroupPreOrderProductRequestSchema = z.object({
4
+ preOrderProductUUIDList: z.array(z.string().uuid()).min(1),
5
+ newPreOrderUUID: z.string().uuid(),
6
+ isDelete: z.coerce.boolean().optional().default(true),
7
+ });
8
+
9
+ const MoveGroupPreOrderProductResponseSchema = z.object({
10
+ message: z.string().optional(),
11
+ data: z.object({
12
+ success: z.boolean(),
13
+ }),
14
+ });
15
+
16
+ export namespace MoveGroupPreOrderProductContractCommand {
17
+ export const RequestSchema = MoveGroupPreOrderProductRequestSchema;
18
+ export type Request = z.infer<typeof RequestSchema>;
19
+
20
+ export const ResponseSchema = MoveGroupPreOrderProductResponseSchema;
21
+ export type Response = z.infer<typeof ResponseSchema>;
22
+ }
@@ -13,3 +13,4 @@ export * from './get-pre-order-product-list.query';
13
13
  export * from './get-pre-order-product-extended-list.query';
14
14
  export * from './create-manually-pre-order-product-for-standing-order.command';
15
15
  export * from './get-pre-order-products-by-pre-order-list.command';
16
+ export * from './group/move-group-pre-order-product.command';
@@ -8,6 +8,7 @@ export * from './get-product-quantity-calculate.query';
8
8
  export * from './get-all-product-by-consignment.query';
9
9
  export * from './get-product-list-filters-values.query';
10
10
  export * from './generate-product-qr.query';
11
+ export * from './match-images-for-products.command';
11
12
  //webshop
12
13
  export * from './webshop/get-client-product-list-filters-values.query';
13
14
  export * from './webshop/get-product-list-for-client.query';
@@ -0,0 +1,22 @@
1
+ import { z } from 'zod';
2
+
3
+ const MatchImagesForProductsRequestSchema = z.object({
4
+ productUUIDList: z.array(z.string().uuid()).min(1),
5
+ onlyWithoutImages: z.coerce.boolean().default(true),
6
+ });
7
+
8
+ const MatchImagesForProductsResponseSchema = z.object({
9
+ message: z.string().optional(),
10
+ data: z.object({
11
+ success: z.boolean(),
12
+ updatedItems: z.number(),
13
+ }),
14
+ });
15
+
16
+ export namespace MatchImagesForProductsContractCommand {
17
+ export const RequestSchema = MatchImagesForProductsRequestSchema;
18
+ export type Request = z.infer<typeof RequestSchema>;
19
+
20
+ export const ResponseSchema = MatchImagesForProductsResponseSchema;
21
+ export type Response = z.infer<typeof ResponseSchema>;
22
+ }
package/constant/error.ts CHANGED
@@ -208,6 +208,7 @@ export const ERRORS = {
208
208
  PRODUCT_MULTIPLICITY_OPTION_NOT_FOUND: { code: 'P017', message: 'Product multiplicity option not found', httpCode: 404 },
209
209
  PRODUCT_MULTIPLICITY_OPTION_USED_IN_ORDER: { code: 'P018', message: 'Product multiplicity option used in order', httpCode: 400 },
210
210
  PRODUCT_MULTIPLICITY_OPTION_NOT_DELETED: { code: 'P019', message: 'Failed to delete product multiplicity option', httpCode: 500 },
211
+ PRODUCT_IMAGE_MATCHING_FAILED: { code: 'P020', message: 'Failed to match images for products', httpCode: 500 },
211
212
 
212
213
  // PRODUCT CONFIGURATION
213
214
  PRODUCT_CONFIGURATION_NOT_CREATED: { code: 'PCFG001', message: 'Failed to create product configuration', httpCode: 500 },
@@ -620,6 +621,17 @@ export const ERRORS = {
620
621
  message: 'Failed to copy pre order',
621
622
  httpCode: 500,
622
623
  },
624
+ PRE_ORDER_MERGE_FAILED: { code: 'PO013', message: 'Pre-order merge failed', httpCode: 500 },
625
+ PRE_ORDER_MERGE_ANALYSIS_FAILED: { code: 'PO014', message: 'Pre-order merge analysis failed', httpCode: 500 },
626
+ PRE_ORDER_MERGE_NO_VALID_GROUPS: { code: 'PO015', message: 'No valid groups found for merge', httpCode: 400 },
627
+ PRE_ORDER_MERGE_NO_COLLECTION: { code: 'PO016', message: 'All pre-orders must belong to a collection for merge', httpCode: 400 },
628
+ PRE_ORDER_MERGE_NOT_ENOUGH: { code: 'PO017', message: 'At least 2 pre-orders required for merge', httpCode: 400 },
629
+ PRE_ORDER_MERGE_STATUS_NOT_ALLOWED: { code: 'PO018', message: 'Pre-order status not allowed for merge', httpCode: 400 },
630
+ PRE_ORDER_MERGE_DIFFERENT_STATUSES: { code: 'PO019', message: 'Pre-orders have different statuses', httpCode: 400 },
631
+ PRE_ORDER_MERGE_DIFFERENT_COLLECTIONS: { code: 'PO020', message: 'All pre-orders must belong to the same collection', httpCode: 400 },
632
+ PRE_ORDER_MERGE_HAS_EMPTY: { code: 'PO021', message: 'Some pre-orders are empty and will be deleted', httpCode: 400 },
633
+ PRE_ORDER_MERGE_TAGS_CONCATENATE: { code: 'PO022', message: 'Pre-orders have different tags', httpCode: 400 },
634
+ PRE_ORDER_MERGE_COMMENTS_CONCATENATE: { code: 'PO023', message: 'Pre-orders have different comments', httpCode: 400 },
623
635
  STANDING_ORDER_CLIENT_NAME_REQUIRED: {
624
636
  code: 'SO001',
625
637
  message: 'Standing order client name is required',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floristcloud/api-lib",
3
- "version": "1.0.54",
3
+ "version": "1.0.56",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -9,6 +9,7 @@ export const MatchingConfigSchema = z.object({
9
9
  matchByColor: z.coerce.boolean(),
10
10
  matchBySize: z.coerce.boolean(),
11
11
  matchByGrower: z.coerce.boolean(),
12
+ usePreOrderMultiplicity: z.coerce.boolean().optional(),
12
13
  });
13
14
 
14
15
  export const PreOrderProductSchema = z.object({