vr-commons 1.0.73 → 1.0.74

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.
@@ -81,7 +81,7 @@ const checkAccountDependencies = async (userId, transaction) => {
81
81
  const activeDevicePlans = await vr_models_1.DevicePaymentPlan.count({
82
82
  where: {
83
83
  userId,
84
- status: "ACTIVE", // Adjust based on your status enum
84
+ status: { [sequelize_1.Op.in]: ["ACTIVE", "DEFAULTED"] }, // Adjust based on your status enum
85
85
  },
86
86
  transaction,
87
87
  });
@@ -10,3 +10,4 @@ export { listUserPaymentPlansSchema, getUserPaymentPlanSchema, } from "./deviceP
10
10
  export { unlockDeviceSchema, extendSessionSchema } from "./devices.validations";
11
11
  export { payInstallmentSchema } from "./payinstallment.validations";
12
12
  export { updateProfileSchema, requestPhoneChangeSchema, verifyPhoneChangeSchema, deleteAccountSchema, } from "./account.validations";
13
+ export { upgradeToRiderSchema } from "./user.management.validations";
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.verifyPhoneChangeSchema = exports.requestPhoneChangeSchema = exports.updateProfileSchema = exports.payInstallmentSchema = exports.extendSessionSchema = exports.unlockDeviceSchema = exports.getUserPaymentPlanSchema = exports.listUserPaymentPlansSchema = exports.getAppSpecsSchema = exports.activateAppSpecsSchema = exports.getActiveAppSpecsSchema = exports.listAppSpecsSchema = exports.updateAppSpecsSchema = exports.createAppSpecsSchema = exports.createSuspensionSchema = exports.getUserSuspensionsSchema = exports.getSuspensionSchema = exports.createBanSchema = exports.getUserRestrictionsSchema = exports.getBanSchema = exports.submitSuspensionAppealSchema = exports.submitBanAppealSchema = exports.exportBansSchema = exports.extendSuspensionSchema = exports.revokeSuspensionSchema = exports.revokeBanSchema = exports.reviewAppealSchema = exports.listSuspensionsSchema = exports.listPendingAppealsSchema = exports.listBansSchema = exports.deactivateAccountSchema = exports.changePasswordSchema = exports.createRiderSchema = exports.updateRiderProfileSchema = exports.updatePassengerProfileSchema = exports.passengerSignupSchema = exports.viewProfileSchema = exports.getAllUsersSchema = exports.updateUserProfileSchema = exports.getUserByIdSchema = exports.createUserSchema = exports.requestOtpSchema = exports.resendOtpSchema = exports.verifyOtpSchema = exports.registerSchema = exports.refreshTokenSchema = exports.userLoginSchema = exports.forgotPasswordSchema = exports.riderLoginSchema = exports.validate = void 0;
4
- exports.deleteAccountSchema = void 0;
4
+ exports.upgradeToRiderSchema = exports.deleteAccountSchema = void 0;
5
5
  var validate_validations_1 = require("./validate.validations");
6
6
  Object.defineProperty(exports, "validate", { enumerable: true, get: function () { return validate_validations_1.validate; } });
7
7
  var auth_validations_1 = require("./auth.validations");
@@ -70,3 +70,5 @@ Object.defineProperty(exports, "updateProfileSchema", { enumerable: true, get: f
70
70
  Object.defineProperty(exports, "requestPhoneChangeSchema", { enumerable: true, get: function () { return account_validations_1.requestPhoneChangeSchema; } });
71
71
  Object.defineProperty(exports, "verifyPhoneChangeSchema", { enumerable: true, get: function () { return account_validations_1.verifyPhoneChangeSchema; } });
72
72
  Object.defineProperty(exports, "deleteAccountSchema", { enumerable: true, get: function () { return account_validations_1.deleteAccountSchema; } });
73
+ var user_management_validations_1 = require("./user.management.validations");
74
+ Object.defineProperty(exports, "upgradeToRiderSchema", { enumerable: true, get: function () { return user_management_validations_1.upgradeToRiderSchema; } });
@@ -0,0 +1,56 @@
1
+ import { z } from "zod";
2
+ export declare const upgradeToRiderSchema: z.ZodObject<{
3
+ params: z.ZodObject<{
4
+ userId: z.ZodString;
5
+ }, "strip", z.ZodTypeAny, {
6
+ userId: string;
7
+ }, {
8
+ userId: string;
9
+ }>;
10
+ body: z.ZodEffects<z.ZodObject<{
11
+ jacketId: z.ZodString;
12
+ nationalId: z.ZodString;
13
+ phoneNumber: z.ZodEffects<z.ZodString, string, string>;
14
+ plateNumber: z.ZodOptional<z.ZodString>;
15
+ }, "strip", z.ZodTypeAny, {
16
+ jacketId: string;
17
+ nationalId: string;
18
+ phoneNumber: string;
19
+ plateNumber?: string | undefined;
20
+ }, {
21
+ jacketId: string;
22
+ nationalId: string;
23
+ phoneNumber: string;
24
+ plateNumber?: string | undefined;
25
+ }>, {
26
+ jacketId: string;
27
+ nationalId: string;
28
+ phoneNumber: string;
29
+ plateNumber?: string | undefined;
30
+ }, {
31
+ jacketId: string;
32
+ nationalId: string;
33
+ phoneNumber: string;
34
+ plateNumber?: string | undefined;
35
+ }>;
36
+ }, "strip", z.ZodTypeAny, {
37
+ params: {
38
+ userId: string;
39
+ };
40
+ body: {
41
+ jacketId: string;
42
+ nationalId: string;
43
+ phoneNumber: string;
44
+ plateNumber?: string | undefined;
45
+ };
46
+ }, {
47
+ params: {
48
+ userId: string;
49
+ };
50
+ body: {
51
+ jacketId: string;
52
+ nationalId: string;
53
+ phoneNumber: string;
54
+ plateNumber?: string | undefined;
55
+ };
56
+ }>;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.upgradeToRiderSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const auth_validations_1 = require("./auth.validations");
6
+ const nationalIdRegex = /^[A-Z0-9]{5,20}$/i;
7
+ const jacketIdRegex = /^[A-Z0-9]{5,20}$/i;
8
+ const plateNumberRegex = /^[A-Z0-9]{3,10}$/i;
9
+ exports.upgradeToRiderSchema = zod_1.z.object({
10
+ params: zod_1.z.object({
11
+ userId: zod_1.z.string().uuid("Invalid user ID format"),
12
+ }),
13
+ body: zod_1.z
14
+ .object({
15
+ jacketId: zod_1.z
16
+ .string()
17
+ .regex(jacketIdRegex, "Jacket ID must be alphanumeric, 5-20 characters")
18
+ .min(5, "Jacket ID must be at least 5 characters")
19
+ .max(20, "Jacket ID cannot exceed 20 characters"),
20
+ nationalId: zod_1.z
21
+ .string()
22
+ .regex(nationalIdRegex, "National ID must be alphanumeric, 5-20 characters")
23
+ .min(5, "National ID must be at least 5 characters")
24
+ .max(20, "National ID cannot exceed 20 characters"),
25
+ phoneNumber: zod_1.z
26
+ .string()
27
+ .regex(auth_validations_1.phoneRegex, "Invalid phone number format. Use format: +250788123456")
28
+ .refine((phone) => phone === phone, "Phone number verification required"),
29
+ plateNumber: zod_1.z
30
+ .string()
31
+ .regex(plateNumberRegex, "Plate number must be alphanumeric, 3-10 characters")
32
+ .min(3, "Plate number must be at least 3 characters")
33
+ .max(10, "Plate number cannot exceed 10 characters")
34
+ .optional(),
35
+ })
36
+ .refine((data) => data.phoneNumber, {
37
+ message: "Phone number is required",
38
+ path: ["phoneNumber"],
39
+ }),
40
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vr-commons",
3
- "version": "1.0.73",
3
+ "version": "1.0.74",
4
4
  "description": "Shared functions package",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",