vr-commons 1.0.88 → 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,5 +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 { upgradeToRiderSchema } from "./
|
|
14
|
-
export { updateUserSchema, getUserSchema, deleteUserSchema, getUsersSchema, } from "./users.operation.validations";
|
|
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");
|
|
@@ -71,10 +71,15 @@ Object.defineProperty(exports, "verifyPhoneChangeSchema", { enumerable: true, ge
|
|
|
71
71
|
Object.defineProperty(exports, "deleteAccountSchema", { enumerable: true, get: function () { return account_validations_1.deleteAccountSchema; } });
|
|
72
72
|
Object.defineProperty(exports, "strongPasswordRegex", { enumerable: true, get: function () { return account_validations_1.strongPasswordRegex; } });
|
|
73
73
|
Object.defineProperty(exports, "changePasswordSchema", { enumerable: true, get: function () { return account_validations_1.changePasswordSchema; } });
|
|
74
|
-
var
|
|
75
|
-
Object.defineProperty(exports, "
|
|
76
|
-
|
|
77
|
-
Object.defineProperty(exports, "
|
|
78
|
-
Object.defineProperty(exports, "getUserSchema", { enumerable: true, get: function () { return
|
|
79
|
-
Object.defineProperty(exports, "
|
|
80
|
-
Object.defineProperty(exports, "
|
|
74
|
+
var users_admin_validations_1 = require("./users.admin.validations");
|
|
75
|
+
Object.defineProperty(exports, "updateAdminSchema", { enumerable: true, get: function () { return users_admin_validations_1.updateAdminSchema; } });
|
|
76
|
+
Object.defineProperty(exports, "updateRiderSchema", { enumerable: true, get: function () { return users_admin_validations_1.updateRiderSchema; } });
|
|
77
|
+
Object.defineProperty(exports, "deleteUserSchema", { enumerable: true, get: function () { return users_admin_validations_1.deleteUserSchema; } });
|
|
78
|
+
Object.defineProperty(exports, "getUserSchema", { enumerable: true, get: function () { return users_admin_validations_1.getUserSchema; } });
|
|
79
|
+
Object.defineProperty(exports, "getUsersSchema", { enumerable: true, get: function () { return users_admin_validations_1.getUsersSchema; } });
|
|
80
|
+
Object.defineProperty(exports, "hireAdminSchema", { enumerable: true, get: function () { return users_admin_validations_1.hireAdminSchema; } });
|
|
81
|
+
Object.defineProperty(exports, "promoteAdminSchema", { enumerable: true, get: function () { return users_admin_validations_1.promoteAdminSchema; } });
|
|
82
|
+
Object.defineProperty(exports, "demoteAdminSchema", { enumerable: true, get: function () { return users_admin_validations_1.demoteAdminSchema; } });
|
|
83
|
+
Object.defineProperty(exports, "fireEmployeeSchema", { enumerable: true, get: function () { return users_admin_validations_1.fireEmployeeSchema; } });
|
|
84
|
+
Object.defineProperty(exports, "upgradeToRiderSchema", { enumerable: true, get: function () { return users_admin_validations_1.upgradeToRiderSchema; } });
|
|
85
|
+
Object.defineProperty(exports, "resetPasswordSchema", { enumerable: true, get: function () { return users_admin_validations_1.resetPasswordSchema; } });
|
|
@@ -0,0 +1,407 @@
|
|
|
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.ZodObject<{
|
|
11
|
+
jacketId: z.ZodString;
|
|
12
|
+
nationalId: z.ZodString;
|
|
13
|
+
phoneNumber: z.ZodString;
|
|
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
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
params: {
|
|
28
|
+
userId: string;
|
|
29
|
+
};
|
|
30
|
+
body: {
|
|
31
|
+
jacketId: string;
|
|
32
|
+
nationalId: string;
|
|
33
|
+
phoneNumber: string;
|
|
34
|
+
plateNumber?: string | undefined;
|
|
35
|
+
};
|
|
36
|
+
}, {
|
|
37
|
+
params: {
|
|
38
|
+
userId: string;
|
|
39
|
+
};
|
|
40
|
+
body: {
|
|
41
|
+
jacketId: string;
|
|
42
|
+
nationalId: string;
|
|
43
|
+
phoneNumber: string;
|
|
44
|
+
plateNumber?: string | undefined;
|
|
45
|
+
};
|
|
46
|
+
}>;
|
|
47
|
+
export declare const updateRiderSchema: z.ZodObject<{
|
|
48
|
+
params: z.ZodObject<{
|
|
49
|
+
userId: z.ZodString;
|
|
50
|
+
}, "strip", z.ZodTypeAny, {
|
|
51
|
+
userId: string;
|
|
52
|
+
}, {
|
|
53
|
+
userId: string;
|
|
54
|
+
}>;
|
|
55
|
+
body: z.ZodObject<{
|
|
56
|
+
firstName: z.ZodOptional<z.ZodString>;
|
|
57
|
+
lastName: z.ZodOptional<z.ZodString>;
|
|
58
|
+
phoneNumber: z.ZodOptional<z.ZodString>;
|
|
59
|
+
jacketId: z.ZodOptional<z.ZodString>;
|
|
60
|
+
plateNumber: z.ZodOptional<z.ZodString>;
|
|
61
|
+
nationalId: z.ZodOptional<z.ZodString>;
|
|
62
|
+
email: z.ZodOptional<z.ZodString>;
|
|
63
|
+
}, "strip", z.ZodTypeAny, {
|
|
64
|
+
jacketId?: string | undefined;
|
|
65
|
+
nationalId?: string | undefined;
|
|
66
|
+
phoneNumber?: string | undefined;
|
|
67
|
+
plateNumber?: string | undefined;
|
|
68
|
+
firstName?: string | undefined;
|
|
69
|
+
lastName?: string | undefined;
|
|
70
|
+
email?: string | undefined;
|
|
71
|
+
}, {
|
|
72
|
+
jacketId?: string | undefined;
|
|
73
|
+
nationalId?: string | undefined;
|
|
74
|
+
phoneNumber?: string | undefined;
|
|
75
|
+
plateNumber?: string | undefined;
|
|
76
|
+
firstName?: string | undefined;
|
|
77
|
+
lastName?: string | undefined;
|
|
78
|
+
email?: string | undefined;
|
|
79
|
+
}>;
|
|
80
|
+
}, "strip", z.ZodTypeAny, {
|
|
81
|
+
params: {
|
|
82
|
+
userId: string;
|
|
83
|
+
};
|
|
84
|
+
body: {
|
|
85
|
+
jacketId?: string | undefined;
|
|
86
|
+
nationalId?: string | undefined;
|
|
87
|
+
phoneNumber?: string | undefined;
|
|
88
|
+
plateNumber?: string | undefined;
|
|
89
|
+
firstName?: string | undefined;
|
|
90
|
+
lastName?: string | undefined;
|
|
91
|
+
email?: string | undefined;
|
|
92
|
+
};
|
|
93
|
+
}, {
|
|
94
|
+
params: {
|
|
95
|
+
userId: string;
|
|
96
|
+
};
|
|
97
|
+
body: {
|
|
98
|
+
jacketId?: string | undefined;
|
|
99
|
+
nationalId?: string | undefined;
|
|
100
|
+
phoneNumber?: string | undefined;
|
|
101
|
+
plateNumber?: string | undefined;
|
|
102
|
+
firstName?: string | undefined;
|
|
103
|
+
lastName?: string | undefined;
|
|
104
|
+
email?: string | undefined;
|
|
105
|
+
};
|
|
106
|
+
}>;
|
|
107
|
+
export declare const deleteUserSchema: z.ZodObject<{
|
|
108
|
+
params: z.ZodObject<{
|
|
109
|
+
userId: z.ZodString;
|
|
110
|
+
}, "strip", z.ZodTypeAny, {
|
|
111
|
+
userId: string;
|
|
112
|
+
}, {
|
|
113
|
+
userId: string;
|
|
114
|
+
}>;
|
|
115
|
+
}, "strip", z.ZodTypeAny, {
|
|
116
|
+
params: {
|
|
117
|
+
userId: string;
|
|
118
|
+
};
|
|
119
|
+
}, {
|
|
120
|
+
params: {
|
|
121
|
+
userId: string;
|
|
122
|
+
};
|
|
123
|
+
}>;
|
|
124
|
+
export declare const getUserSchema: z.ZodObject<{
|
|
125
|
+
params: z.ZodObject<{
|
|
126
|
+
userId: z.ZodString;
|
|
127
|
+
}, "strip", z.ZodTypeAny, {
|
|
128
|
+
userId: string;
|
|
129
|
+
}, {
|
|
130
|
+
userId: string;
|
|
131
|
+
}>;
|
|
132
|
+
}, "strip", z.ZodTypeAny, {
|
|
133
|
+
params: {
|
|
134
|
+
userId: string;
|
|
135
|
+
};
|
|
136
|
+
}, {
|
|
137
|
+
params: {
|
|
138
|
+
userId: string;
|
|
139
|
+
};
|
|
140
|
+
}>;
|
|
141
|
+
export declare const getUsersSchema: z.ZodObject<{
|
|
142
|
+
query: z.ZodObject<{
|
|
143
|
+
page: z.ZodOptional<z.ZodEffects<z.ZodString, number, string>>;
|
|
144
|
+
limit: z.ZodOptional<z.ZodEffects<z.ZodString, number, string>>;
|
|
145
|
+
search: z.ZodOptional<z.ZodString>;
|
|
146
|
+
isActive: z.ZodOptional<z.ZodEnum<["true", "false"]>>;
|
|
147
|
+
isDeactivated: z.ZodOptional<z.ZodEnum<["true", "false"]>>;
|
|
148
|
+
role: z.ZodOptional<z.ZodString>;
|
|
149
|
+
sortBy: z.ZodOptional<z.ZodEnum<["createdAt", "firstName", "lastName"]>>;
|
|
150
|
+
sortOrder: z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>;
|
|
151
|
+
}, "strip", z.ZodTypeAny, {
|
|
152
|
+
page?: number | undefined;
|
|
153
|
+
limit?: number | undefined;
|
|
154
|
+
search?: string | undefined;
|
|
155
|
+
isActive?: "true" | "false" | undefined;
|
|
156
|
+
isDeactivated?: "true" | "false" | undefined;
|
|
157
|
+
role?: string | undefined;
|
|
158
|
+
sortBy?: "firstName" | "lastName" | "createdAt" | undefined;
|
|
159
|
+
sortOrder?: "ASC" | "DESC" | undefined;
|
|
160
|
+
}, {
|
|
161
|
+
page?: string | undefined;
|
|
162
|
+
limit?: string | undefined;
|
|
163
|
+
search?: string | undefined;
|
|
164
|
+
isActive?: "true" | "false" | undefined;
|
|
165
|
+
isDeactivated?: "true" | "false" | undefined;
|
|
166
|
+
role?: string | undefined;
|
|
167
|
+
sortBy?: "firstName" | "lastName" | "createdAt" | undefined;
|
|
168
|
+
sortOrder?: "ASC" | "DESC" | undefined;
|
|
169
|
+
}>;
|
|
170
|
+
}, "strip", z.ZodTypeAny, {
|
|
171
|
+
query: {
|
|
172
|
+
page?: number | undefined;
|
|
173
|
+
limit?: number | undefined;
|
|
174
|
+
search?: string | undefined;
|
|
175
|
+
isActive?: "true" | "false" | undefined;
|
|
176
|
+
isDeactivated?: "true" | "false" | undefined;
|
|
177
|
+
role?: string | undefined;
|
|
178
|
+
sortBy?: "firstName" | "lastName" | "createdAt" | undefined;
|
|
179
|
+
sortOrder?: "ASC" | "DESC" | undefined;
|
|
180
|
+
};
|
|
181
|
+
}, {
|
|
182
|
+
query: {
|
|
183
|
+
page?: string | undefined;
|
|
184
|
+
limit?: string | undefined;
|
|
185
|
+
search?: string | undefined;
|
|
186
|
+
isActive?: "true" | "false" | undefined;
|
|
187
|
+
isDeactivated?: "true" | "false" | undefined;
|
|
188
|
+
role?: string | undefined;
|
|
189
|
+
sortBy?: "firstName" | "lastName" | "createdAt" | undefined;
|
|
190
|
+
sortOrder?: "ASC" | "DESC" | undefined;
|
|
191
|
+
};
|
|
192
|
+
}>;
|
|
193
|
+
export declare const hireAdminSchema: z.ZodObject<{
|
|
194
|
+
body: z.ZodEffects<z.ZodObject<{
|
|
195
|
+
email: z.ZodString;
|
|
196
|
+
firstName: z.ZodString;
|
|
197
|
+
lastName: z.ZodString;
|
|
198
|
+
phoneNumber: z.ZodString;
|
|
199
|
+
password: z.ZodString;
|
|
200
|
+
role: z.ZodEnum<["AGENT", "ADMIN", "SUPER_ADMIN"]>;
|
|
201
|
+
superAdminPassword: z.ZodOptional<z.ZodString>;
|
|
202
|
+
}, "strip", z.ZodTypeAny, {
|
|
203
|
+
phoneNumber: string;
|
|
204
|
+
firstName: string;
|
|
205
|
+
lastName: string;
|
|
206
|
+
email: string;
|
|
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";
|
|
224
|
+
password: string;
|
|
225
|
+
superAdminPassword?: string | undefined;
|
|
226
|
+
}, {
|
|
227
|
+
phoneNumber: string;
|
|
228
|
+
firstName: string;
|
|
229
|
+
lastName: string;
|
|
230
|
+
email: string;
|
|
231
|
+
role: "AGENT" | "ADMIN" | "SUPER_ADMIN";
|
|
232
|
+
password: string;
|
|
233
|
+
superAdminPassword?: string | undefined;
|
|
234
|
+
}>;
|
|
235
|
+
}, "strip", z.ZodTypeAny, {
|
|
236
|
+
body: {
|
|
237
|
+
phoneNumber: string;
|
|
238
|
+
firstName: string;
|
|
239
|
+
lastName: string;
|
|
240
|
+
email: string;
|
|
241
|
+
role: "AGENT" | "ADMIN" | "SUPER_ADMIN";
|
|
242
|
+
password: string;
|
|
243
|
+
superAdminPassword?: string | undefined;
|
|
244
|
+
};
|
|
245
|
+
}, {
|
|
246
|
+
body: {
|
|
247
|
+
phoneNumber: string;
|
|
248
|
+
firstName: string;
|
|
249
|
+
lastName: string;
|
|
250
|
+
email: string;
|
|
251
|
+
role: "AGENT" | "ADMIN" | "SUPER_ADMIN";
|
|
252
|
+
password: string;
|
|
253
|
+
superAdminPassword?: string | undefined;
|
|
254
|
+
};
|
|
255
|
+
}>;
|
|
256
|
+
export declare const promoteAdminSchema: z.ZodObject<{
|
|
257
|
+
params: z.ZodObject<{
|
|
258
|
+
userId: z.ZodString;
|
|
259
|
+
}, "strip", z.ZodTypeAny, {
|
|
260
|
+
userId: string;
|
|
261
|
+
}, {
|
|
262
|
+
userId: string;
|
|
263
|
+
}>;
|
|
264
|
+
body: z.ZodObject<{
|
|
265
|
+
targetRole: z.ZodEnum<["ADMIN", "SUPER_ADMIN"]>;
|
|
266
|
+
password: z.ZodOptional<z.ZodString>;
|
|
267
|
+
}, "strip", z.ZodTypeAny, {
|
|
268
|
+
targetRole: "ADMIN" | "SUPER_ADMIN";
|
|
269
|
+
password?: string | undefined;
|
|
270
|
+
}, {
|
|
271
|
+
targetRole: "ADMIN" | "SUPER_ADMIN";
|
|
272
|
+
password?: string | undefined;
|
|
273
|
+
}>;
|
|
274
|
+
}, "strip", z.ZodTypeAny, {
|
|
275
|
+
params: {
|
|
276
|
+
userId: string;
|
|
277
|
+
};
|
|
278
|
+
body: {
|
|
279
|
+
targetRole: "ADMIN" | "SUPER_ADMIN";
|
|
280
|
+
password?: string | undefined;
|
|
281
|
+
};
|
|
282
|
+
}, {
|
|
283
|
+
params: {
|
|
284
|
+
userId: string;
|
|
285
|
+
};
|
|
286
|
+
body: {
|
|
287
|
+
targetRole: "ADMIN" | "SUPER_ADMIN";
|
|
288
|
+
password?: string | undefined;
|
|
289
|
+
};
|
|
290
|
+
}>;
|
|
291
|
+
export declare const demoteAdminSchema: z.ZodObject<{
|
|
292
|
+
params: z.ZodObject<{
|
|
293
|
+
userId: z.ZodString;
|
|
294
|
+
}, "strip", z.ZodTypeAny, {
|
|
295
|
+
userId: string;
|
|
296
|
+
}, {
|
|
297
|
+
userId: string;
|
|
298
|
+
}>;
|
|
299
|
+
body: z.ZodObject<{
|
|
300
|
+
targetRole: z.ZodEnum<["AGENT", "ADMIN"]>;
|
|
301
|
+
}, "strip", z.ZodTypeAny, {
|
|
302
|
+
targetRole: "AGENT" | "ADMIN";
|
|
303
|
+
}, {
|
|
304
|
+
targetRole: "AGENT" | "ADMIN";
|
|
305
|
+
}>;
|
|
306
|
+
}, "strip", z.ZodTypeAny, {
|
|
307
|
+
params: {
|
|
308
|
+
userId: string;
|
|
309
|
+
};
|
|
310
|
+
body: {
|
|
311
|
+
targetRole: "AGENT" | "ADMIN";
|
|
312
|
+
};
|
|
313
|
+
}, {
|
|
314
|
+
params: {
|
|
315
|
+
userId: string;
|
|
316
|
+
};
|
|
317
|
+
body: {
|
|
318
|
+
targetRole: "AGENT" | "ADMIN";
|
|
319
|
+
};
|
|
320
|
+
}>;
|
|
321
|
+
export declare const fireEmployeeSchema: z.ZodObject<{
|
|
322
|
+
params: z.ZodObject<{
|
|
323
|
+
userId: z.ZodString;
|
|
324
|
+
}, "strip", z.ZodTypeAny, {
|
|
325
|
+
userId: string;
|
|
326
|
+
}, {
|
|
327
|
+
userId: string;
|
|
328
|
+
}>;
|
|
329
|
+
body: z.ZodObject<{
|
|
330
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
331
|
+
}, "strip", z.ZodTypeAny, {
|
|
332
|
+
reason?: string | undefined;
|
|
333
|
+
}, {
|
|
334
|
+
reason?: string | undefined;
|
|
335
|
+
}>;
|
|
336
|
+
}, "strip", z.ZodTypeAny, {
|
|
337
|
+
params: {
|
|
338
|
+
userId: string;
|
|
339
|
+
};
|
|
340
|
+
body: {
|
|
341
|
+
reason?: string | undefined;
|
|
342
|
+
};
|
|
343
|
+
}, {
|
|
344
|
+
params: {
|
|
345
|
+
userId: string;
|
|
346
|
+
};
|
|
347
|
+
body: {
|
|
348
|
+
reason?: string | undefined;
|
|
349
|
+
};
|
|
350
|
+
}>;
|
|
351
|
+
export declare const updateAdminSchema: z.ZodObject<{
|
|
352
|
+
params: z.ZodObject<{
|
|
353
|
+
userId: z.ZodString;
|
|
354
|
+
}, "strip", z.ZodTypeAny, {
|
|
355
|
+
userId: string;
|
|
356
|
+
}, {
|
|
357
|
+
userId: string;
|
|
358
|
+
}>;
|
|
359
|
+
body: z.ZodObject<{
|
|
360
|
+
firstName: z.ZodOptional<z.ZodString>;
|
|
361
|
+
lastName: z.ZodOptional<z.ZodString>;
|
|
362
|
+
email: z.ZodOptional<z.ZodString>;
|
|
363
|
+
}, "strip", z.ZodTypeAny, {
|
|
364
|
+
firstName?: string | undefined;
|
|
365
|
+
lastName?: string | undefined;
|
|
366
|
+
email?: string | undefined;
|
|
367
|
+
}, {
|
|
368
|
+
firstName?: string | undefined;
|
|
369
|
+
lastName?: string | undefined;
|
|
370
|
+
email?: string | undefined;
|
|
371
|
+
}>;
|
|
372
|
+
}, "strip", z.ZodTypeAny, {
|
|
373
|
+
params: {
|
|
374
|
+
userId: string;
|
|
375
|
+
};
|
|
376
|
+
body: {
|
|
377
|
+
firstName?: string | undefined;
|
|
378
|
+
lastName?: string | undefined;
|
|
379
|
+
email?: string | undefined;
|
|
380
|
+
};
|
|
381
|
+
}, {
|
|
382
|
+
params: {
|
|
383
|
+
userId: string;
|
|
384
|
+
};
|
|
385
|
+
body: {
|
|
386
|
+
firstName?: string | undefined;
|
|
387
|
+
lastName?: string | undefined;
|
|
388
|
+
email?: string | undefined;
|
|
389
|
+
};
|
|
390
|
+
}>;
|
|
391
|
+
export declare const resetPasswordSchema: z.ZodObject<{
|
|
392
|
+
params: z.ZodObject<{
|
|
393
|
+
userId: z.ZodString;
|
|
394
|
+
}, "strip", z.ZodTypeAny, {
|
|
395
|
+
userId: string;
|
|
396
|
+
}, {
|
|
397
|
+
userId: string;
|
|
398
|
+
}>;
|
|
399
|
+
}, "strip", z.ZodTypeAny, {
|
|
400
|
+
params: {
|
|
401
|
+
userId: string;
|
|
402
|
+
};
|
|
403
|
+
}, {
|
|
404
|
+
params: {
|
|
405
|
+
userId: string;
|
|
406
|
+
};
|
|
407
|
+
}>;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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
|
+
// src/validations/users.validations.ts
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const auth_validations_1 = require("./auth.validations");
|
|
7
|
+
const profiles_validations_1 = require("./profiles.validations");
|
|
8
|
+
// Operations Schemas
|
|
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.object({
|
|
14
|
+
jacketId: zod_1.z.string().regex(profiles_validations_1.jacketIdRegex, "invalid jacke id"),
|
|
15
|
+
nationalId: zod_1.z.string().min(5).max(20),
|
|
16
|
+
phoneNumber: zod_1.z.string().regex(auth_validations_1.phoneRegex, "Invalid phone number format"),
|
|
17
|
+
plateNumber: zod_1.z.string().min(3).max(10).optional(),
|
|
18
|
+
}),
|
|
19
|
+
});
|
|
20
|
+
exports.updateRiderSchema = zod_1.z.object({
|
|
21
|
+
params: zod_1.z.object({
|
|
22
|
+
userId: zod_1.z.string().uuid("Invalid user ID format"),
|
|
23
|
+
}),
|
|
24
|
+
body: zod_1.z.object({
|
|
25
|
+
firstName: zod_1.z.string().min(2).max(100).optional(),
|
|
26
|
+
lastName: zod_1.z.string().min(2).max(100).optional(),
|
|
27
|
+
phoneNumber: zod_1.z.string().regex(auth_validations_1.phoneRegex).optional(),
|
|
28
|
+
jacketId: zod_1.z.string().min(5).max(20).optional(),
|
|
29
|
+
plateNumber: zod_1.z.string().min(3).max(10).optional(),
|
|
30
|
+
nationalId: zod_1.z.string().min(5).max(20).optional(),
|
|
31
|
+
email: zod_1.z.string().email().optional(),
|
|
32
|
+
}),
|
|
33
|
+
});
|
|
34
|
+
exports.deleteUserSchema = zod_1.z.object({
|
|
35
|
+
params: zod_1.z.object({
|
|
36
|
+
userId: zod_1.z.string().uuid("Invalid user ID format"),
|
|
37
|
+
}),
|
|
38
|
+
});
|
|
39
|
+
exports.getUserSchema = zod_1.z.object({
|
|
40
|
+
params: zod_1.z.object({
|
|
41
|
+
userId: zod_1.z.string().uuid("Invalid user ID format"),
|
|
42
|
+
}),
|
|
43
|
+
});
|
|
44
|
+
exports.getUsersSchema = zod_1.z.object({
|
|
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(),
|
|
48
|
+
search: zod_1.z.string().optional(),
|
|
49
|
+
isActive: zod_1.z.enum(["true", "false"]).optional(),
|
|
50
|
+
isDeactivated: zod_1.z.enum(["true", "false"]).optional(),
|
|
51
|
+
role: zod_1.z.string().optional(),
|
|
52
|
+
sortBy: zod_1.z.enum(["createdAt", "firstName", "lastName"]).optional(),
|
|
53
|
+
sortOrder: zod_1.z.enum(["ASC", "DESC"]).optional(),
|
|
54
|
+
}),
|
|
55
|
+
});
|
|
56
|
+
// Management Schemas
|
|
57
|
+
exports.hireAdminSchema = zod_1.z.object({
|
|
58
|
+
body: zod_1.z
|
|
59
|
+
.object({
|
|
60
|
+
email: zod_1.z.string().email(),
|
|
61
|
+
firstName: zod_1.z.string().min(2).max(100),
|
|
62
|
+
lastName: zod_1.z.string().min(2).max(100),
|
|
63
|
+
phoneNumber: zod_1.z.string().regex(auth_validations_1.phoneRegex),
|
|
64
|
+
password: zod_1.z.string().min(6),
|
|
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"],
|
|
77
|
+
}),
|
|
78
|
+
});
|
|
79
|
+
exports.promoteAdminSchema = zod_1.z.object({
|
|
80
|
+
params: zod_1.z.object({
|
|
81
|
+
userId: zod_1.z.string().uuid("Invalid user ID format"),
|
|
82
|
+
}),
|
|
83
|
+
body: zod_1.z.object({
|
|
84
|
+
targetRole: zod_1.z.enum(["ADMIN", "SUPER_ADMIN"]),
|
|
85
|
+
password: zod_1.z.string().optional(),
|
|
86
|
+
}),
|
|
87
|
+
});
|
|
88
|
+
exports.demoteAdminSchema = zod_1.z.object({
|
|
89
|
+
params: zod_1.z.object({
|
|
90
|
+
userId: zod_1.z.string().uuid("Invalid user ID format"),
|
|
91
|
+
}),
|
|
92
|
+
body: zod_1.z.object({
|
|
93
|
+
targetRole: zod_1.z.enum(["AGENT", "ADMIN"]),
|
|
94
|
+
}),
|
|
95
|
+
});
|
|
96
|
+
exports.fireEmployeeSchema = zod_1.z.object({
|
|
97
|
+
params: zod_1.z.object({
|
|
98
|
+
userId: zod_1.z.string().uuid("Invalid user ID format"),
|
|
99
|
+
}),
|
|
100
|
+
body: zod_1.z.object({
|
|
101
|
+
reason: zod_1.z.string().min(1).optional(),
|
|
102
|
+
}),
|
|
103
|
+
});
|
|
104
|
+
exports.updateAdminSchema = zod_1.z.object({
|
|
105
|
+
params: zod_1.z.object({
|
|
106
|
+
userId: zod_1.z.string().uuid("Invalid user ID format"),
|
|
107
|
+
}),
|
|
108
|
+
body: zod_1.z.object({
|
|
109
|
+
firstName: zod_1.z.string().min(2).max(100).optional(),
|
|
110
|
+
lastName: zod_1.z.string().min(2).max(100).optional(),
|
|
111
|
+
email: zod_1.z.string().email().optional(),
|
|
112
|
+
}),
|
|
113
|
+
});
|
|
114
|
+
exports.resetPasswordSchema = zod_1.z.object({
|
|
115
|
+
params: zod_1.z.object({
|
|
116
|
+
userId: zod_1.z.string().uuid("Invalid user ID format"),
|
|
117
|
+
}),
|
|
118
|
+
});
|