vr-commons 1.0.89 → 1.0.90
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.
|
@@ -10,4 +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, strongPasswordRegex, changePasswordSchema, } from "./account.validations";
|
|
13
|
-
export { updateAdminSchema, updateRiderSchema, deleteUserSchema, getUserSchema, getUsersSchema, hireAdminSchema, promoteAdminSchema, demoteAdminSchema, fireEmployeeSchema, upgradeToRiderSchema, resetPasswordSchema,
|
|
13
|
+
export { updateAdminSchema, updateRiderSchema, deleteUserSchema, getUserSchema, getUsersSchema, hireAdminSchema, promoteAdminSchema, demoteAdminSchema, fireEmployeeSchema, upgradeToRiderSchema, resetPasswordSchema, } from "./users.admin.validations";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.deleteAccountSchema = 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.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.
|
|
4
|
+
exports.resetPasswordSchema = exports.upgradeToRiderSchema = exports.fireEmployeeSchema = exports.demoteAdminSchema = exports.promoteAdminSchema = exports.hireAdminSchema = exports.getUsersSchema = exports.getUserSchema = exports.deleteUserSchema = exports.updateRiderSchema = exports.updateAdminSchema = exports.changePasswordSchema = exports.strongPasswordRegex = 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");
|
|
@@ -83,4 +83,3 @@ Object.defineProperty(exports, "demoteAdminSchema", { enumerable: true, get: fun
|
|
|
83
83
|
Object.defineProperty(exports, "fireEmployeeSchema", { enumerable: true, get: function () { return users_admin_validations_1.fireEmployeeSchema; } });
|
|
84
84
|
Object.defineProperty(exports, "upgradeToRiderSchema", { enumerable: true, get: function () { return users_admin_validations_1.upgradeToRiderSchema; } });
|
|
85
85
|
Object.defineProperty(exports, "resetPasswordSchema", { enumerable: true, get: function () { return users_admin_validations_1.resetPasswordSchema; } });
|
|
86
|
-
Object.defineProperty(exports, "bulkResetPasswordSchema", { enumerable: true, get: function () { return users_admin_validations_1.bulkResetPasswordSchema; } });
|
|
@@ -191,27 +191,46 @@ export declare const getUsersSchema: z.ZodObject<{
|
|
|
191
191
|
};
|
|
192
192
|
}>;
|
|
193
193
|
export declare const hireAdminSchema: z.ZodObject<{
|
|
194
|
-
body: z.ZodObject<{
|
|
194
|
+
body: z.ZodEffects<z.ZodObject<{
|
|
195
195
|
email: z.ZodString;
|
|
196
196
|
firstName: z.ZodString;
|
|
197
197
|
lastName: z.ZodString;
|
|
198
198
|
phoneNumber: z.ZodString;
|
|
199
199
|
password: z.ZodString;
|
|
200
|
-
role: z.ZodEnum<["AGENT", "ADMIN"]>;
|
|
200
|
+
role: z.ZodEnum<["AGENT", "ADMIN", "SUPER_ADMIN"]>;
|
|
201
|
+
superAdminPassword: z.ZodOptional<z.ZodString>;
|
|
201
202
|
}, "strip", z.ZodTypeAny, {
|
|
202
203
|
phoneNumber: string;
|
|
203
204
|
firstName: string;
|
|
204
205
|
lastName: string;
|
|
205
206
|
email: string;
|
|
206
|
-
role: "AGENT" | "ADMIN";
|
|
207
|
+
role: "AGENT" | "ADMIN" | "SUPER_ADMIN";
|
|
208
|
+
password: string;
|
|
209
|
+
superAdminPassword?: string | undefined;
|
|
210
|
+
}, {
|
|
211
|
+
phoneNumber: string;
|
|
212
|
+
firstName: string;
|
|
213
|
+
lastName: string;
|
|
214
|
+
email: string;
|
|
215
|
+
role: "AGENT" | "ADMIN" | "SUPER_ADMIN";
|
|
216
|
+
password: string;
|
|
217
|
+
superAdminPassword?: string | undefined;
|
|
218
|
+
}>, {
|
|
219
|
+
phoneNumber: string;
|
|
220
|
+
firstName: string;
|
|
221
|
+
lastName: string;
|
|
222
|
+
email: string;
|
|
223
|
+
role: "AGENT" | "ADMIN" | "SUPER_ADMIN";
|
|
207
224
|
password: string;
|
|
225
|
+
superAdminPassword?: string | undefined;
|
|
208
226
|
}, {
|
|
209
227
|
phoneNumber: string;
|
|
210
228
|
firstName: string;
|
|
211
229
|
lastName: string;
|
|
212
230
|
email: string;
|
|
213
|
-
role: "AGENT" | "ADMIN";
|
|
231
|
+
role: "AGENT" | "ADMIN" | "SUPER_ADMIN";
|
|
214
232
|
password: string;
|
|
233
|
+
superAdminPassword?: string | undefined;
|
|
215
234
|
}>;
|
|
216
235
|
}, "strip", z.ZodTypeAny, {
|
|
217
236
|
body: {
|
|
@@ -219,8 +238,9 @@ export declare const hireAdminSchema: z.ZodObject<{
|
|
|
219
238
|
firstName: string;
|
|
220
239
|
lastName: string;
|
|
221
240
|
email: string;
|
|
222
|
-
role: "AGENT" | "ADMIN";
|
|
241
|
+
role: "AGENT" | "ADMIN" | "SUPER_ADMIN";
|
|
223
242
|
password: string;
|
|
243
|
+
superAdminPassword?: string | undefined;
|
|
224
244
|
};
|
|
225
245
|
}, {
|
|
226
246
|
body: {
|
|
@@ -228,8 +248,9 @@ export declare const hireAdminSchema: z.ZodObject<{
|
|
|
228
248
|
firstName: string;
|
|
229
249
|
lastName: string;
|
|
230
250
|
email: string;
|
|
231
|
-
role: "AGENT" | "ADMIN";
|
|
251
|
+
role: "AGENT" | "ADMIN" | "SUPER_ADMIN";
|
|
232
252
|
password: string;
|
|
253
|
+
superAdminPassword?: string | undefined;
|
|
233
254
|
};
|
|
234
255
|
}>;
|
|
235
256
|
export declare const promoteAdminSchema: z.ZodObject<{
|
|
@@ -384,4 +405,3 @@ export declare const resetPasswordSchema: z.ZodObject<{
|
|
|
384
405
|
userId: string;
|
|
385
406
|
};
|
|
386
407
|
}>;
|
|
387
|
-
export declare const bulkResetPasswordSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.resetPasswordSchema = exports.updateAdminSchema = exports.fireEmployeeSchema = exports.demoteAdminSchema = exports.promoteAdminSchema = exports.hireAdminSchema = exports.getUsersSchema = exports.getUserSchema = exports.deleteUserSchema = exports.updateRiderSchema = exports.upgradeToRiderSchema = void 0;
|
|
4
4
|
// src/validations/users.validations.ts
|
|
5
5
|
const zod_1 = require("zod");
|
|
6
6
|
const auth_validations_1 = require("./auth.validations");
|
|
7
|
+
const profiles_validations_1 = require("./profiles.validations");
|
|
7
8
|
// Operations Schemas
|
|
8
9
|
exports.upgradeToRiderSchema = zod_1.z.object({
|
|
9
10
|
params: zod_1.z.object({
|
|
10
11
|
userId: zod_1.z.string().uuid("Invalid user ID format"),
|
|
11
12
|
}),
|
|
12
13
|
body: zod_1.z.object({
|
|
13
|
-
jacketId: zod_1.z.string().
|
|
14
|
+
jacketId: zod_1.z.string().regex(profiles_validations_1.jacketIdRegex, "invalid jacke id"),
|
|
14
15
|
nationalId: zod_1.z.string().min(5).max(20),
|
|
15
16
|
phoneNumber: zod_1.z.string().regex(auth_validations_1.phoneRegex, "Invalid phone number format"),
|
|
16
17
|
plateNumber: zod_1.z.string().min(3).max(10).optional(),
|
|
@@ -54,13 +55,25 @@ exports.getUsersSchema = zod_1.z.object({
|
|
|
54
55
|
});
|
|
55
56
|
// Management Schemas
|
|
56
57
|
exports.hireAdminSchema = zod_1.z.object({
|
|
57
|
-
body: zod_1.z
|
|
58
|
+
body: zod_1.z
|
|
59
|
+
.object({
|
|
58
60
|
email: zod_1.z.string().email(),
|
|
59
61
|
firstName: zod_1.z.string().min(2).max(100),
|
|
60
62
|
lastName: zod_1.z.string().min(2).max(100),
|
|
61
63
|
phoneNumber: zod_1.z.string().regex(auth_validations_1.phoneRegex),
|
|
62
64
|
password: zod_1.z.string().min(6),
|
|
63
|
-
role: zod_1.z.enum(["AGENT", "ADMIN"]),
|
|
65
|
+
role: zod_1.z.enum(["AGENT", "ADMIN", "SUPER_ADMIN"]),
|
|
66
|
+
superAdminPassword: zod_1.z.string().optional(),
|
|
67
|
+
})
|
|
68
|
+
.refine((data) => {
|
|
69
|
+
// If hiring SUPER_ADMIN, superAdminPassword is required
|
|
70
|
+
if (data.role === "SUPER_ADMIN" && !data.superAdminPassword) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
return true;
|
|
74
|
+
}, {
|
|
75
|
+
message: "superAdminPassword is required when hiring SUPER_ADMIN",
|
|
76
|
+
path: ["superAdminPassword"],
|
|
64
77
|
}),
|
|
65
78
|
});
|
|
66
79
|
exports.promoteAdminSchema = zod_1.z.object({
|
|
@@ -103,4 +116,3 @@ exports.resetPasswordSchema = zod_1.z.object({
|
|
|
103
116
|
userId: zod_1.z.string().uuid("Invalid user ID format"),
|
|
104
117
|
}),
|
|
105
118
|
});
|
|
106
|
-
exports.bulkResetPasswordSchema = zod_1.z.object({});
|