@floristcloud/api-lib 1.0.17 → 1.0.20

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.
@@ -21,7 +21,7 @@ const GetReportGroupByClientRequestSchema = zod_1.z
21
21
  const GetReportGroupByClientResponseSchema = zod_1.z.object({
22
22
  message: zod_1.z.string().optional(),
23
23
  data: zod_1.z.object({
24
- groupByClient: zod_1.z.record(zod_1.z.object({
24
+ groupByClient: zod_1.z.record(zod_1.z.string(), zod_1.z.object({
25
25
  uuid: zod_1.z.string(),
26
26
  clientName: zod_1.z.string(),
27
27
  totalOrders: zod_1.z.number(),
@@ -6,7 +6,7 @@ const enum_1 = require("../../enum");
6
6
  const date_helper_1 = require("../../helpers/date.helper");
7
7
  const GetReportGroupByPositionRequestSchema = zod_1.z
8
8
  .object({
9
- type: zod_1.z.nativeEnum(enum_1.PositionReportTypeEnum).default(enum_1.PositionReportTypeEnum.PRODUCT),
9
+ type: zod_1.z.enum(enum_1.PositionReportTypeEnum).default(enum_1.PositionReportTypeEnum.PRODUCT),
10
10
  categoryUUID: zod_1.z.string().optional(),
11
11
  startDate: zod_1.z.coerce.date().transform(val => (val ? (0, date_helper_1.setStartDay)(val) : val)),
12
12
  endDate: zod_1.z.coerce.date().transform(val => (val ? (0, date_helper_1.setEndDay)(val) : val)),
@@ -25,7 +25,7 @@ const GetReportGroupByPositionResponseSchema = zod_1.z.object({
25
25
  message: zod_1.z.string().optional(),
26
26
  data: zod_1.z.object({
27
27
  categories: zod_1.z
28
- .record(zod_1.z.object({
28
+ .record(zod_1.z.string(), zod_1.z.object({
29
29
  categoryInfo: zod_1.z.object({
30
30
  uuid: zod_1.z.string(),
31
31
  name: zod_1.z.string(),
@@ -44,7 +44,7 @@ const GetReportGroupByPositionResponseSchema = zod_1.z.object({
44
44
  }))
45
45
  .optional(),
46
46
  products: zod_1.z
47
- .record(zod_1.z.object({
47
+ .record(zod_1.z.string(), zod_1.z.object({
48
48
  productKey: zod_1.z.string(),
49
49
  totalOrders: zod_1.z.number(),
50
50
  soldUnits: zod_1.z.number(),
@@ -198,6 +198,8 @@ exports.ERRORS = {
198
198
  httpCode: 400,
199
199
  },
200
200
  PRODUCT_MULTIPLICITY_OPTION_NOT_FOUND: { code: 'P017', message: 'Product multiplicity option not found', httpCode: 404 },
201
+ PRODUCT_MULTIPLICITY_OPTION_USED_IN_ORDER: { code: 'P018', message: 'Product multiplicity option used in order', httpCode: 400 },
202
+ PRODUCT_MULTIPLICITY_OPTION_NOT_DELETED: { code: 'P019', message: 'Failed to delete product multiplicity option', httpCode: 500 },
201
203
  // PRODUCT CONFIGURATION
202
204
  PRODUCT_CONFIGURATION_NOT_CREATED: { code: 'PCFG001', message: 'Failed to create product configuration', httpCode: 500 },
203
205
  PRODUCT_CONFIGURATION_NOT_DELETED: { code: 'PCFG002', message: 'Failed to delete product configuration', httpCode: 500 },
@@ -683,6 +685,16 @@ exports.ERRORS = {
683
685
  httpCode: 400,
684
686
  },
685
687
  PRE_ORDER_COLLECTION_ITEM_EXPORT_FAILED: { code: 'POCI017', message: 'Failed to export pre order collection item', httpCode: 500 },
688
+ PRE_ORDER_COLLECTION_ITEM_MULTIPLICITY_OPTION_USED_IN_PRE_ORDER: {
689
+ code: 'POCI018',
690
+ message: 'Multiplicity option used in pre order',
691
+ httpCode: 400,
692
+ },
693
+ PRE_ORDER_COLLECTION_ITEM_MULTIPLICITY_OPTION_NOT_DELETED: {
694
+ code: 'POCI019',
695
+ message: 'Failed to delete multiplicity option',
696
+ httpCode: 500,
697
+ },
686
698
  // EMPLOYEE SCHEDULE
687
699
  EMPLOYEE_SCHEDULE_NOT_CREATED: { code: 'ES001', message: 'Failed to create employee schedule', httpCode: 500 },
688
700
  EMPLOYEE_SCHEDULE_NOT_DELETED: { code: 'ES002', message: 'Failed to delete employee schedule', httpCode: 500 },
@@ -26,7 +26,7 @@ const DiscountRulesQuantityBasedDataSchema = zod_1.z
26
26
  multipleQuantity: zod_1.z.number(),
27
27
  })
28
28
  .and(exports.discountRulesModeSchema);
29
- const DiscountRulesItemDiscountDataSchema = zod_1.z.object({}).and(exports.discountRulesModeSchema);
29
+ const DiscountRulesItemDiscountDataSchema = exports.discountRulesModeSchema;
30
30
  const DiscountRulesDiscountProhibitedDataSchema = zod_1.z.object({}).default({});
31
31
  exports.DiscountRulesTypeSchema = zod_1.z.discriminatedUnion('type', [
32
32
  zod_1.z.object({
@@ -53,10 +53,10 @@ exports.DiscountRulesTypeSchema = zod_1.z.discriminatedUnion('type', [
53
53
  exports.DiscountRulesBaseSchema = zod_1.z.object({
54
54
  uuid: zod_1.z.string(),
55
55
  companyUUID: zod_1.z.string(),
56
- type: zod_1.z.nativeEnum(enum_1.DiscountRulesTypeEnum),
57
- defaultApplyProduct: zod_1.z.nativeEnum(enum_1.DiscountRulesApplyTypeEnum),
58
- defaultApplyClient: zod_1.z.nativeEnum(enum_1.DiscountRulesApplyTypeEnum),
59
- status: zod_1.z.nativeEnum(enum_1.DiscountRulesStatusEnum),
56
+ type: zod_1.z.enum(enum_1.DiscountRulesTypeEnum),
57
+ defaultApplyProduct: zod_1.z.enum(enum_1.DiscountRulesApplyTypeEnum),
58
+ defaultApplyClient: zod_1.z.enum(enum_1.DiscountRulesApplyTypeEnum),
59
+ status: zod_1.z.enum(enum_1.DiscountRulesStatusEnum),
60
60
  createdAt: zod_1.z.coerce.date(),
61
61
  updatedAt: zod_1.z.coerce.date(),
62
62
  });
@@ -24,6 +24,7 @@ const GetReportGroupByClientResponseSchema = z.object({
24
24
  message: z.string().optional(),
25
25
  data: z.object({
26
26
  groupByClient: z.record(
27
+ z.string(),
27
28
  z.object({
28
29
  uuid: z.string(),
29
30
  clientName: z.string(),
@@ -39,7 +40,7 @@ const GetReportGroupByClientResponseSchema = z.object({
39
40
  middlePrice: z.number(),
40
41
  grossProfit: z.number(),
41
42
  marginality: z.number(),
42
- }),
43
+ })
43
44
  ),
44
45
  }),
45
46
  });
@@ -4,7 +4,7 @@ import { dateRangeCheck, setEndDay, setStartDay } from '../../helpers/date.helpe
4
4
 
5
5
  const GetReportGroupByPositionRequestSchema = z
6
6
  .object({
7
- type: z.nativeEnum(PositionReportTypeEnum).default(PositionReportTypeEnum.PRODUCT),
7
+ type: z.enum(PositionReportTypeEnum).default(PositionReportTypeEnum.PRODUCT),
8
8
  categoryUUID: z.string().optional(),
9
9
  startDate: z.coerce.date().transform(val => (val ? setStartDay(val) : val)),
10
10
  endDate: z.coerce.date().transform(val => (val ? setEndDay(val) : val)),
@@ -28,6 +28,7 @@ const GetReportGroupByPositionResponseSchema = z.object({
28
28
  data: z.object({
29
29
  categories: z
30
30
  .record(
31
+ z.string(),
31
32
  z.object({
32
33
  categoryInfo: z.object({
33
34
  uuid: z.string(),
@@ -44,11 +45,12 @@ const GetReportGroupByPositionResponseSchema = z.object({
44
45
  middlePrice: z.number(),
45
46
  grossProfit: z.number(),
46
47
  marginality: z.number(),
47
- }),
48
+ })
48
49
  )
49
50
  .optional(),
50
51
  products: z
51
52
  .record(
53
+ z.string(),
52
54
  z.object({
53
55
  productKey: z.string(),
54
56
  totalOrders: z.number(),
@@ -62,7 +64,7 @@ const GetReportGroupByPositionResponseSchema = z.object({
62
64
  middlePrice: z.number(),
63
65
  grossProfit: z.number(),
64
66
  marginality: z.number(),
65
- }),
67
+ })
66
68
  )
67
69
  .optional(),
68
70
  }),
package/constant/error.ts CHANGED
@@ -205,6 +205,8 @@ export const ERRORS = {
205
205
  httpCode: 400,
206
206
  },
207
207
  PRODUCT_MULTIPLICITY_OPTION_NOT_FOUND: { code: 'P017', message: 'Product multiplicity option not found', httpCode: 404 },
208
+ PRODUCT_MULTIPLICITY_OPTION_USED_IN_ORDER: { code: 'P018', message: 'Product multiplicity option used in order', httpCode: 400 },
209
+ PRODUCT_MULTIPLICITY_OPTION_NOT_DELETED: { code: 'P019', message: 'Failed to delete product multiplicity option', httpCode: 500 },
208
210
 
209
211
  // PRODUCT CONFIGURATION
210
212
  PRODUCT_CONFIGURATION_NOT_CREATED: { code: 'PCFG001', message: 'Failed to create product configuration', httpCode: 500 },
@@ -715,6 +717,16 @@ export const ERRORS = {
715
717
  httpCode: 400,
716
718
  },
717
719
  PRE_ORDER_COLLECTION_ITEM_EXPORT_FAILED: { code: 'POCI017', message: 'Failed to export pre order collection item', httpCode: 500 },
720
+ PRE_ORDER_COLLECTION_ITEM_MULTIPLICITY_OPTION_USED_IN_PRE_ORDER: {
721
+ code: 'POCI018',
722
+ message: 'Multiplicity option used in pre order',
723
+ httpCode: 400,
724
+ },
725
+ PRE_ORDER_COLLECTION_ITEM_MULTIPLICITY_OPTION_NOT_DELETED: {
726
+ code: 'POCI019',
727
+ message: 'Failed to delete multiplicity option',
728
+ httpCode: 500,
729
+ },
718
730
 
719
731
  // EMPLOYEE SCHEDULE
720
732
  EMPLOYEE_SCHEDULE_NOT_CREATED: { code: 'ES001', message: 'Failed to create employee schedule', httpCode: 500 },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floristcloud/api-lib",
3
- "version": "1.0.17",
3
+ "version": "1.0.20",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -12,6 +12,6 @@
12
12
  "author": "",
13
13
  "license": "ISC",
14
14
  "dependencies": {
15
- "zod": "^3.22.4"
15
+ "zod": "^4.1.13"
16
16
  }
17
17
  }
@@ -28,7 +28,7 @@ const DiscountRulesQuantityBasedDataSchema = z
28
28
  })
29
29
  .and(discountRulesModeSchema);
30
30
 
31
- const DiscountRulesItemDiscountDataSchema = z.object({}).and(discountRulesModeSchema);
31
+ const DiscountRulesItemDiscountDataSchema = discountRulesModeSchema;
32
32
 
33
33
  const DiscountRulesDiscountProhibitedDataSchema = z.object({}).default({});
34
34
 
@@ -58,10 +58,10 @@ export const DiscountRulesTypeSchema = z.discriminatedUnion('type', [
58
58
  export const DiscountRulesBaseSchema = z.object({
59
59
  uuid: z.string(),
60
60
  companyUUID: z.string(),
61
- type: z.nativeEnum(DiscountRulesTypeEnum),
62
- defaultApplyProduct: z.nativeEnum(DiscountRulesApplyTypeEnum),
63
- defaultApplyClient: z.nativeEnum(DiscountRulesApplyTypeEnum),
64
- status: z.nativeEnum(DiscountRulesStatusEnum),
61
+ type: z.enum(DiscountRulesTypeEnum),
62
+ defaultApplyProduct: z.enum(DiscountRulesApplyTypeEnum),
63
+ defaultApplyClient: z.enum(DiscountRulesApplyTypeEnum),
64
+ status: z.enum(DiscountRulesStatusEnum),
65
65
  createdAt: z.coerce.date(),
66
66
  updatedAt: z.coerce.date(),
67
67
  });