@floristcloud/api-lib 1.2.67 → 1.2.70

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 (25) hide show
  1. package/build/commands/wrire-off-archive/get-write-off-archive-files-by-uuids.command.js +17 -0
  2. package/build/commands/wrire-off-archive/get-write-off-archive-files.command.js +2 -12
  3. package/build/commands/wrire-off-archive/index.js +1 -0
  4. package/build/commands/write-off/export-selected-write-offs.command.js +17 -0
  5. package/build/commands/write-off/get-write-off-list.query.js +15 -1
  6. package/build/commands/write-off/index.js +1 -0
  7. package/build/schemas/action-log/action-log.schema.js +7 -0
  8. package/build/schemas/action-log/index.js +1 -0
  9. package/build/schemas/action-log/order-product-verify-action-log.schema.js +12 -0
  10. package/build/schemas/index.js +2 -0
  11. package/build/schemas/write-off/write-off-archive-file.schema.js +14 -0
  12. package/build/schemas/write-off/write-off-export.schema.js +7 -0
  13. package/commands/wrire-off-archive/get-write-off-archive-files-by-uuids.command.ts +19 -0
  14. package/commands/wrire-off-archive/get-write-off-archive-files.command.ts +2 -13
  15. package/commands/wrire-off-archive/index.ts +1 -0
  16. package/commands/write-off/export-selected-write-offs.command.ts +19 -0
  17. package/commands/write-off/get-write-off-list.query.ts +29 -12
  18. package/commands/write-off/index.ts +1 -0
  19. package/package.json +1 -1
  20. package/schemas/action-log/action-log.schema.ts +7 -0
  21. package/schemas/action-log/index.ts +1 -0
  22. package/schemas/action-log/order-product-verify-action-log.schema.ts +10 -0
  23. package/schemas/index.ts +2 -0
  24. package/schemas/write-off/write-off-archive-file.schema.ts +13 -0
  25. package/schemas/write-off/write-off-export.schema.ts +5 -0
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetWriteOffArchiveFilesByUuidsContractCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const schemas_1 = require("../../schemas");
6
+ const GetWriteOffArchiveFilesByUuidsRequestSchema = zod_1.z.object({
7
+ writeOffUUIDs: zod_1.z.array(zod_1.z.string().uuid()).min(1).max(500),
8
+ });
9
+ const GetWriteOffArchiveFilesByUuidsResponseSchema = zod_1.z.object({
10
+ message: zod_1.z.string().optional(),
11
+ data: schemas_1.WriteOffArchiveFilesSchema.nullable(),
12
+ });
13
+ var GetWriteOffArchiveFilesByUuidsContractCommand;
14
+ (function (GetWriteOffArchiveFilesByUuidsContractCommand) {
15
+ GetWriteOffArchiveFilesByUuidsContractCommand.RequestSchema = GetWriteOffArchiveFilesByUuidsRequestSchema;
16
+ GetWriteOffArchiveFilesByUuidsContractCommand.ResponseSchema = GetWriteOffArchiveFilesByUuidsResponseSchema;
17
+ })(GetWriteOffArchiveFilesByUuidsContractCommand || (exports.GetWriteOffArchiveFilesByUuidsContractCommand = GetWriteOffArchiveFilesByUuidsContractCommand = {}));
@@ -2,20 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GetWriteOffArchiveFilesContractQuery = void 0;
4
4
  const zod_1 = require("zod");
5
- const ArchiveFileItemSchema = zod_1.z.object({
6
- file_key: zod_1.z.string(),
7
- grower: zod_1.z.string(),
8
- name: zod_1.z.string(),
9
- size: zod_1.z.string(),
10
- categoryName: zod_1.z.string(),
11
- });
5
+ const schemas_1 = require("../../schemas");
12
6
  const GetWriteOffArchiveFilesResponseSchema = zod_1.z.object({
13
7
  message: zod_1.z.string().optional(),
14
- data: zod_1.z
15
- .object({
16
- files: zod_1.z.array(ArchiveFileItemSchema),
17
- })
18
- .nullable(),
8
+ data: schemas_1.WriteOffArchiveFilesSchema.nullable(),
19
9
  });
20
10
  var GetWriteOffArchiveFilesContractQuery;
