vr-commons 1.0.30 → 1.0.32
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.
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { validate } from "./validate.validations";
|
|
2
2
|
export { riderLoginSchema, forgotPasswordSchema, userLoginSchema, } from "./auth.validations";
|
|
3
|
-
export { createUserSchema, getUserByIdSchema, updateUserProfileSchema, getAllUsersSchema, viewProfileSchema, passengerSignupSchema, updatePassengerProfileSchema,
|
|
3
|
+
export { createUserSchema, getUserByIdSchema, updateUserProfileSchema, getAllUsersSchema, viewProfileSchema, passengerSignupSchema, updatePassengerProfileSchema, updateRiderProfileSchema, createRiderSchema, changePasswordSchema, deactivateAccountSchema, deleteAccountSchema, } from "./profiles.validations";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deleteAccountSchema = exports.deactivateAccountSchema = exports.changePasswordSchema = exports.
|
|
3
|
+
exports.deleteAccountSchema = exports.deactivateAccountSchema = exports.changePasswordSchema = exports.createRiderSchema = exports.updateRiderProfileSchema = exports.updatePassengerProfileSchema = exports.passengerSignupSchema = exports.viewProfileSchema = exports.getAllUsersSchema = exports.updateUserProfileSchema = exports.getUserByIdSchema = exports.createUserSchema = exports.userLoginSchema = exports.forgotPasswordSchema = exports.riderLoginSchema = exports.validate = void 0;
|
|
4
4
|
var validate_validations_1 = require("./validate.validations");
|
|
5
5
|
Object.defineProperty(exports, "validate", { enumerable: true, get: function () { return validate_validations_1.validate; } });
|
|
6
6
|
var auth_validations_1 = require("./auth.validations");
|
|
@@ -19,7 +19,8 @@ Object.defineProperty(exports, "viewProfileSchema", { enumerable: true, get: fun
|
|
|
19
19
|
Object.defineProperty(exports, "passengerSignupSchema", { enumerable: true, get: function () { return profiles_validations_1.passengerSignupSchema; } });
|
|
20
20
|
Object.defineProperty(exports, "updatePassengerProfileSchema", { enumerable: true, get: function () { return profiles_validations_1.updatePassengerProfileSchema; } });
|
|
21
21
|
// Rider Schemas
|
|
22
|
-
Object.defineProperty(exports, "
|
|
22
|
+
Object.defineProperty(exports, "updateRiderProfileSchema", { enumerable: true, get: function () { return profiles_validations_1.updateRiderProfileSchema; } });
|
|
23
|
+
Object.defineProperty(exports, "createRiderSchema", { enumerable: true, get: function () { return profiles_validations_1.createRiderSchema; } });
|
|
23
24
|
// Account Management Schemas
|
|
24
25
|
Object.defineProperty(exports, "changePasswordSchema", { enumerable: true, get: function () { return profiles_validations_1.changePasswordSchema; } });
|
|
25
26
|
Object.defineProperty(exports, "deactivateAccountSchema", { enumerable: true, get: function () { return profiles_validations_1.deactivateAccountSchema; } });
|
|
@@ -368,28 +368,18 @@ export declare const updatePassengerProfileSchema: z.ZodObject<{
|
|
|
368
368
|
body: z.ZodEffects<z.ZodObject<{
|
|
369
369
|
firstName: z.ZodOptional<z.ZodString>;
|
|
370
370
|
lastName: z.ZodOptional<z.ZodString>;
|
|
371
|
-
email: z.ZodUnion<[z.ZodNullable<z.ZodOptional<z.ZodString>>, z.ZodLiteral<"">]>;
|
|
372
|
-
plateNumber: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
373
371
|
}, "strip", z.ZodTypeAny, {
|
|
374
372
|
firstName?: string | undefined;
|
|
375
373
|
lastName?: string | undefined;
|
|
376
|
-
email?: string | null | undefined;
|
|
377
|
-
plateNumber?: string | null | undefined;
|
|
378
374
|
}, {
|
|
379
375
|
firstName?: string | undefined;
|
|
380
376
|
lastName?: string | undefined;
|
|
381
|
-
email?: string | null | undefined;
|
|
382
|
-
plateNumber?: string | null | undefined;
|
|
383
377
|
}>, {
|
|
384
378
|
firstName?: string | undefined;
|
|
385
379
|
lastName?: string | undefined;
|
|
386
|
-
email?: string | null | undefined;
|
|
387
|
-
plateNumber?: string | null | undefined;
|
|
388
380
|
}, {
|
|
389
381
|
firstName?: string | undefined;
|
|
390
382
|
lastName?: string | undefined;
|
|
391
|
-
email?: string | null | undefined;
|
|
392
|
-
plateNumber?: string | null | undefined;
|
|
393
383
|
}>;
|
|
394
384
|
headers: z.ZodObject<{
|
|
395
385
|
authorization: z.ZodString;
|
|
@@ -402,8 +392,6 @@ export declare const updatePassengerProfileSchema: z.ZodObject<{
|
|
|
402
392
|
body: {
|
|
403
393
|
firstName?: string | undefined;
|
|
404
394
|
lastName?: string | undefined;
|
|
405
|
-
email?: string | null | undefined;
|
|
406
|
-
plateNumber?: string | null | undefined;
|
|
407
395
|
};
|
|
408
396
|
headers: {
|
|
409
397
|
authorization: string;
|
|
@@ -413,37 +401,62 @@ export declare const updatePassengerProfileSchema: z.ZodObject<{
|
|
|
413
401
|
body: {
|
|
414
402
|
firstName?: string | undefined;
|
|
415
403
|
lastName?: string | undefined;
|
|
416
|
-
email?: string | null | undefined;
|
|
417
|
-
plateNumber?: string | null | undefined;
|
|
418
404
|
};
|
|
419
405
|
headers: {
|
|
420
406
|
authorization: string;
|
|
421
407
|
};
|
|
422
408
|
params?: {} | undefined;
|
|
423
409
|
}>;
|
|
424
|
-
export declare const
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
410
|
+
export declare const createRiderSchema: z.ZodObject<{
|
|
411
|
+
body: z.ZodObject<{
|
|
412
|
+
firstName: z.ZodString;
|
|
413
|
+
lastName: z.ZodString;
|
|
414
|
+
phoneNumber: z.ZodString;
|
|
415
|
+
nationalId: z.ZodString;
|
|
416
|
+
email: z.ZodUnion<[z.ZodNullable<z.ZodOptional<z.ZodString>>, z.ZodLiteral<"">]>;
|
|
417
|
+
password: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
418
|
+
plateNumber: z.ZodString;
|
|
430
419
|
}, "strip", z.ZodTypeAny, {
|
|
431
|
-
|
|
420
|
+
firstName: string;
|
|
421
|
+
lastName: string;
|
|
422
|
+
phoneNumber: string;
|
|
423
|
+
plateNumber: string;
|
|
424
|
+
nationalId: string;
|
|
425
|
+
email?: string | null | undefined;
|
|
426
|
+
password?: string | null | undefined;
|
|
432
427
|
}, {
|
|
433
|
-
|
|
428
|
+
firstName: string;
|
|
429
|
+
lastName: string;
|
|
430
|
+
phoneNumber: string;
|
|
431
|
+
plateNumber: string;
|
|
432
|
+
nationalId: string;
|
|
433
|
+
email?: string | null | undefined;
|
|
434
|
+
password?: string | null | undefined;
|
|
434
435
|
}>;
|
|
436
|
+
params: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
|
|
437
|
+
query: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
|
|
435
438
|
}, "strip", z.ZodTypeAny, {
|
|
436
|
-
|
|
437
|
-
|
|
439
|
+
body: {
|
|
440
|
+
firstName: string;
|
|
441
|
+
lastName: string;
|
|
442
|
+
phoneNumber: string;
|
|
443
|
+
plateNumber: string;
|
|
444
|
+
nationalId: string;
|
|
445
|
+
email?: string | null | undefined;
|
|
446
|
+
password?: string | null | undefined;
|
|
438
447
|
};
|
|
439
|
-
body?: {} | undefined;
|
|
440
448
|
query?: {} | undefined;
|
|
441
449
|
params?: {} | undefined;
|
|
442
450
|
}, {
|
|
443
|
-
|
|
444
|
-
|
|
451
|
+
body: {
|
|
452
|
+
firstName: string;
|
|
453
|
+
lastName: string;
|
|
454
|
+
phoneNumber: string;
|
|
455
|
+
plateNumber: string;
|
|
456
|
+
nationalId: string;
|
|
457
|
+
email?: string | null | undefined;
|
|
458
|
+
password?: string | null | undefined;
|
|
445
459
|
};
|
|
446
|
-
body?: {} | undefined;
|
|
447
460
|
query?: {} | undefined;
|
|
448
461
|
params?: {} | undefined;
|
|
449
462
|
}>;
|
|
@@ -561,6 +574,77 @@ export declare const deleteAccountSchema: z.ZodObject<{
|
|
|
561
574
|
};
|
|
562
575
|
params?: {} | undefined;
|
|
563
576
|
}>;
|
|
577
|
+
export declare const updateRiderProfileSchema: z.ZodObject<{
|
|
578
|
+
params: z.ZodObject<{
|
|
579
|
+
riderId: z.ZodString;
|
|
580
|
+
}, "strip", z.ZodTypeAny, {
|
|
581
|
+
riderId: string;
|
|
582
|
+
}, {
|
|
583
|
+
riderId: string;
|
|
584
|
+
}>;
|
|
585
|
+
body: z.ZodEffects<z.ZodObject<{
|
|
586
|
+
firstName: z.ZodOptional<z.ZodString>;
|
|
587
|
+
lastName: z.ZodOptional<z.ZodString>;
|
|
588
|
+
email: z.ZodUnion<[z.ZodNullable<z.ZodOptional<z.ZodString>>, z.ZodLiteral<"">]>;
|
|
589
|
+
plateNumber: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
590
|
+
}, "strip", z.ZodTypeAny, {
|
|
591
|
+
firstName?: string | undefined;
|
|
592
|
+
lastName?: string | undefined;
|
|
593
|
+
email?: string | null | undefined;
|
|
594
|
+
plateNumber?: string | null | undefined;
|
|
595
|
+
}, {
|
|
596
|
+
firstName?: string | undefined;
|
|
597
|
+
lastName?: string | undefined;
|
|
598
|
+
email?: string | null | undefined;
|
|
599
|
+
plateNumber?: string | null | undefined;
|
|
600
|
+
}>, {
|
|
601
|
+
firstName?: string | undefined;
|
|
602
|
+
lastName?: string | undefined;
|
|
603
|
+
email?: string | null | undefined;
|
|
604
|
+
plateNumber?: string | null | undefined;
|
|
605
|
+
}, {
|
|
606
|
+
firstName?: string | undefined;
|
|
607
|
+
lastName?: string | undefined;
|
|
608
|
+
email?: string | null | undefined;
|
|
609
|
+
plateNumber?: string | null | undefined;
|
|
610
|
+
}>;
|
|
611
|
+
query: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
|
|
612
|
+
headers: z.ZodObject<{
|
|
613
|
+
authorization: z.ZodString;
|
|
614
|
+
}, "strip", z.ZodTypeAny, {
|
|
615
|
+
authorization: string;
|
|
616
|
+
}, {
|
|
617
|
+
authorization: string;
|
|
618
|
+
}>;
|
|
619
|
+
}, "strip", z.ZodTypeAny, {
|
|
620
|
+
body: {
|
|
621
|
+
firstName?: string | undefined;
|
|
622
|
+
lastName?: string | undefined;
|
|
623
|
+
email?: string | null | undefined;
|
|
624
|
+
plateNumber?: string | null | undefined;
|
|
625
|
+
};
|
|
626
|
+
params: {
|
|
627
|
+
riderId: string;
|
|
628
|
+
};
|
|
629
|
+
headers: {
|
|
630
|
+
authorization: string;
|
|
631
|
+
};
|
|
632
|
+
query?: {} | undefined;
|
|
633
|
+
}, {
|
|
634
|
+
body: {
|
|
635
|
+
firstName?: string | undefined;
|
|
636
|
+
lastName?: string | undefined;
|
|
637
|
+
email?: string | null | undefined;
|
|
638
|
+
plateNumber?: string | null | undefined;
|
|
639
|
+
};
|
|
640
|
+
params: {
|
|
641
|
+
riderId: string;
|
|
642
|
+
};
|
|
643
|
+
headers: {
|
|
644
|
+
authorization: string;
|
|
645
|
+
};
|
|
646
|
+
query?: {} | undefined;
|
|
647
|
+
}>;
|
|
564
648
|
export type CreateUserInput = z.infer<typeof createUserSchema>;
|
|
565
649
|
export type GetUserByIdInput = z.infer<typeof getUserByIdSchema>;
|
|
566
650
|
export type UpdateUserProfileInput = z.infer<typeof updateUserProfileSchema>;
|
|
@@ -568,7 +652,8 @@ export type GetAllUsersInput = z.infer<typeof getAllUsersSchema>;
|
|
|
568
652
|
export type ViewProfileInput = z.infer<typeof viewProfileSchema>;
|
|
569
653
|
export type PassengerSignupInput = z.infer<typeof passengerSignupSchema>;
|
|
570
654
|
export type UpdatePassengerProfileInput = z.infer<typeof updatePassengerProfileSchema>;
|
|
571
|
-
export type
|
|
655
|
+
export type CreateRiderInput = z.infer<typeof createRiderSchema>;
|
|
656
|
+
export type UpdateRiderProfileInput = z.infer<typeof updateRiderProfileSchema>;
|
|
572
657
|
export type ChangePasswordInput = z.infer<typeof changePasswordSchema>;
|
|
573
658
|
export type DeactivateAccountInput = z.infer<typeof deactivateAccountSchema>;
|
|
574
659
|
export type DeleteAccountInput = z.infer<typeof deleteAccountSchema>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deleteAccountSchema = exports.deactivateAccountSchema = exports.changePasswordSchema = exports.
|
|
3
|
+
exports.updateRiderProfileSchema = exports.deleteAccountSchema = exports.deactivateAccountSchema = exports.changePasswordSchema = exports.createRiderSchema = exports.updatePassengerProfileSchema = exports.passengerSignupSchema = exports.viewProfileSchema = exports.getAllUsersSchema = exports.updateUserProfileSchema = exports.getUserByIdSchema = exports.createUserSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
// ============================================================================
|
|
6
6
|
// COMMON VALIDATIONS
|
|
@@ -226,17 +226,6 @@ exports.updatePassengerProfileSchema = zod_1.z.object({
|
|
|
226
226
|
.min(2, "Last name must be at least 2 characters")
|
|
227
227
|
.max(100, "Last name cannot exceed 100 characters")
|
|
228
228
|
.optional(),
|
|
229
|
-
email: zod_1.z
|
|
230
|
-
.string()
|
|
231
|
-
.email("Invalid email address")
|
|
232
|
-
.optional()
|
|
233
|
-
.nullable()
|
|
234
|
-
.or(zod_1.z.literal("")),
|
|
235
|
-
plateNumber: zod_1.z
|
|
236
|
-
.string()
|
|
237
|
-
.max(20, "Plate number cannot exceed 20 characters")
|
|
238
|
-
.optional()
|
|
239
|
-
.nullable(),
|
|
240
229
|
})
|
|
241
230
|
.refine((data) => Object.keys(data).length > 0, {
|
|
242
231
|
message: "At least one field must be provided for update",
|
|
@@ -250,16 +239,38 @@ exports.updatePassengerProfileSchema = zod_1.z.object({
|
|
|
250
239
|
// ============================================================================
|
|
251
240
|
// RIDER SCHEMAS
|
|
252
241
|
// ============================================================================
|
|
253
|
-
|
|
254
|
-
|
|
242
|
+
exports.createRiderSchema = zod_1.z.object({
|
|
243
|
+
body: zod_1.z.object({
|
|
244
|
+
firstName: zod_1.z
|
|
245
|
+
.string()
|
|
246
|
+
.min(2, "First name must be at least 2 characters")
|
|
247
|
+
.max(100, "First name cannot exceed 100 characters"),
|
|
248
|
+
lastName: zod_1.z
|
|
249
|
+
.string()
|
|
250
|
+
.min(2, "Last name must be at least 2 characters")
|
|
251
|
+
.max(100, "Last name cannot exceed 100 characters"),
|
|
252
|
+
phoneNumber: zod_1.z
|
|
253
|
+
.string()
|
|
254
|
+
.regex(phoneNumberRegex, "Phone number must be a valid Rwandan number (078/079/072/073) followed by 7 digits"),
|
|
255
|
+
nationalId: zod_1.z
|
|
256
|
+
.string()
|
|
257
|
+
.regex(nationalIdRegex, "National ID must be 16 digits"),
|
|
258
|
+
email: zod_1.z
|
|
259
|
+
.string()
|
|
260
|
+
.email("Invalid email address")
|
|
261
|
+
.optional()
|
|
262
|
+
.nullable()
|
|
263
|
+
.or(zod_1.z.literal("")),
|
|
264
|
+
password: zod_1.z
|
|
265
|
+
.string()
|
|
266
|
+
.min(6, "Password must be at least 6 characters")
|
|
267
|
+
.max(100, "Password cannot exceed 100 characters")
|
|
268
|
+
.optional()
|
|
269
|
+
.nullable(),
|
|
270
|
+
plateNumber: zod_1.z.string().max(20, "Plate number cannot exceed 20 characters"),
|
|
271
|
+
}),
|
|
255
272
|
params: zod_1.z.object({}).optional(),
|
|
256
|
-
body: zod_1.z.object({}).optional(),
|
|
257
273
|
query: zod_1.z.object({}).optional(),
|
|
258
|
-
headers: zod_1.z.object({
|
|
259
|
-
authorization: zod_1.z.string().regex(/^Bearer /, {
|
|
260
|
-
message: "Authorization header must start with 'Bearer '",
|
|
261
|
-
}),
|
|
262
|
-
}),
|
|
263
274
|
});
|
|
264
275
|
// ============================================================================
|
|
265
276
|
// ACCOUNT MANAGEMENT SCHEMAS
|
|
@@ -316,3 +327,42 @@ exports.deleteAccountSchema = zod_1.z.object({
|
|
|
316
327
|
}),
|
|
317
328
|
}),
|
|
318
329
|
});
|
|
330
|
+
// Update Rider Profile Schema
|
|
331
|
+
exports.updateRiderProfileSchema = zod_1.z.object({
|
|
332
|
+
params: zod_1.z.object({
|
|
333
|
+
riderId: zod_1.z.string().uuid("Invalid rider ID format"),
|
|
334
|
+
}),
|
|
335
|
+
body: zod_1.z
|
|
336
|
+
.object({
|
|
337
|
+
firstName: zod_1.z
|
|
338
|
+
.string()
|
|
339
|
+
.min(2, "First name must be at least 2 characters")
|
|
340
|
+
.max(100, "First name cannot exceed 100 characters")
|
|
341
|
+
.optional(),
|
|
342
|
+
lastName: zod_1.z
|
|
343
|
+
.string()
|
|
344
|
+
.min(2, "Last name must be at least 2 characters")
|
|
345
|
+
.max(100, "Last name cannot exceed 100 characters")
|
|
346
|
+
.optional(),
|
|
347
|
+
email: zod_1.z
|
|
348
|
+
.string()
|
|
349
|
+
.email("Invalid email address")
|
|
350
|
+
.optional()
|
|
351
|
+
.nullable()
|
|
352
|
+
.or(zod_1.z.literal("")),
|
|
353
|
+
plateNumber: zod_1.z
|
|
354
|
+
.string()
|
|
355
|
+
.max(20, "Plate number cannot exceed 20 characters")
|
|
356
|
+
.optional()
|
|
357
|
+
.nullable(),
|
|
358
|
+
})
|
|
359
|
+
.refine((data) => Object.keys(data).length > 0, {
|
|
360
|
+
message: "At least one field must be provided for update",
|
|
361
|
+
}),
|
|
362
|
+
query: zod_1.z.object({}).optional(),
|
|
363
|
+
headers: zod_1.z.object({
|
|
364
|
+
authorization: zod_1.z.string().regex(/^Bearer /, {
|
|
365
|
+
message: "Authorization header must start with 'Bearer '",
|
|
366
|
+
}),
|
|
367
|
+
}),
|
|
368
|
+
});
|