vr-commons 1.0.176 → 1.0.178

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 (101) hide show
  1. package/dist/constants/regex.constants.d.ts +19 -0
  2. package/dist/constants/regex.constants.js +24 -0
  3. package/dist/index.d.ts +0 -1
  4. package/dist/index.js +0 -3
  5. package/dist/middlewares/admin/admin.auth.middleware.js +60 -0
  6. package/dist/middlewares/index.d.ts +4 -5
  7. package/dist/middlewares/index.js +11 -14
  8. package/dist/middlewares/shared/auth.admin.middlewares.d.ts +3 -0
  9. package/dist/middlewares/{auth.admin.middlewares.js → shared/auth.admin.middlewares.js} +7 -7
  10. package/dist/middlewares/{account.shared.middlewares.js → shared/shared.account.middleware.js} +8 -8
  11. package/dist/middlewares/{errorHandler.middleware.js → shared/shared.errorHandler.middleware.js} +0 -1
  12. package/dist/middlewares/{auth.users.middlewares.js → users/users.auth.middleware.js} +10 -10
  13. package/dist/utils/{admin.devicePayment.utils.d.ts → admin/admin.devicePayments.utils.d.ts} +2 -1
  14. package/dist/utils/{admin.devicePayment.utils.js → admin/admin.devicePayments.utils.js} +13 -10
  15. package/dist/utils/{admin.device.utils.d.ts → admin/admin.devices.utils.d.ts} +1 -1
  16. package/dist/utils/{admin.device.utils.js → admin/admin.devices.utils.js} +11 -12
  17. package/dist/utils/{eventlogs.admin.utils.js → admin/admin.eventLogs.utils.js} +0 -1
  18. package/dist/utils/{hierarchy.utils.js → admin/admin.hierarchy.utils.js} +0 -2
  19. package/dist/utils/{product.utils.d.ts → admin/admin.products.utils.d.ts} +1 -1
  20. package/dist/utils/{systemLog.utils.js → admin/admin.systemLogs.utils.js} +0 -1
  21. package/dist/utils/index.d.ts +16 -18
  22. package/dist/utils/index.js +88 -99
  23. package/dist/utils/{account.utils.js → shared/shared.accounts.utils.js} +0 -1
  24. package/dist/utils/{profiles.utils.d.ts → shared/shared.profiles.utils.d.ts} +2 -1
  25. package/dist/utils/{profiles.utils.js → shared/shared.profiles.utils.js} +3 -2
  26. package/dist/utils/{verification.utils.d.ts → users/users.verification.utils.d.ts} +1 -1
  27. package/dist/utils/{verification.utils.js → users/users.verification.utils.js} +5 -4
  28. package/dist/validations/{admin.devicePayment.validations.d.ts → admin/admin.devicePayments.validations.d.ts} +59 -59
  29. package/dist/validations/{admin.devicePayment.validations.js → admin/admin.devicePayments.validations.js} +4 -3
  30. package/dist/validations/{admin.devices.validations.d.ts → admin/admin.devices.validations.d.ts} +22 -22
  31. package/dist/validations/{admin.devices.validations.js → admin/admin.devices.validations.js} +4 -5
  32. package/dist/validations/{eventlogs.admin.validations.d.ts → admin/admin.eventLogs.validations.d.ts} +14 -14
  33. package/dist/validations/{eventlogs.admin.validations.js → admin/admin.eventLogs.validations.js} +2 -2
  34. package/dist/validations/{admin.installment.validations.js → admin/admin.installments.validations.js} +5 -4
  35. package/dist/validations/{pricings.validations.d.ts → admin/admin.pricings.validations.d.ts} +60 -60
  36. package/dist/validations/{pricings.validations.js → admin/admin.pricings.validations.js} +5 -5
  37. package/dist/validations/{product.validations.d.ts → admin/admin.products.validations.d.ts} +32 -32
  38. package/dist/validations/{product.validations.js → admin/admin.products.validations.js} +4 -3
  39. package/dist/validations/{users.admin.validations.d.ts → admin/admin.users.validations.d.ts} +44 -44
  40. package/dist/validations/{users.admin.validations.js → admin/admin.users.validations.js} +13 -13
  41. package/dist/validations/index.d.ts +16 -15
  42. package/dist/validations/index.js +132 -125
  43. package/dist/validations/{account.validations.js → shared/shared.account.validations.js} +7 -7
  44. package/dist/validations/{appSpecs.validations.d.ts → shared/shared.appSpecs.validations.d.ts} +14 -14
  45. package/dist/validations/{appSpecs.validations.js → shared/shared.appSpecs.validations.js} +0 -1
  46. package/dist/validations/{auth.validations.js → shared/shared.auth.validations.js} +6 -6
  47. package/dist/validations/{dateRange.validations.js → shared/shared.dateRanges.validations.js} +5 -5
  48. package/dist/validations/{moderation.validations.d.ts → shared/shared.moderation.validations.d.ts} +111 -111
  49. package/dist/validations/{moderation.validations.js → shared/shared.moderation.validations.js} +24 -25
  50. package/dist/validations/{profiles.validations.d.ts → shared/shared.profiles.validations.d.ts} +36 -36
  51. package/dist/validations/{profiles.validations.js → shared/shared.profiles.validations.js} +22 -21
  52. package/dist/validations/{devicePaymentPlan.validations.d.ts → users/users.devicePaymentPlans.validations.d.ts} +16 -16
  53. package/dist/validations/{devices.validations.js → users/users.devices.validations.js} +2 -1
  54. package/package.json +1 -1
  55. package/dist/middlewares/idempotency.middlewares.d.ts +0 -3
  56. package/dist/middlewares/idempotency.middlewares.js +0 -74
  57. package/dist/utils/deviceUtils.d.ts +0 -2
  58. package/dist/utils/deviceUtils.js +0 -21
  59. package/dist/utils/session.utils.d.ts +0 -6
  60. package/dist/utils/session.utils.js +0 -25
  61. package/dist/validations/appeals.validations.d.ts +0 -61
  62. package/dist/validations/appeals.validations.js +0 -31
  63. package/dist/validations/payinstallment.validations.d.ts +0 -56
  64. package/dist/validations/payinstallment.validations.js +0 -23
  65. package/dist/validations/pricing.validations.d.ts +0 -313
  66. package/dist/validations/pricing.validations.js +0 -376
  67. package/dist/middlewares/{auth.admin.middlewares.d.ts → admin/admin.auth.middleware.d.ts} +0 -0
  68. package/dist/middlewares/{account.shared.middlewares.d.ts → shared/shared.account.middleware.d.ts} +0 -0
  69. package/dist/middlewares/{errorHandler.middleware.d.ts → shared/shared.errorHandler.middleware.d.ts} +0 -0
  70. package/dist/middlewares/{auth.users.middlewares.d.ts → users/users.auth.middleware.d.ts} +0 -0
  71. package/dist/utils/{bans.utils.d.ts → admin/admin.bans.utils.d.ts} +0 -0
  72. package/dist/utils/{bans.utils.js → admin/admin.bans.utils.js} +0 -0
  73. package/dist/utils/{eventlogs.admin.utils.d.ts → admin/admin.eventLogs.utils.d.ts} +0 -0
  74. package/dist/utils/{hierarchy.utils.d.ts → admin/admin.hierarchy.utils.d.ts} +0 -0
  75. package/dist/utils/{moderation.utils.d.ts → admin/admin.moderation.utils.d.ts} +0 -0
  76. package/dist/utils/{moderation.utils.js → admin/admin.moderation.utils.js} +0 -0
  77. package/dist/utils/{product.utils.js → admin/admin.products.utils.js} +0 -0
  78. package/dist/utils/{suspension.utils.d.ts → admin/admin.suspensions.utils.d.ts} +0 -0
  79. package/dist/utils/{suspension.utils.js → admin/admin.suspensions.utils.js} +0 -0
  80. package/dist/utils/{systemLog.utils.d.ts → admin/admin.systemLogs.utils.d.ts} +0 -0
  81. package/dist/utils/{account.utils.d.ts → shared/shared.accounts.utils.d.ts} +0 -0
  82. package/dist/utils/{authTokens.utils.d.ts → shared/shared.authTokens.utils.d.ts} +0 -0
  83. package/dist/utils/{authTokens.utils.js → shared/shared.authTokens.utils.js} +0 -0
  84. package/dist/utils/{eventLog.utils.d.ts → shared/shared.eventLogs.utils.d.ts} +0 -0
  85. package/dist/utils/{eventLog.utils.js → shared/shared.eventLogs.utils.js} +0 -0
  86. package/dist/utils/{response.utils.d.ts → shared/shared.responses.utils.d.ts} +0 -0
  87. package/dist/utils/{response.utils.js → shared/shared.responses.utils.js} +0 -0
  88. package/dist/utils/{types.d.ts → shared/shared.types.d.ts} +0 -0
  89. package/dist/utils/{types.js → shared/shared.types.js} +0 -0
  90. package/dist/validations/{bans.validations.d.ts → admin/admin.bans.validations.d.ts} +8 -8
  91. package/dist/validations/{bans.validations.js → admin/admin.bans.validations.js} +0 -0
  92. package/dist/validations/{admin.installment.validations.d.ts → admin/admin.installments.validations.d.ts} +16 -16
  93. package/dist/validations/{suspensions.validations.d.ts → admin/admin.suspensions.validations.d.ts} +8 -8
  94. /package/dist/validations/{suspensions.validations.js → admin/admin.suspensions.validations.js} +0 -0
  95. /package/dist/validations/{account.validations.d.ts → shared/shared.account.validations.d.ts} +0 -0
  96. /package/dist/validations/{auth.validations.d.ts → shared/shared.auth.validations.d.ts} +0 -0
  97. /package/dist/validations/{dateRange.validations.d.ts → shared/shared.dateRanges.validations.d.ts} +0 -0
  98. /package/dist/validations/{validate.validations.d.ts → shared/shared.validate.validations.d.ts} +0 -0
  99. /package/dist/validations/{validate.validations.js → shared/shared.validate.validations.js} +0 -0
  100. /package/dist/validations/{devicePaymentPlan.validations.js → users/users.devicePaymentPlans.validations.js} +0 -0
  101. /package/dist/validations/{devices.validations.d.ts → users/users.devices.validations.d.ts} +0 -0