21
11
  (function (GetWriteOffArchiveFilesContractQuery) {
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./create-wrire-off-archive.command"), exports);
18
18
  __exportStar(require("./info-wrire-off-archive.command"), exports);
19
19
  __exportStar(require("./get-write-off-archive-files.command"), exports);
20
+ __exportStar(require("./get-write-off-archive-files-by-uuids.command"), exports);
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExportSelectedWriteOffsContractCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const schemas_1 = require("../../schemas");
6
+ const ExportSelectedWriteOffsRequestSchema = zod_1.z.object({
7
+ writeOffUUIDs: zod_1.z.array(zod_1.z.string().uuid()).min(1).max(500),
8
+ });
9
+ const ExportSelectedWriteOffsResponseSchema = zod_1.z.object({
10
+ message: zod_1.z.string().optional(),
11
+ data: schemas_1.WriteOffExportSchema,
12
+ });
13
+ var ExportSelectedWriteOffsContractCommand;
14
+ (function (ExportSelectedWriteOffsContractCommand) {
15
+ ExportSelectedWriteOffsContractCommand.RequestSchema = ExportSelectedWriteOffsRequestSchema;
16
+ ExportSelectedWriteOffsContractCommand.ResponseSchema = ExportSelectedWriteOffsResponseSchema;
17
+ })(ExportSelectedWriteOffsContractCommand || (exports.ExportSelectedWriteOffsContractCommand = ExportSelectedWriteOffsContractCommand = {}));
@@ -4,7 +4,9 @@ exports.GetWriteOffListContractQuery = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const schemas_1 = require("../../schemas");
6
6
  const enum_1 = require("../../enum");
7
- const GetWriteOffListRequestSchema = zod_1.z.object({
7
+ const date_helper_1 = require("../../helpers/date.helper");
8
+ const GetWriteOffListRequestSchema = zod_1.z
9
+ .object({
8
10
  productUUID: zod_1.z.string().optional(),
9
11
  categoryUUID: zod_1.z.string().optional(),
10
12
  consignmentUUID: zod_1.z.string().optional(),
@@ -13,8 +15,20 @@ const GetWriteOffListRequestSchema = zod_1.z.object({
13
15
  searchQuery: zod_1.z.string().optional(),
14
16
  responsibleUserUUID: zod_1.z.string().optional(),
15
17
  status: zod_1.z.nativeEnum(enum_1.WriteOffStatusEnum).optional(),
18
+ startDate: zod_1.z.coerce.date().optional(),
19
+ endDate: zod_1.z.coerce.date().optional(),
16
20
  page: zod_1.z.coerce.number().optional().default(1),
17
21
  count: zod_1.z.coerce.number().optional().default(10),
22
+ })
23
+ .refine(value => {
24
+ const { startDate, endDate } = value;
25
+ if (startDate && endDate) {
26
+ return (0, date_helper_1.dateRangeCheck)(startDate, endDate);
27
+ }
28
+ return true;
29
+ }, {
30
+ message: 'End date must be greater than start date',
31
+ path: ['endDate', 'startDate'],
18
32
  });
19
33
  const GetWriteOffListResponseSchema = zod_1.z.object({
20
34
  message: zod_1.z.string().optional(),
@@ -27,3 +27,4 @@ __exportStar(require("./webshop"), exports);
27
27
  __exportStar(require("./create-write-off-from-pending.command"), exports);
28
28
  __exportStar(require("./update-write-off-price.command"), exports);
29
29
  __exportStar(require("./get-write-off.query"), exports);
30
+ __exportStar(require("./export-selected-write-offs.command"), exports);
@@ -8,6 +8,7 @@ const order_merge_action_log_schema_1 = require("./order-merge-action-log.schema
8
8
  const order_product_delete_action_log_schema_1 = require("./order-product-delete-action-log.schema");
9
9
  const order_product_move_action_log_schema_1 = require("./order-product-move-action-log.schema");
10
10
  const order_product_update_action_log_schema_1 = require("./order-product-update-action-log.schema");
11
+ const order_product_verify_action_log_schema_1 = require("./order-product-verify-action-log.schema");
11
12
  const order_update_action_log_schema_1 = require("./order-update-action-log.schema");
12
13
  const transaction_add_action_log_schema_1 = require("./transaction-add-action-log.schema");
13
14
  const transaction_delete_action_log_schema_1 = require("./transaction-delete-action-log.schema");
@@ -42,6 +43,12 @@ exports.ActionLogSchema = zod_1.z.discriminatedUnion('actionType', [
42
43
  payload: order_product_update_action_log_schema_1.OrderProductUpdateActionLogSchema,
43
44
  })
44
45
  .merge(BaseActionFields),
46
+ zod_1.z
47
+ .object({
48
+ actionType: zod_1.z.literal(enum_1.ActionLogTypeEnum.VERIFY_ORDER_ITEM),
49
+ payload: order_product_verify_action_log_schema_1.OrderProductVerifyActionLogSchema,
50
+ })
51
+ .merge(BaseActionFields),
45
52
  zod_1.z
46
53
  .object({
47
54
  actionType: zod_1.z.literal(enum_1.ActionLogTypeEnum.MOVE_ORDER_ITEM),
@@ -23,6 +23,7 @@ __exportStar(require("./order-product-delete-action-log.schema"), exports);
23
23
  __exportStar(require("./order-product-info.schema"), exports);
24
24
  __exportStar(require("./order-product-move-action-log.schema"), exports);
25
25
  __exportStar(require("./order-product-update-action-log.schema"), exports);
26
+ __exportStar(require("./order-product-verify-action-log.schema"), exports);
26
27
  __exportStar(require("./order-update-action-log.schema"), exports);
27
28
  __exportStar(require("./pre-order-create-action-log.schema"), exports);
28
29
  __exportStar(require("./pre-order-delete-action-log.schema"), exports);
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OrderProductVerifyActionLogSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const order_product_info_schema_1 = require("./order-product-info.schema");
6
+ const enum_1 = require("../../enum");
7
+ exports.OrderProductVerifyActionLogSchema = zod_1.z.object({
8
+ orderProduct: order_product_info_schema_1.OrderProductInfoSchema,
9
+ isVerified: zod_1.z.boolean(),
10
+ previousIsVerified: zod_1.z.boolean(),
11
+ source: zod_1.z.nativeEnum(enum_1.OrderProductVerifySourceEnum),
12
+ });
@@ -21,6 +21,8 @@ __exportStar(require("./product/product.schema"), exports);
21
21
  __exportStar(require("./product/product-list.schema"), exports);
22
22
  __exportStar(require("./write-off/write-off.schema"), exports);
23
23
  __exportStar(require("./write-off/write-off-list.schema"), exports);
24
+ __exportStar(require("./write-off/write-off-archive-file.schema"), exports);
25
+ __exportStar(require("./write-off/write-off-export.schema"), exports);
24
26
  __exportStar(require("./order/order.schema"), exports);
25
27
  __exportStar(require("./order-delivery/order-delivery.schema"), exports);
26
28
  __exportStar(require("./order-product/order-product.schema"), exports);
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WriteOffArchiveFilesSchema = exports.WriteOffArchiveFileSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.WriteOffArchiveFileSchema = zod_1.z.object({
6
+ file_key: zod_1.z.string(),
7
+ grower: zod_1.z.string(),
8
+ name: zod_1.z.string(),
9
+ size: zod_1.z.string(),
10
+ categoryName: zod_1.z.string(),
11
+ });
12
+ exports.WriteOffArchiveFilesSchema = zod_1.z.object({
13
+ files: zod_1.z.array(exports.WriteOffArchiveFileSchema),
14
+ });
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WriteOffExportSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.WriteOffExportSchema = zod_1.z.object({
6
+ fileUrl: zod_1.z.string(),
7
+ });
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ import { WriteOffArchiveFilesSchema } from '../../schemas';
3
+
4
+ const GetWriteOffArchiveFilesByUuidsRequestSchema = z.object({
5
+ writeOffUUIDs: z.array(z.string().uuid()).min(1).max(500),
6
+ });
7
+
8
+ const GetWriteOffArchiveFilesByUuidsResponseSchema = z.object({
9
+ message: z.string().optional(),
10
+ data: WriteOffArchiveFilesSchema.nullable(),
11
+ });
12
+
13
+ export namespace GetWriteOffArchiveFilesByUuidsContractCommand {
14
+ export const RequestSchema = GetWriteOffArchiveFilesByUuidsRequestSchema;
15
+ export type Request = z.infer<typeof RequestSchema>;
16
+
17
+ export const ResponseSchema = GetWriteOffArchiveFilesByUuidsResponseSchema;
18
+ export type Response = z.infer<typeof ResponseSchema>;
19
+ }
@@ -1,20 +1,9 @@
1
1
  import { z } from 'zod';
2
-
3
- const ArchiveFileItemSchema = z.object({
4
- file_key: z.string(),
5
- grower: z.string(),
6
- name: z.string(),
7
- size: z.string(),
8
- categoryName: z.string(),
9
- });
2
+ import { WriteOffArchiveFilesSchema } from '../../schemas';
10
3
 
11
4
  const GetWriteOffArchiveFilesResponseSchema = z.object({
12
5
  message: z.string().optional(),
13
- data: z
14
- .object({
15
- files: z.array(ArchiveFileItemSchema),
16
- })
17
- .nullable(),
6
+ data: WriteOffArchiveFilesSchema.nullable(),
18
7
  });
19
8
 
20
9
  export namespace GetWriteOffArchiveFilesContractQuery {
@@ -1,3 +1,4 @@
1
1
  export * from './create-wrire-off-archive.command';
2
2
  export * from './info-wrire-off-archive.command';
3
3
  export * from './get-write-off-archive-files.command';
4
+ export * from './get-write-off-archive-files-by-uuids.command';
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ import { WriteOffExportSchema } from '../../schemas';
3
+
4
+ const ExportSelectedWriteOffsRequestSchema = z.object({
5
+ writeOffUUIDs: z.array(z.string().uuid()).min(1).max(500),
6
+ });
7
+
8
+ const ExportSelectedWriteOffsResponseSchema = z.object({
9
+ message: z.string().optional(),
10
+ data: WriteOffExportSchema,
11
+ });
12
+
13
+ export namespace ExportSelectedWriteOffsContractCommand {
14
+ export const RequestSchema = ExportSelectedWriteOffsRequestSchema;
15
+ export type Request = z.infer<typeof RequestSchema>;
16
+
17
+ export const ResponseSchema = ExportSelectedWriteOffsResponseSchema;
18
+ export type Response = z.infer<typeof ResponseSchema>;
19
+ }
@@ -1,19 +1,36 @@
1
1
  import { z } from 'zod';
2
2
  import { WriteOffListSchema } from '../../schemas';
3
3
  import { WriteOffStatusEnum } from '../../enum';
4
+ import { dateRangeCheck } from '../../helpers/date.helper';
4
5
 
5
- const GetWriteOffListRequestSchema = z.object({
6
- productUUID: z.string().optional(),
7
- categoryUUID: z.string().optional(),
8
- consignmentUUID: z.string().optional(),
9
- orderUUID: z.string().optional(),
10
- clientUUID: z.string().optional(),
11
- searchQuery: z.string().optional(),
12
- responsibleUserUUID: z.string().optional(),
13
- status: z.nativeEnum(WriteOffStatusEnum).optional(),
14
- page: z.coerce.number().optional().default(1),
15
- count: z.coerce.number().optional().default(10),
16
- });
6
+ const GetWriteOffListRequestSchema = z
7
+ .object({
8
+ productUUID: z.string().optional(),
9
+ categoryUUID: z.string().optional(),
10
+ consignmentUUID: z.string().optional(),
11
+ orderUUID: z.string().optional(),
12
+ clientUUID: z.string().optional(),
13
+ searchQuery: z.string().optional(),
14
+ responsibleUserUUID: z.string().optional(),
15
+ status: z.nativeEnum(WriteOffStatusEnum).optional(),
16
+ startDate: z.coerce.date().optional(),
17
+ endDate: z.coerce.date().optional(),
18
+ page: z.coerce.number().optional().default(1),
19
+ count: z.coerce.number().optional().default(10),
20
+ })
21
+ .refine(
22
+ value => {
23
+ const { startDate, endDate } = value;
24
+ if (startDate && endDate) {
25
+ return dateRangeCheck(startDate, endDate);
26
+ }
27
+ return true;
28
+ },
29
+ {
30
+ message: 'End date must be greater than start date',
31
+ path: ['endDate', 'startDate'],
32
+ },
33
+ );
17
34
 
18
35
  const GetWriteOffListResponseSchema = z.object({
19
36
  message: z.string().optional(),
@@ -11,3 +11,4 @@ export * from './webshop';
11
11
  export * from './create-write-off-from-pending.command';
12
12
  export * from './update-write-off-price.command';
13
13
  export * from './get-write-off.query';
14
+ export * from './export-selected-write-offs.command';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floristcloud/api-lib",
3
- "version": "1.2.67",
3
+ "version": "1.2.70",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -5,6 +5,7 @@ import { OrderMergeActionLogSchema } from './order-merge-action-log.schema';
5
5
  import { OrderProductDeleteActionLogSchema } from './order-product-delete-action-log.schema';
6
6
  import { OrderProductMoveActionLogSchema } from './order-product-move-action-log.schema';
7
7
  import { OrderProductUpdateActionLogSchema } from './order-product-update-action-log.schema';
8
+ import { OrderProductVerifyActionLogSchema } from './order-product-verify-action-log.schema';
8
9
  import { OrderUpdateActionLogSchema } from './order-update-action-log.schema';
9
10
  import { TransactionAddActionLogSchema } from './transaction-add-action-log.schema';
10
11
  import { TransactionDeleteActionLogSchema } from './transaction-delete-action-log.schema';
@@ -41,6 +42,12 @@ export const ActionLogSchema = z.discriminatedUnion('actionType', [
41
42
  payload: OrderProductUpdateActionLogSchema,
42
43
  })
43
44
  .merge(BaseActionFields),
45
+ z
46
+ .object({
47
+ actionType: z.literal(ActionLogTypeEnum.VERIFY_ORDER_ITEM),
48
+ payload: OrderProductVerifyActionLogSchema,
49
+ })
50
+ .merge(BaseActionFields),
44
51
  z
45
52
  .object({
46
53
  actionType: z.literal(ActionLogTypeEnum.MOVE_ORDER_ITEM),
@@ -7,6 +7,7 @@ export * from './order-product-delete-action-log.schema';
7
7
  export * from './order-product-info.schema';
8
8
  export * from './order-product-move-action-log.schema';
9
9
  export * from './order-product-update-action-log.schema';
10
+ export * from './order-product-verify-action-log.schema';
10
11
  export * from './order-update-action-log.schema';
11
12
  export * from './pre-order-create-action-log.schema';
12
13
  export * from './pre-order-delete-action-log.schema';
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+ import { OrderProductInfoSchema } from './order-product-info.schema';
3
+ import { OrderProductVerifySourceEnum } from '../../enum';
4
+
5
+ export const OrderProductVerifyActionLogSchema = z.object({
6
+ orderProduct: OrderProductInfoSchema,
7
+ isVerified: z.boolean(),
8
+ previousIsVerified: z.boolean(),
9
+ source: z.nativeEnum(OrderProductVerifySourceEnum),
10
+ });
package/schemas/index.ts CHANGED
@@ -5,6 +5,8 @@ export * from './product/product.schema';
5
5
  export * from './product/product-list.schema';
6
6
  export * from './write-off/write-off.schema';
7
7
  export * from './write-off/write-off-list.schema';
8
+ export * from './write-off/write-off-archive-file.schema';
9
+ export * from './write-off/write-off-export.schema';
8
10
  export * from './order/order.schema';
9
11
  export * from './order-delivery/order-delivery.schema';
10
12
  export * from './order-product/order-product.schema';
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+
3
+ export const WriteOffArchiveFileSchema = z.object({
4
+ file_key: z.string(),
5
+ grower: z.string(),
6
+ name: z.string(),
7
+ size: z.string(),
8
+ categoryName: z.string(),
9
+ });
10
+
11
+ export const WriteOffArchiveFilesSchema = z.object({
12
+ files: z.array(WriteOffArchiveFileSchema),
13
+ });
@@ -0,0 +1,5 @@
1
+ import { z } from 'zod';
2
+
3
+ export const WriteOffExportSchema = z.object({
4
+ fileUrl: z.string(),
5
+ });