@@ -59,50 +59,50 @@ export declare const getDevicesSchema: z.ZodObject<{
59
59
  sortBy: z.ZodOptional<z.ZodEnum<["serialNumber", "status", "createdAt", "updatedAt"]>>;
60
60
  sortOrder: z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>;
61
61
  }, "strip", z.ZodTypeAny, {
62
- search?: string | undefined;
63
- limit?: number | undefined;
64
62
  status?: "locked" | "unlocked" | "disabled" | undefined;
65
63
  page?: number | undefined;
66
- sortBy?: "createdAt" | "updatedAt" | "status" | "serialNumber" | undefined;
67
- sortOrder?: "DESC" | "ASC" | undefined;
64
+ limit?: number | undefined;
68
65
  productId?: string | undefined;
66
+ search?: string | undefined;
67
+ sortBy?: "status" | "createdAt" | "updatedAt" | "serialNumber" | undefined;
68
+ sortOrder?: "ASC" | "DESC" | undefined;
69
69
  dedicatedUser?: "PASSENGER" | "RIDER" | "N/A" | undefined;
70
70
  isPermanentlyUnlocked?: "true" | "false" | undefined;
71
71
  isAssigned?: "true" | "false" | undefined;
72
72
  }, {
73
- search?: string | undefined;
74
- limit?: string | undefined;
75
73
  status?: "locked" | "unlocked" | "disabled" | undefined;
76
74
  page?: string | undefined;
77
- sortBy?: "createdAt" | "updatedAt" | "status" | "serialNumber" | undefined;
78
- sortOrder?: "DESC" | "ASC" | undefined;
75
+ limit?: string | undefined;
79
76
  productId?: string | undefined;
77
+ search?: string | undefined;
78
+ sortBy?: "status" | "createdAt" | "updatedAt" | "serialNumber" | undefined;
79
+ sortOrder?: "ASC" | "DESC" | undefined;
80
80
  dedicatedUser?: "PASSENGER" | "RIDER" | "N/A" | undefined;
81
81
  isPermanentlyUnlocked?: "true" | "false" | undefined;
82
82
  isAssigned?: "true" | "false" | undefined;
83
83
  }>;
84
84
  }, "strip", z.ZodTypeAny, {
85
85
  query: {
86
- search?: string | undefined;
87
- limit?: number | undefined;
88
86
  status?: "locked" | "unlocked" | "disabled" | undefined;
89
87
  page?: number | undefined;
90
- sortBy?: "createdAt" | "updatedAt" | "status" | "serialNumber" | undefined;
91
- sortOrder?: "DESC" | "ASC" | undefined;
88
+ limit?: number | undefined;
92
89
  productId?: string | undefined;
90
+ search?: string | undefined;
91
+ sortBy?: "status" | "createdAt" | "updatedAt" | "serialNumber" | undefined;
92
+ sortOrder?: "ASC" | "DESC" | undefined;
93
93
  dedicatedUser?: "PASSENGER" | "RIDER" | "N/A" | undefined;
94
94
  isPermanentlyUnlocked?: "true" | "false" | undefined;
95
95
  isAssigned?: "true" | "false" | undefined;
96
96
  };
97
97
  }, {
98
98
  query: {
99
- search?: string | undefined;
100
- limit?: string | undefined;
101
99
  status?: "locked" | "unlocked" | "disabled" | undefined;
102
100
  page?: string | undefined;
103
- sortBy?: "createdAt" | "updatedAt" | "status" | "serialNumber" | undefined;
104
- sortOrder?: "DESC" | "ASC" | undefined;
101
+ limit?: string | undefined;
105
102
  productId?: string | undefined;
103
+ search?: string | undefined;
104
+ sortBy?: "status" | "createdAt" | "updatedAt" | "serialNumber" | undefined;
105
+ sortOrder?: "ASC" | "DESC" | undefined;
106
106
  dedicatedUser?: "PASSENGER" | "RIDER" | "N/A" | undefined;
107
107
  isPermanentlyUnlocked?: "true" | "false" | undefined;
108
108
  isAssigned?: "true" | "false" | undefined;
@@ -330,20 +330,20 @@ export declare const customDeviceResetSchema: z.ZodObject<{
330
330
  }, "strip", z.ZodTypeAny, {
331
331
  status?: string | string[] | undefined;
332
332
  productId?: string | string[] | undefined;
333
+ pairId?: string | string[] | undefined;
333
334
  dedicatedUser?: string | string[] | undefined;
334
335
  isPermanentlyUnlocked?: boolean | undefined;
335
336
  excludeStatus?: string | string[] | undefined;
336
- pairId?: string | string[] | undefined;
337
337
  excludePairIds?: string | string[] | undefined;
338
338
  createdBefore?: string | undefined;
339
339
  createdAfter?: string | undefined;
340
340
  }, {
341
341
  status?: string | string[] | undefined;
342
342
  productId?: string | string[] | undefined;
343
+ pairId?: string | string[] | undefined;
343
344
  dedicatedUser?: string | string[] | undefined;
344
345
  isPermanentlyUnlocked?: boolean | undefined;
345
346
  excludeStatus?: string | string[] | undefined;
346
- pairId?: string | string[] | undefined;
347
347
  excludePairIds?: string | string[] | undefined;
348
348
  createdBefore?: string | undefined;
349
349
  createdAfter?: string | undefined;
@@ -382,10 +382,10 @@ export declare const customDeviceResetSchema: z.ZodObject<{
382
382
  condition?: {
383
383
  status?: string | string[] | undefined;
384
384
  productId?: string | string[] | undefined;
385
+ pairId?: string | string[] | undefined;
385
386
  dedicatedUser?: string | string[] | undefined;
386
387
  isPermanentlyUnlocked?: boolean | undefined;
387
388
  excludeStatus?: string | string[] | undefined;
388
- pairId?: string | string[] | undefined;
389
389
  excludePairIds?: string | string[] | undefined;
390
390
  createdBefore?: string | undefined;
391
391
  createdAfter?: string | undefined;
@@ -403,10 +403,10 @@ export declare const customDeviceResetSchema: z.ZodObject<{
403
403
  condition?: {
404
404
  status?: string | string[] | undefined;
405
405
  productId?: string | string[] | undefined;
406
+ pairId?: string | string[] | undefined;
406
407
  dedicatedUser?: string | string[] | undefined;
407
408
  isPermanentlyUnlocked?: boolean | undefined;
408
409
  excludeStatus?: string | string[] | undefined;
409
- pairId?: string | string[] | undefined;
410
410
  excludePairIds?: string | string[] | undefined;
411
411
  createdBefore?: string | undefined;
412
412
  createdAfter?: string | undefined;
@@ -426,10 +426,10 @@ export declare const customDeviceResetSchema: z.ZodObject<{
426
426
  condition?: {
427
427
  status?: string | string[] | undefined;
428
428
  productId?: string | string[] | undefined;
429
+ pairId?: string | string[] | undefined;
429
430
  dedicatedUser?: string | string[] | undefined;
430
431
  isPermanentlyUnlocked?: boolean | undefined;
431
432
  excludeStatus?: string | string[] | undefined;
432
- pairId?: string | string[] | undefined;
433
433
  excludePairIds?: string | string[] | undefined;
434
434
  createdBefore?: string | undefined;
435
435
  createdAfter?: string | undefined;
@@ -449,10 +449,10 @@ export declare const customDeviceResetSchema: z.ZodObject<{
449
449
  condition?: {
450
450
  status?: string | string[] | undefined;
451
451
  productId?: string | string[] | undefined;
452
+ pairId?: string | string[] | undefined;
452
453
  dedicatedUser?: string | string[] | undefined;
453
454
  isPermanentlyUnlocked?: boolean | undefined;
454
455
  excludeStatus?: string | string[] | undefined;
455
- pairId?: string | string[] | undefined;
456
456
  excludePairIds?: string | string[] | undefined;
457
457
  createdBefore?: string | undefined;
458
458
  createdAfter?: string | undefined;
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.customDeviceResetSchema = exports.triggerDeviceResetSchema = exports.checkAvailabilitySchema = exports.makeDevicesPermanentSchema = exports.enableDevicesSchema = exports.disableDevicesSchema = exports.unlockDevicesSchema = exports.lockDevicesSchema = exports.permanentDeleteDevicesByPairsSchema = exports.deleteDevicesByPairsSchema = exports.getDevicesSchema = exports.getDeviceSchema = exports.createDevicePairsSchema = exports.deduplicatePairIds = exports.PAIR_ID_REGEX = void 0;
4
- // src/validations/device.validations.ts
5
4
  const zod_1 = require("zod");
6
5
  const vr_models_1 = require("vr-models");
6
+ const regex_constants_1 = require("../../constants/regex.constants");
7
7
  // ✅ Pair ID format: 2 letters + 3 numbers + 1 letter
8
8
  // Example: AA001A, AB123B, XZ999Z
9
9
  // No letter 'O' to avoid confusion with 0
10
- exports.PAIR_ID_REGEX = /^[A-NP-Z]{2}[0-9]{3}[A-NP-Z]{1}$/;
10
+ exports.PAIR_ID_REGEX = regex_constants_1.DEVICE_PAIR_ID_REGEX;
11
11
  const PAIR_ID_ERROR = "Pair ID must be 6 characters: 2 letters (A-Z, excluding O) + 3 digits + 1 letter (A-Z, excluding O). Example: AA001A";
12
12
  // ✅ Helper to remove duplicates and return unique pair IDs
13
13
  const deduplicatePairIds = (pairIds) => {
@@ -43,8 +43,8 @@ exports.getDeviceSchema = zod_1.z.object({
43
43
  // Get all devices schema (with pagination and filters)
44
44
  exports.getDevicesSchema = zod_1.z.object({
45
45
  query: zod_1.z.object({
46
- page: zod_1.z.string().regex(/^\d+$/).transform(Number).optional(),
47
- limit: zod_1.z.string().regex(/^\d+$/).transform(Number).optional(),
46
+ page: zod_1.z.string().regex(regex_constants_1.NUMERIC_STRING_REGEX).transform(Number).optional(),
47
+ limit: zod_1.z.string().regex(regex_constants_1.NUMERIC_STRING_REGEX).transform(Number).optional(),
48
48
  // Filters
49
49
  productId: zod_1.z.string().uuid().optional(),
50
50
  status: zod_1.z.enum(vr_models_1.DEVICE_STATUS).optional(),
@@ -58,7 +58,6 @@ exports.getDevicesSchema = zod_1.z.object({
58
58
  sortOrder: zod_1.z.enum(["ASC", "DESC"]).optional(),
59
59
  }),
60
60
  });
61
- // src/validations/device.validations.ts
62
61
  // ==================== DELETE SCHEMAS (PAIR ONLY) ====================
63
62
  // Soft delete by pair IDs
64
63
  exports.deleteDevicesByPairsSchema = zod_1.z.object({
@@ -18,10 +18,10 @@ export declare const listEventLogsSchema: z.ZodObject<{
18
18
  sortOrder: z.ZodDefault<z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>>;
19
19
  hasDeviceSession: z.ZodEffects<z.ZodOptional<z.ZodString>, boolean, string | undefined>;
20
20
  }, "strip", z.ZodTypeAny, {
21
- limit: number;
22
21
  page: number;
22
+ limit: number;
23
23
  sortBy: "createdAt" | "actorType" | "action" | "entity";
24
- sortOrder: "DESC" | "ASC";
24
+ sortOrder: "ASC" | "DESC";
25
25
  hasDeviceSession: boolean;
26
26
  search?: string | undefined;
27
27
  firstName?: string | undefined;
@@ -35,15 +35,15 @@ export declare const listEventLogsSchema: z.ZodObject<{
35
35
  entityId?: string | undefined;
36
36
  actorName?: string | undefined;
37
37
  }, {
38
- search?: string | undefined;
38
+ page?: string | undefined;
39
39
  limit?: string | undefined;
40
+ search?: string | undefined;
41
+ sortBy?: "createdAt" | "actorType" | "action" | "entity" | undefined;
42
+ sortOrder?: "ASC" | "DESC" | undefined;
40
43
  firstName?: string | undefined;
41
44
  lastName?: string | undefined;
42
- page?: string | undefined;
43
- sortBy?: "createdAt" | "actorType" | "action" | "entity" | undefined;
44
45
  fromDate?: string | undefined;
45
46
  toDate?: string | undefined;
46
- sortOrder?: "DESC" | "ASC" | undefined;
47
47
  actorType?: "ADMIN" | "PASSENGER" | "RIDER" | "AGENT" | "SUPER_ADMIN" | undefined;
48
48
  actorId?: string | undefined;
49
49
  action?: string | undefined;
@@ -52,15 +52,15 @@ export declare const listEventLogsSchema: z.ZodObject<{
52
52
  actorName?: string | undefined;
53
53
  hasDeviceSession?: string | undefined;
54
54
  }>, any, {
55
- search?: string | undefined;
55
+ page?: string | undefined;
56
56
  limit?: string | undefined;
57
+ search?: string | undefined;
58
+ sortBy?: "createdAt" | "actorType" | "action" | "entity" | undefined;
59
+ sortOrder?: "ASC" | "DESC" | undefined;
57
60
  firstName?: string | undefined;
58
61
  lastName?: string | undefined;
59
- page?: string | undefined;
60
- sortBy?: "createdAt" | "actorType" | "action" | "entity" | undefined;
61
62
  fromDate?: string | undefined;
62
63
  toDate?: string | undefined;
63
- sortOrder?: "DESC" | "ASC" | undefined;
64
64
  actorType?: "ADMIN" | "PASSENGER" | "RIDER" | "AGENT" | "SUPER_ADMIN" | undefined;
65
65
  actorId?: string | undefined;
66
66
  action?: string | undefined;
@@ -73,15 +73,15 @@ export declare const listEventLogsSchema: z.ZodObject<{
73
73
  query?: any;
74
74
  }, {
75
75
  query: {
76
- search?: string | undefined;
76
+ page?: string | undefined;
77
77
  limit?: string | undefined;
78
+ search?: string | undefined;
79
+ sortBy?: "createdAt" | "actorType" | "action" | "entity" | undefined;
80
+ sortOrder?: "ASC" | "DESC" | undefined;
78
81
  firstName?: string | undefined;
79
82
  lastName?: string | undefined;
80
- page?: string | undefined;
81
- sortBy?: "createdAt" | "actorType" | "action" | "entity" | undefined;
82
83
  fromDate?: string | undefined;
83
84
  toDate?: string | undefined;
84
- sortOrder?: "DESC" | "ASC" | undefined;
85
85
  actorType?: "ADMIN" | "PASSENGER" | "RIDER" | "AGENT" | "SUPER_ADMIN" | undefined;
86
86
  actorId?: string | undefined;
87
87
  action?: string | undefined;
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getEventLogSchema = exports.listEventLogsSchema = void 0;
4
- // src/modules/event-logs/validations/eventLogs.validations.ts
5
4
  const zod_1 = require("zod");
6
5
  const vr_models_1 = require("vr-models");
6
+ const regex_constants_1 = require("../../constants/regex.constants");
7
7
  // Base schemas
8
8
  const uuidSchema = zod_1.z.string().uuid("Invalid UUID format");
9
9
  // Date validator for filtering - keeps as string for query param validation
10
10
  const dateValidator = zod_1.z
11
11
  .string()
12
- .regex(/^\d{4}-\d{2}-\d{2}$/, "Date must be in YYYY-MM-DD format");
12
+ .regex(regex_constants_1.ISO_DATE_REGEX, "Date must be in YYYY-MM-DD format");
13
13
  // Convert readonly array to mutable tuple for zod enum
14
14
  const eventActionsList = [...vr_models_1.EVENT_ACTIONS];
15
15
  // ==================== GET ALL EVENT LOGS ====================
@@ -3,14 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.payInstallmentSchema = exports.getInstallmentByIdSchema = exports.getInstallmentsSchema = void 0;
4
4
  const vr_models_1 = require("vr-models");
5
5
  const zod_1 = require("zod");
6
- const phoneRegex = /^\+250(78|79|73|72)[0-9]{7}$/;
6
+ const regex_constants_1 = require("../../constants/regex.constants");
7
+ const phoneRegex = regex_constants_1.PHONE_NUMBER_REGEX;
7
8
  console.log("from vr-commons", vr_models_1.PAYMENT_PROVIDER);
8
9
  exports.getInstallmentsSchema = zod_1.z.object({
9
10
  query: zod_1.z.object({
10
11
  planId: zod_1.z.string().uuid().optional(),
11
12
  status: zod_1.z.enum([...vr_models_1.INSTALLMENT_STATUS]).optional(),
12
- page: zod_1.z.string().regex(/^\d+$/).transform(Number).optional(),
13
- limit: zod_1.z.string().regex(/^\d+$/).transform(Number).optional(),
13
+ page: zod_1.z.string().regex(regex_constants_1.NUMERIC_STRING_REGEX).transform(Number).optional(),
14
+ limit: zod_1.z.string().regex(regex_constants_1.NUMERIC_STRING_REGEX).transform(Number).optional(),
14
15
  }),
15
16
  });
16
17
  exports.getInstallmentByIdSchema = zod_1.z.object({
@@ -25,7 +26,7 @@ exports.payInstallmentSchema = zod_1.z.object({
25
26
  body: zod_1.z.object({
26
27
  amount: zod_1.z.number().min(0.01, "Amount must be greater than 0"),
27
28
  provider: zod_1.z.enum([...vr_models_1.PAYMENT_PROVIDER]).default("MOMO_PAY"),
28
- providerReference: zod_1.z.string(),
29
+ providerReference: zod_1.z.string().trim().min(1).max(255),
29
30
  customerPhone: zod_1.z
30
31
  .string()
31
32
  .regex(phoneRegex, "Invalid MTN Rwanda phone number"),
@@ -16,56 +16,56 @@ export declare const createPricingSchema: z.ZodObject<{
16
16
  isActive: z.ZodOptional<z.ZodBoolean>;
17
17
  }, "strip", z.ZodTypeAny, {
18
18
  type: "HIRE_PURCHASE" | "FULL_PAYMENT";
19
- name: string;
20
19
  productId: string;
20
+ name: string;
21
21
  unitPrice: number;
22
22
  isActive?: boolean | undefined;
23
- downPayment?: number | undefined;
23
+ installmentCount?: number | null | undefined;
24
24
  installmentAmount?: number | null | undefined;
25
25
  installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
26
- installmentCount?: number | null | undefined;
26
+ downPayment?: number | undefined;
27
27
  gracePeriodDays?: number | undefined;
28
28
  autoLockOnMiss?: boolean | undefined;
29
29
  minOrderQuantity?: number | undefined;
30
30
  maxOrderQuantity?: number | undefined;
31
31
  }, {
32
32
  type: "HIRE_PURCHASE" | "FULL_PAYMENT";
33
- name: string;
34
33
  productId: string;
34
+ name: string;
35
35
  unitPrice: number;
36
36
  isActive?: boolean | undefined;
37
- downPayment?: number | undefined;
37
+ installmentCount?: number | null | undefined;
38
38
  installmentAmount?: number | null | undefined;
39
39
  installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
40
- installmentCount?: number | null | undefined;
40
+ downPayment?: number | undefined;
41
41
  gracePeriodDays?: number | undefined;
42
42
  autoLockOnMiss?: boolean | undefined;
43
43
  minOrderQuantity?: number | undefined;
44
44
  maxOrderQuantity?: number | undefined;
45
45
  }>, {
46
46
  type: "HIRE_PURCHASE" | "FULL_PAYMENT";
47
- name: string;
48
47
  productId: string;
48
+ name: string;
49
49
  unitPrice: number;
50
50
  isActive?: boolean | undefined;
51
- downPayment?: number | undefined;
51
+ installmentCount?: number | null | undefined;
52
52
  installmentAmount?: number | null | undefined;
53
53
  installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
54
- installmentCount?: number | null | undefined;
54
+ downPayment?: number | undefined;
55
55
  gracePeriodDays?: number | undefined;
56
56
  autoLockOnMiss?: boolean | undefined;
57
57
  minOrderQuantity?: number | undefined;
58
58
  maxOrderQuantity?: number | undefined;
59
59
  }, {
60
60
  type: "HIRE_PURCHASE" | "FULL_PAYMENT";
61
- name: string;
62
61
  productId: string;
62
+ name: string;
63
63
  unitPrice: number;
64
64
  isActive?: boolean | undefined;
65
- downPayment?: number | undefined;
65
+ installmentCount?: number | null | undefined;
66
66
  installmentAmount?: number | null | undefined;
67
67
  installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
68
- installmentCount?: number | null | undefined;
68
+ downPayment?: number | undefined;
69
69
  gracePeriodDays?: number | undefined;
70
70
  autoLockOnMiss?: boolean | undefined;
71
71
  minOrderQuantity?: number | undefined;
@@ -74,14 +74,14 @@ export declare const createPricingSchema: z.ZodObject<{
74
74
  }, "strip", z.ZodTypeAny, {
75
75
  body: {
76
76
  type: "HIRE_PURCHASE" | "FULL_PAYMENT";
77
- name: string;
78
77
  productId: string;
78
+ name: string;
79
79
  unitPrice: number;
80
80
  isActive?: boolean | undefined;
81
- downPayment?: number | undefined;
81
+ installmentCount?: number | null | undefined;
82
82
  installmentAmount?: number | null | undefined;
83
83
  installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
84
- installmentCount?: number | null | undefined;
84
+ downPayment?: number | undefined;
85
85
  gracePeriodDays?: number | undefined;
86
86
  autoLockOnMiss?: boolean | undefined;
87
87
  minOrderQuantity?: number | undefined;
@@ -90,14 +90,14 @@ export declare const createPricingSchema: z.ZodObject<{
90
90
  }, {
91
91
  body: {
92
92
  type: "HIRE_PURCHASE" | "FULL_PAYMENT";
93
- name: string;
94
93
  productId: string;
94
+ name: string;
95
95
  unitPrice: number;
96
96
  isActive?: boolean | undefined;
97
- downPayment?: number | undefined;
97
+ installmentCount?: number | null | undefined;
98
98
  installmentAmount?: number | null | undefined;
99
99
  installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
100
- installmentCount?: number | null | undefined;
100
+ downPayment?: number | undefined;
101
101
  gracePeriodDays?: number | undefined;
102
102
  autoLockOnMiss?: boolean | undefined;
103
103
  minOrderQuantity?: number | undefined;
@@ -128,12 +128,12 @@ export declare const updatePricingSchema: z.ZodObject<{
128
128
  }, "strip", z.ZodTypeAny, {
129
129
  type?: "HIRE_PURCHASE" | "FULL_PAYMENT" | undefined;
130
130
  isActive?: boolean | undefined;
131
+ installmentCount?: number | null | undefined;
132
+ installmentAmount?: number | null | undefined;
133
+ installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
131
134
  name?: string | undefined;
132
135
  unitPrice?: number | undefined;
133
136
  downPayment?: number | undefined;
134
- installmentAmount?: number | null | undefined;
135
- installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
136
- installmentCount?: number | null | undefined;
137
137
  gracePeriodDays?: number | undefined;
138
138
  autoLockOnMiss?: boolean | undefined;
139
139
  minOrderQuantity?: number | undefined;
@@ -141,12 +141,12 @@ export declare const updatePricingSchema: z.ZodObject<{
141
141
  }, {
142
142
  type?: "HIRE_PURCHASE" | "FULL_PAYMENT" | undefined;
143
143
  isActive?: boolean | undefined;
144
+ installmentCount?: number | null | undefined;
145
+ installmentAmount?: number | null | undefined;
146
+ installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
144
147
  name?: string | undefined;
145
148
  unitPrice?: number | undefined;
146
149
  downPayment?: number | undefined;
147
- installmentAmount?: number | null | undefined;
148
- installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
149
- installmentCount?: number | null | undefined;
150
150
  gracePeriodDays?: number | undefined;
151
151
  autoLockOnMiss?: boolean | undefined;
152
152
  minOrderQuantity?: number | undefined;
@@ -154,12 +154,12 @@ export declare const updatePricingSchema: z.ZodObject<{
154
154
  }>, {
155
155
  type?: "HIRE_PURCHASE" | "FULL_PAYMENT" | undefined;
156
156
  isActive?: boolean | undefined;
157
+ installmentCount?: number | null | undefined;
158
+ installmentAmount?: number | null | undefined;
159
+ installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
157
160
  name?: string | undefined;
158
161
  unitPrice?: number | undefined;
159
162
  downPayment?: number | undefined;
160
- installmentAmount?: number | null | undefined;
161
- installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
162
- installmentCount?: number | null | undefined;
163
163
  gracePeriodDays?: number | undefined;
164
164
  autoLockOnMiss?: boolean | undefined;
165
165
  minOrderQuantity?: number | undefined;
@@ -167,53 +167,53 @@ export declare const updatePricingSchema: z.ZodObject<{
167
167
  }, {
168
168
  type?: "HIRE_PURCHASE" | "FULL_PAYMENT" | undefined;
169
169
  isActive?: boolean | undefined;
170
+ installmentCount?: number | null | undefined;
171
+ installmentAmount?: number | null | undefined;
172
+ installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
170
173
  name?: string | undefined;
171
174
  unitPrice?: number | undefined;
172
175
  downPayment?: number | undefined;
173
- installmentAmount?: number | null | undefined;
174
- installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
175
- installmentCount?: number | null | undefined;
176
176
  gracePeriodDays?: number | undefined;
177
177
  autoLockOnMiss?: boolean | undefined;
178
178
  minOrderQuantity?: number | undefined;
179
179
  maxOrderQuantity?: number | undefined;
180
180
  }>;
181
181
  }, "strip", z.ZodTypeAny, {
182
+ params: {
183
+ id: string;
184
+ };
182
185
  body: {
183
186
  type?: "HIRE_PURCHASE" | "FULL_PAYMENT" | undefined;
184
187
  isActive?: boolean | undefined;
188
+ installmentCount?: number | null | undefined;
189
+ installmentAmount?: number | null | undefined;
190
+ installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
185
191
  name?: string | undefined;
186
192
  unitPrice?: number | undefined;
187
193
  downPayment?: number | undefined;
188
- installmentAmount?: number | null | undefined;
189
- installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
190
- installmentCount?: number | null | undefined;
191
194
  gracePeriodDays?: number | undefined;
192
195
  autoLockOnMiss?: boolean | undefined;
193
196
  minOrderQuantity?: number | undefined;
194
197
  maxOrderQuantity?: number | undefined;
195
198
  };
199
+ }, {
196
200
  params: {
197
201
  id: string;
198
202
  };
199
- }, {
200
203
  body: {
201
204
  type?: "HIRE_PURCHASE" | "FULL_PAYMENT" | undefined;
202
205
  isActive?: boolean | undefined;
206
+ installmentCount?: number | null | undefined;
207
+ installmentAmount?: number | null | undefined;
208
+ installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
203
209
  name?: string | undefined;
204
210
  unitPrice?: number | undefined;
205
211
  downPayment?: number | undefined;
206
- installmentAmount?: number | null | undefined;
207
- installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
208
- installmentCount?: number | null | undefined;
209
212
  gracePeriodDays?: number | undefined;
210
213
  autoLockOnMiss?: boolean | undefined;
211
214
  minOrderQuantity?: number | undefined;
212
215
  maxOrderQuantity?: number | undefined;
213
216
  };
214
- params: {
215
- id: string;
216
- };
217
217
  }>;
218
218
  export declare const getPricingSchema: z.ZodObject<{
219
219
  params: z.ZodObject<{
@@ -245,51 +245,51 @@ export declare const getPricingsSchema: z.ZodObject<{
245
245
  sortBy: z.ZodOptional<z.ZodEnum<["name", "unitPrice", "createdAt", "updatedAt"]>>;
246
246
  sortOrder: z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>;
247
247
  }, "strip", z.ZodTypeAny, {
248
- search?: string | undefined;
249
248
  type?: "HIRE_PURCHASE" | "FULL_PAYMENT" | undefined;
250
- limit?: number | undefined;
251
- isActive?: "true" | "false" | undefined;
252
249
  page?: number | undefined;
253
- sortBy?: "createdAt" | "updatedAt" | "name" | "unitPrice" | undefined;
254
- sortOrder?: "DESC" | "ASC" | undefined;
250
+ limit?: number | undefined;
255
251
  productId?: string | undefined;
252
+ search?: string | undefined;
253
+ sortBy?: "createdAt" | "updatedAt" | "name" | "unitPrice" | undefined;
254
+ sortOrder?: "ASC" | "DESC" | undefined;
255
+ isActive?: "true" | "false" | undefined;
256
256
  minAmount?: number | undefined;
257
257
  maxAmount?: number | undefined;
258
258
  }, {
259
- search?: string | undefined;
260
259
  type?: "HIRE_PURCHASE" | "FULL_PAYMENT" | undefined;
261
- limit?: string | undefined;
262
- isActive?: "true" | "false" | undefined;
263
260
  page?: string | undefined;
264
- sortBy?: "createdAt" | "updatedAt" | "name" | "unitPrice" | undefined;
265
- sortOrder?: "DESC" | "ASC" | undefined;
261
+ limit?: string | undefined;
266
262
  productId?: string | undefined;
263
+ search?: string | undefined;
264
+ sortBy?: "createdAt" | "updatedAt" | "name" | "unitPrice" | undefined;
265
+ sortOrder?: "ASC" | "DESC" | undefined;
266
+ isActive?: "true" | "false" | undefined;
267
267
  minAmount?: string | undefined;
268
268
  maxAmount?: string | undefined;
269
269
  }>;
270
270
  }, "strip", z.ZodTypeAny, {
271
271
  query: {
272
- search?: string | undefined;
273
272
  type?: "HIRE_PURCHASE" | "FULL_PAYMENT" | undefined;
274
- limit?: number | undefined;
275
- isActive?: "true" | "false" | undefined;
276
273
  page?: number | undefined;
277
- sortBy?: "createdAt" | "updatedAt" | "name" | "unitPrice" | undefined;
278
- sortOrder?: "DESC" | "ASC" | undefined;
274
+ limit?: number | undefined;
279
275
  productId?: string | undefined;
276
+ search?: string | undefined;
277
+ sortBy?: "createdAt" | "updatedAt" | "name" | "unitPrice" | undefined;
278
+ sortOrder?: "ASC" | "DESC" | undefined;
279
+ isActive?: "true" | "false" | undefined;
280
280
  minAmount?: number | undefined;
281
281
  maxAmount?: number | undefined;
282
282
  };
283
283
  }, {
284
284
  query: {
285
- search?: string | undefined;
286
285
  type?: "HIRE_PURCHASE" | "FULL_PAYMENT" | undefined;
287
- limit?: string | undefined;
288
- isActive?: "true" | "false" | undefined;
289
286
  page?: string | undefined;
290
- sortBy?: "createdAt" | "updatedAt" | "name" | "unitPrice" | undefined;
291
- sortOrder?: "DESC" | "ASC" | undefined;
287
+ limit?: string | undefined;
292
288
  productId?: string | undefined;
289
+ search?: string | undefined;
290
+ sortBy?: "createdAt" | "updatedAt" | "name" | "unitPrice" | undefined;
291
+ sortOrder?: "ASC" | "DESC" | undefined;
292
+ isActive?: "true" | "false" | undefined;
293
293
  minAmount?: string | undefined;
294
294
  maxAmount?: string | undefined;
295
295
  };
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deletePricingSchema = exports.getPricingsSchema = exports.getPricingSchema = exports.updatePricingSchema = exports.createPricingSchema = void 0;
4
- // src/validations/pricing.validation.ts
5
4
  const zod_1 = require("zod");
6
5
  const vr_models_1 = require("vr-models");
6
+ const regex_constants_1 = require("../../constants/regex.constants");
7
7
  // Base pricing schema
8
8
  const pricingBaseSchema = {
9
9
  productId: zod_1.z.string().uuid("Invalid product ID"),
@@ -334,13 +334,13 @@ exports.getPricingSchema = zod_1.z.object({
334
334
  // Get all pricings schema
335
335
  exports.getPricingsSchema = zod_1.z.object({
336
336
  query: zod_1.z.object({
337
- page: zod_1.z.string().regex(/^\d+$/).transform(Number).optional(),
338
- limit: zod_1.z.string().regex(/^\d+$/).transform(Number).optional(),
337
+ page: zod_1.z.string().regex(regex_constants_1.NUMERIC_STRING_REGEX).transform(Number).optional(),
338
+ limit: zod_1.z.string().regex(regex_constants_1.NUMERIC_STRING_REGEX).transform(Number).optional(),
339
339
  productId: zod_1.z.string().uuid().optional(),
340
340
  type: zod_1.z.enum(vr_models_1.PRICING_TYPE).optional(),
341
341
  isActive: zod_1.z.enum(["true", "false"]).optional(),
342
- minAmount: zod_1.z.string().regex(/^\d+$/).transform(Number).optional(),
343
- maxAmount: zod_1.z.string().regex(/^\d+$/).transform(Number).optional(),
342
+ minAmount: zod_1.z.string().regex(regex_constants_1.NUMERIC_STRING_REGEX).transform(Number).optional(),
343
+ maxAmount: zod_1.z.string().regex(regex_constants_1.NUMERIC_STRING_REGEX).transform(Number).optional(),
344
344
  search: zod_1.z.string().optional(),
345
345
  sortBy: zod_1.z
346
346
  .enum(["name", "unitPrice", "createdAt", "updatedAt"]) // ✅ Changed from totalAmount