vr-commons 1.0.108 → 1.0.110
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.
- package/dist/middlewares/idempotency.middlewares.d.ts +3 -0
- package/dist/middlewares/idempotency.middlewares.js +74 -0
- package/dist/utils/profiles.utils.d.ts +7 -5
- package/dist/utils/profiles.utils.js +13 -22
- package/dist/validations/admin.devicePayment.validations.d.ts +46 -46
- package/dist/validations/admin.devices.validations.d.ts +8 -8
- package/dist/validations/auth.validations.d.ts +4 -4
- package/dist/validations/eventlogs.admin.validations.d.ts +35 -35
- package/dist/validations/product.validations.d.ts +38 -38
- package/dist/validations/profiles.validations.d.ts +374 -83
- package/dist/validations/profiles.validations.js +161 -25
- package/dist/validations/users.admin.validations.d.ts +180 -19
- package/dist/validations/users.admin.validations.js +88 -7
- package/package.json +2 -2
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Request, Response, NextFunction } from "express";
|
|
2
|
+
export declare const idempotencyMiddleware: (req: Request, res: Response, next: NextFunction) => Promise<void | Response<any, Record<string, any>>>;
|
|
3
|
+
export declare const storeIdempotencyResponse: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.storeIdempotencyResponse = exports.idempotencyMiddleware = void 0;
|
|
4
|
+
const vr_models_1 = require("vr-models");
|
|
5
|
+
const response_utils_1 = require("../utils/response.utils");
|
|
6
|
+
const idempotencyMiddleware = async (req, res, next) => {
|
|
7
|
+
// Skip for GET requests
|
|
8
|
+
if (req.method === "GET") {
|
|
9
|
+
return next();
|
|
10
|
+
}
|
|
11
|
+
const idempotencyKey = req.headers["idempotency-key"];
|
|
12
|
+
if (!idempotencyKey) {
|
|
13
|
+
return (0, response_utils_1.sendErrorResponse)(res, "Idempotency-Key header is required", 400);
|
|
14
|
+
}
|
|
15
|
+
// Validate UUID format
|
|
16
|
+
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
17
|
+
if (!uuidRegex.test(idempotencyKey)) {
|
|
18
|
+
return (0, response_utils_1.sendErrorResponse)(res, "Idempotency-Key must be a valid UUID", 400);
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
const existing = await vr_models_1.IdempotencyRecord.findOne({
|
|
22
|
+
where: { key: idempotencyKey },
|
|
23
|
+
});
|
|
24
|
+
if (existing && existing.isValid()) {
|
|
25
|
+
const response = existing.getResponse();
|
|
26
|
+
return res.status(response?.statusCode || 200).json(response?.body);
|
|
27
|
+
}
|
|
28
|
+
if (existing && existing.isExpired()) {
|
|
29
|
+
await vr_models_1.IdempotencyRecord.invalidate(idempotencyKey);
|
|
30
|
+
}
|
|
31
|
+
// Store original response methods
|
|
32
|
+
const originalJson = res.json.bind(res);
|
|
33
|
+
const originalStatus = res.status.bind(res);
|
|
34
|
+
res.json = function (body) {
|
|
35
|
+
res.locals.responseBody = body;
|
|
36
|
+
return originalJson(body);
|
|
37
|
+
};
|
|
38
|
+
res.status = function (code) {
|
|
39
|
+
res.locals.statusCode = code;
|
|
40
|
+
return originalStatus(code);
|
|
41
|
+
};
|
|
42
|
+
req.idempotencyKey = idempotencyKey;
|
|
43
|
+
next();
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
console.error("Idempotency middleware error:", error);
|
|
47
|
+
next(error);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
exports.idempotencyMiddleware = idempotencyMiddleware;
|
|
51
|
+
// Store response after completion
|
|
52
|
+
const storeIdempotencyResponse = async (req, res, next) => {
|
|
53
|
+
if (req.method === "GET" || !req.idempotencyKey) {
|
|
54
|
+
return next();
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
const expiresAt = new Date();
|
|
58
|
+
expiresAt.setHours(expiresAt.getHours() + 24);
|
|
59
|
+
await vr_models_1.IdempotencyRecord.create({
|
|
60
|
+
key: req.idempotencyKey,
|
|
61
|
+
requestMethod: req.method,
|
|
62
|
+
requestPath: req.path,
|
|
63
|
+
requestParams: req.body,
|
|
64
|
+
responseStatusCode: res.locals.statusCode || 200,
|
|
65
|
+
responseBody: res.locals.responseBody || {},
|
|
66
|
+
expiresAt, // Add this
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
console.error("Failed to store idempotency record:", error);
|
|
71
|
+
}
|
|
72
|
+
next();
|
|
73
|
+
};
|
|
74
|
+
exports.storeIdempotencyResponse = storeIdempotencyResponse;
|
|
@@ -13,7 +13,10 @@ export interface BaseUserProfile {
|
|
|
13
13
|
lastName: string;
|
|
14
14
|
primaryPhone: string;
|
|
15
15
|
email: string | null;
|
|
16
|
-
|
|
16
|
+
gender: "male" | "female";
|
|
17
|
+
birthDate: number | null;
|
|
18
|
+
birthMonth: number | null;
|
|
19
|
+
birthYear: number | null;
|
|
17
20
|
isActive: boolean;
|
|
18
21
|
lastLoginAt: Date | null;
|
|
19
22
|
createdAt: Date;
|
|
@@ -65,6 +68,7 @@ export interface UserSearchFilters {
|
|
|
65
68
|
isSuspended?: boolean;
|
|
66
69
|
isBanned?: boolean;
|
|
67
70
|
isDeactivated?: boolean;
|
|
71
|
+
gender?: "male" | "female";
|
|
68
72
|
startDate?: string;
|
|
69
73
|
endDate?: string;
|
|
70
74
|
search?: string;
|
|
@@ -84,7 +88,6 @@ export interface GetUsersResult {
|
|
|
84
88
|
total: number;
|
|
85
89
|
}
|
|
86
90
|
export declare const PHONE_REGEX: RegExp;
|
|
87
|
-
export declare const NATIONAL_ID_REGEX: RegExp;
|
|
88
91
|
export declare const JACKET_ID_REGEX: RegExp;
|
|
89
92
|
export declare const JACKET_ID_PREFIX = "JKT";
|
|
90
93
|
/**
|
|
@@ -156,10 +159,10 @@ export interface ValidationError {
|
|
|
156
159
|
}
|
|
157
160
|
/**
|
|
158
161
|
* Validate unique user fields (phone number is in PhoneContact table)
|
|
162
|
+
* Note: nationalId has been removed
|
|
159
163
|
*/
|
|
160
164
|
export declare const validateUniqueFields: (fields: {
|
|
161
165
|
phoneNumber?: string;
|
|
162
|
-
nationalId?: string;
|
|
163
166
|
email?: string | null;
|
|
164
167
|
jacketId?: string;
|
|
165
168
|
}, excludeUserId?: string) => Promise<ValidationError[]>;
|
|
@@ -172,7 +175,7 @@ export declare const validatePassword: (plainPassword: string, hashedPassword: s
|
|
|
172
175
|
*/
|
|
173
176
|
export declare const hashPassword: (password: string) => Promise<string>;
|
|
174
177
|
/**
|
|
175
|
-
* Soft delete user
|
|
178
|
+
* Soft delete user (updated - no nationalId reference)
|
|
176
179
|
*/
|
|
177
180
|
export declare const softDeleteUser: (userId: string, options?: {
|
|
178
181
|
reason?: string;
|
|
@@ -200,7 +203,6 @@ declare const _default: {
|
|
|
200
203
|
generateJacketId: () => Promise<string>;
|
|
201
204
|
validateUniqueFields: (fields: {
|
|
202
205
|
phoneNumber?: string;
|
|
203
|
-
nationalId?: string;
|
|
204
206
|
email?: string | null;
|
|
205
207
|
jacketId?: string;
|
|
206
208
|
}, excludeUserId?: string) => Promise<ValidationError[]>;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.softDeleteUser = exports.hashPassword = exports.validatePassword = exports.validateUniqueFields = exports.generateJacketId = exports.getSortOrder = exports.generateEventSearchConditions = exports.generateUserSearchConditions = exports.findSecurityClearanceByRole = exports.getUsersByRole = exports.getUserById = exports.isAccountAccessible = exports.canModifyAccount = exports.hasAllPermissions = exports.hasAnyPermission = exports.hasPermission = exports.hasRole = exports.formatUserListResponse = exports.formatUserProfile = exports.JACKET_ID_PREFIX = exports.JACKET_ID_REGEX = exports.
|
|
6
|
+
exports.softDeleteUser = exports.hashPassword = exports.validatePassword = exports.validateUniqueFields = exports.generateJacketId = exports.getSortOrder = exports.generateEventSearchConditions = exports.generateUserSearchConditions = exports.findSecurityClearanceByRole = exports.getUsersByRole = exports.getUserById = exports.isAccountAccessible = exports.canModifyAccount = exports.hasAllPermissions = exports.hasAnyPermission = exports.hasPermission = exports.hasRole = exports.formatUserListResponse = exports.formatUserProfile = exports.JACKET_ID_PREFIX = exports.JACKET_ID_REGEX = exports.PHONE_REGEX = void 0;
|
|
7
7
|
const vr_models_1 = require("vr-models");
|
|
8
8
|
const bcryptjs_1 = __importDefault(require("bcryptjs"));
|
|
9
9
|
const sequelize_1 = require("sequelize");
|
|
@@ -11,7 +11,6 @@ const sequelize_1 = require("sequelize");
|
|
|
11
11
|
// REGEX PATTERNS & CONSTANTS
|
|
12
12
|
// ============================================================================
|
|
13
13
|
exports.PHONE_REGEX = /^(078|079|072|073)\d{7}$/;
|
|
14
|
-
exports.NATIONAL_ID_REGEX = /^\d{16}$/;
|
|
15
14
|
exports.JACKET_ID_REGEX = /^JKT-\d{9}$/;
|
|
16
15
|
exports.JACKET_ID_PREFIX = "JKT";
|
|
17
16
|
// ============================================================================
|
|
@@ -27,7 +26,10 @@ const formatUserProfile = (user, viewerType = "ADMIN", options = {}) => {
|
|
|
27
26
|
lastName: user.lastName,
|
|
28
27
|
primaryPhone: user.primaryPhone?.phoneNumber,
|
|
29
28
|
email: user.email,
|
|
30
|
-
|
|
29
|
+
gender: user.gender || "male",
|
|
30
|
+
birthDate: user.birthDate || null,
|
|
31
|
+
birthMonth: user.birthMonth || null,
|
|
32
|
+
birthYear: user.birthYear || null,
|
|
31
33
|
isActive: user.isActive,
|
|
32
34
|
lastLoginAt: user.lastLoginAt,
|
|
33
35
|
createdAt: user.createdAt,
|
|
@@ -202,6 +204,8 @@ const getUsersByRole = async (role, filters = {}, pagination) => {
|
|
|
202
204
|
where.isSuspended = filters.isSuspended;
|
|
203
205
|
if (filters.isDeactivated !== undefined)
|
|
204
206
|
where.isDeactivated = filters.isDeactivated;
|
|
207
|
+
if (filters.gender !== undefined)
|
|
208
|
+
where.gender = filters.gender;
|
|
205
209
|
if (filters.isBanned !== undefined) {
|
|
206
210
|
if (filters.isBanned) {
|
|
207
211
|
where.bannedAt = { [sequelize_1.Op.ne]: null };
|
|
@@ -227,7 +231,6 @@ const getUsersByRole = async (role, filters = {}, pagination) => {
|
|
|
227
231
|
{ lastName: { [sequelize_1.Op.iLike]: `%${filters.search}%` } },
|
|
228
232
|
{ phoneNumber: { [sequelize_1.Op.iLike]: `%${filters.search}%` } },
|
|
229
233
|
{ email: { [sequelize_1.Op.iLike]: `%${filters.search}%` } },
|
|
230
|
-
{ nationalId: { [sequelize_1.Op.iLike]: `%${filters.search}%` } },
|
|
231
234
|
{ jacketId: { [sequelize_1.Op.iLike]: `%${filters.search}%` } },
|
|
232
235
|
];
|
|
233
236
|
}
|
|
@@ -288,6 +291,9 @@ const generateUserSearchConditions = (filters) => {
|
|
|
288
291
|
if (filters.isSuspended !== undefined) {
|
|
289
292
|
where.isSuspended = filters.isSuspended;
|
|
290
293
|
}
|
|
294
|
+
if (filters.gender !== undefined) {
|
|
295
|
+
where.gender = filters.gender;
|
|
296
|
+
}
|
|
291
297
|
if (filters.isBanned !== undefined) {
|
|
292
298
|
if (filters.isBanned) {
|
|
293
299
|
where.bannedAt = { [sequelize_1.Op.ne]: null };
|
|
@@ -312,7 +318,6 @@ const generateUserSearchConditions = (filters) => {
|
|
|
312
318
|
{ lastName: { [sequelize_1.Op.iLike]: `%${filters.search}%` } },
|
|
313
319
|
{ phoneNumber: { [sequelize_1.Op.iLike]: `%${filters.search}%` } },
|
|
314
320
|
{ email: { [sequelize_1.Op.iLike]: `%${filters.search}%` } },
|
|
315
|
-
{ nationalId: { [sequelize_1.Op.iLike]: `%${filters.search}%` } },
|
|
316
321
|
{ jacketId: { [sequelize_1.Op.iLike]: `%${filters.search}%` } },
|
|
317
322
|
];
|
|
318
323
|
}
|
|
@@ -348,7 +353,7 @@ exports.generateEventSearchConditions = generateEventSearchConditions;
|
|
|
348
353
|
* Get sort order for queries
|
|
349
354
|
*/
|
|
350
355
|
const getSortOrder = (sortBy = "createdAt", order = "desc") => {
|
|
351
|
-
const validSortFields = ["firstName", "lastLoginAt", "createdAt"];
|
|
356
|
+
const validSortFields = ["firstName", "lastLoginAt", "createdAt", "gender"];
|
|
352
357
|
const sortField = validSortFields.includes(sortBy) ? sortBy : "createdAt";
|
|
353
358
|
const sortOrder = order.toLowerCase() === "asc" ? "ASC" : "DESC";
|
|
354
359
|
if (sortField === "firstName") {
|
|
@@ -383,6 +388,7 @@ const generateJacketId = async () => {
|
|
|
383
388
|
exports.generateJacketId = generateJacketId;
|
|
384
389
|
/**
|
|
385
390
|
* Validate unique user fields (phone number is in PhoneContact table)
|
|
391
|
+
* Note: nationalId has been removed
|
|
386
392
|
*/
|
|
387
393
|
const validateUniqueFields = async (fields, excludeUserId) => {
|
|
388
394
|
const errors = [];
|
|
@@ -403,20 +409,6 @@ const validateUniqueFields = async (fields, excludeUserId) => {
|
|
|
403
409
|
});
|
|
404
410
|
}
|
|
405
411
|
}
|
|
406
|
-
// Check nationalId (on User model)
|
|
407
|
-
if (fields.nationalId) {
|
|
408
|
-
const userWhere = { nationalId: fields.nationalId };
|
|
409
|
-
if (excludeUserId) {
|
|
410
|
-
userWhere.id = { [sequelize_1.Op.ne]: excludeUserId };
|
|
411
|
-
}
|
|
412
|
-
const existingUser = await vr_models_1.User.findOne({ where: userWhere });
|
|
413
|
-
if (existingUser) {
|
|
414
|
-
errors.push({
|
|
415
|
-
field: "nationalId",
|
|
416
|
-
message: "National ID already registered",
|
|
417
|
-
});
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
412
|
// Check email (on User model)
|
|
421
413
|
if (fields.email) {
|
|
422
414
|
const userWhere = { email: fields.email };
|
|
@@ -466,7 +458,7 @@ exports.hashPassword = hashPassword;
|
|
|
466
458
|
// ACCOUNT MANAGEMENT FUNCTIONS
|
|
467
459
|
// ============================================================================
|
|
468
460
|
/**
|
|
469
|
-
* Soft delete user
|
|
461
|
+
* Soft delete user (updated - no nationalId reference)
|
|
470
462
|
*/
|
|
471
463
|
const softDeleteUser = async (userId, options) => {
|
|
472
464
|
const updateData = {
|
|
@@ -479,7 +471,6 @@ const softDeleteUser = async (userId, options) => {
|
|
|
479
471
|
updateData.email = null;
|
|
480
472
|
updateData.password = null;
|
|
481
473
|
updateData.phoneNumber = `DELETED_${timestamp}`;
|
|
482
|
-
updateData.nationalId = `DELETED_${timestamp}`;
|
|
483
474
|
updateData.jacketId = `DELETED_${timestamp}`;
|
|
484
475
|
await vr_models_1.User.update(updateData, {
|
|
485
476
|
where: { id: userId },
|
|
@@ -7,28 +7,28 @@ export declare const createPlanSchema: z.ZodObject<{
|
|
|
7
7
|
productId: z.ZodString;
|
|
8
8
|
}, "strip", z.ZodTypeAny, {
|
|
9
9
|
userId: string;
|
|
10
|
+
productId: string;
|
|
10
11
|
deviceIds: string[];
|
|
11
12
|
pricingId: string;
|
|
12
|
-
productId: string;
|
|
13
13
|
}, {
|
|
14
14
|
userId: string;
|
|
15
|
+
productId: string;
|
|
15
16
|
deviceIds: string[];
|
|
16
17
|
pricingId: string;
|
|
17
|
-
productId: string;
|
|
18
18
|
}>;
|
|
19
19
|
}, "strip", z.ZodTypeAny, {
|
|
20
20
|
body: {
|
|
21
21
|
userId: string;
|
|
22
|
+
productId: string;
|
|
22
23
|
deviceIds: string[];
|
|
23
24
|
pricingId: string;
|
|
24
|
-
productId: string;
|
|
25
25
|
};
|
|
26
26
|
}, {
|
|
27
27
|
body: {
|
|
28
28
|
userId: string;
|
|
29
|
+
productId: string;
|
|
29
30
|
deviceIds: string[];
|
|
30
31
|
pricingId: string;
|
|
31
|
-
productId: string;
|
|
32
32
|
};
|
|
33
33
|
}>;
|
|
34
34
|
export declare const listPlansSchema: z.ZodObject<{
|
|
@@ -43,49 +43,49 @@ export declare const listPlansSchema: z.ZodObject<{
|
|
|
43
43
|
sortBy: z.ZodOptional<z.ZodEnum<["createdAt", "updatedAt", "nextInstallmentDueAt", "paidAmount", "outstandingAmount"]>>;
|
|
44
44
|
sortOrder: z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>;
|
|
45
45
|
}, "strip", z.ZodTypeAny, {
|
|
46
|
-
page: number;
|
|
47
46
|
limit: number;
|
|
48
|
-
|
|
47
|
+
page: number;
|
|
48
|
+
search?: string | undefined;
|
|
49
49
|
userId?: string | undefined;
|
|
50
|
+
status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
|
|
51
|
+
sortBy?: "createdAt" | "updatedAt" | "paidAmount" | "outstandingAmount" | "nextInstallmentDueAt" | undefined;
|
|
52
|
+
sortOrder?: "DESC" | "ASC" | undefined;
|
|
50
53
|
deviceId?: string | undefined;
|
|
51
54
|
isOverdue?: "true" | "false" | undefined;
|
|
52
|
-
search?: string | undefined;
|
|
53
|
-
sortBy?: "createdAt" | "updatedAt" | "nextInstallmentDueAt" | "paidAmount" | "outstandingAmount" | undefined;
|
|
54
|
-
sortOrder?: "ASC" | "DESC" | undefined;
|
|
55
55
|
}, {
|
|
56
|
-
|
|
56
|
+
search?: string | undefined;
|
|
57
|
+
limit?: string | undefined;
|
|
57
58
|
userId?: string | undefined;
|
|
59
|
+
status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
|
|
58
60
|
page?: string | undefined;
|
|
59
|
-
|
|
61
|
+
sortBy?: "createdAt" | "updatedAt" | "paidAmount" | "outstandingAmount" | "nextInstallmentDueAt" | undefined;
|
|
62
|
+
sortOrder?: "DESC" | "ASC" | undefined;
|
|
60
63
|
deviceId?: string | undefined;
|
|
61
64
|
isOverdue?: "true" | "false" | undefined;
|
|
62
|
-
search?: string | undefined;
|
|
63
|
-
sortBy?: "createdAt" | "updatedAt" | "nextInstallmentDueAt" | "paidAmount" | "outstandingAmount" | undefined;
|
|
64
|
-
sortOrder?: "ASC" | "DESC" | undefined;
|
|
65
65
|
}>;
|
|
66
66
|
}, "strip", z.ZodTypeAny, {
|
|
67
67
|
query: {
|
|
68
|
-
page: number;
|
|
69
68
|
limit: number;
|
|
70
|
-
|
|
69
|
+
page: number;
|
|
70
|
+
search?: string | undefined;
|
|
71
71
|
userId?: string | undefined;
|
|
72
|
+
status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
|
|
73
|
+
sortBy?: "createdAt" | "updatedAt" | "paidAmount" | "outstandingAmount" | "nextInstallmentDueAt" | undefined;
|
|
74
|
+
sortOrder?: "DESC" | "ASC" | undefined;
|
|
72
75
|
deviceId?: string | undefined;
|
|
73
76
|
isOverdue?: "true" | "false" | undefined;
|
|
74
|
-
search?: string | undefined;
|
|
75
|
-
sortBy?: "createdAt" | "updatedAt" | "nextInstallmentDueAt" | "paidAmount" | "outstandingAmount" | undefined;
|
|
76
|
-
sortOrder?: "ASC" | "DESC" | undefined;
|
|
77
77
|
};
|
|
78
78
|
}, {
|
|
79
79
|
query: {
|
|
80
|
-
|
|
80
|
+
search?: string | undefined;
|
|
81
|
+
limit?: string | undefined;
|
|
81
82
|
userId?: string | undefined;
|
|
83
|
+
status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
|
|
82
84
|
page?: string | undefined;
|
|
83
|
-
|
|
85
|
+
sortBy?: "createdAt" | "updatedAt" | "paidAmount" | "outstandingAmount" | "nextInstallmentDueAt" | undefined;
|
|
86
|
+
sortOrder?: "DESC" | "ASC" | undefined;
|
|
84
87
|
deviceId?: string | undefined;
|
|
85
88
|
isOverdue?: "true" | "false" | undefined;
|
|
86
|
-
search?: string | undefined;
|
|
87
|
-
sortBy?: "createdAt" | "updatedAt" | "nextInstallmentDueAt" | "paidAmount" | "outstandingAmount" | undefined;
|
|
88
|
-
sortOrder?: "ASC" | "DESC" | undefined;
|
|
89
89
|
};
|
|
90
90
|
}>;
|
|
91
91
|
export declare const getPlanSchema: z.ZodObject<{
|
|
@@ -117,10 +117,10 @@ export declare const getUserPlansSchema: z.ZodObject<{
|
|
|
117
117
|
status: z.ZodOptional<z.ZodEnum<["ACTIVE", "COMPLETED", "DEFAULTED", "CANCELLED"]>>;
|
|
118
118
|
includeCompleted: z.ZodOptional<z.ZodEnum<["true", "false"]>>;
|
|
119
119
|
}, "strip", z.ZodTypeAny, {
|
|
120
|
-
status?: "ACTIVE" | "
|
|
120
|
+
status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
|
|
121
121
|
includeCompleted?: "true" | "false" | undefined;
|
|
122
122
|
}, {
|
|
123
|
-
status?: "ACTIVE" | "
|
|
123
|
+
status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
|
|
124
124
|
includeCompleted?: "true" | "false" | undefined;
|
|
125
125
|
}>>;
|
|
126
126
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -128,7 +128,7 @@ export declare const getUserPlansSchema: z.ZodObject<{
|
|
|
128
128
|
userId: string;
|
|
129
129
|
};
|
|
130
130
|
query?: {
|
|
131
|
-
status?: "ACTIVE" | "
|
|
131
|
+
status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
|
|
132
132
|
includeCompleted?: "true" | "false" | undefined;
|
|
133
133
|
} | undefined;
|
|
134
134
|
}, {
|
|
@@ -136,7 +136,7 @@ export declare const getUserPlansSchema: z.ZodObject<{
|
|
|
136
136
|
userId: string;
|
|
137
137
|
};
|
|
138
138
|
query?: {
|
|
139
|
-
status?: "ACTIVE" | "
|
|
139
|
+
status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
|
|
140
140
|
includeCompleted?: "true" | "false" | undefined;
|
|
141
141
|
} | undefined;
|
|
142
142
|
}>;
|
|
@@ -172,44 +172,44 @@ export declare const limitedUpdateSchema: z.ZodObject<{
|
|
|
172
172
|
userId: z.ZodString;
|
|
173
173
|
}, "strip", z.ZodTypeAny, {
|
|
174
174
|
userId: string;
|
|
175
|
+
productId: string;
|
|
175
176
|
deviceIds: string[];
|
|
176
177
|
pricingId: string;
|
|
177
|
-
productId: string;
|
|
178
178
|
}, {
|
|
179
179
|
userId: string;
|
|
180
|
+
productId: string;
|
|
180
181
|
deviceIds: string[];
|
|
181
182
|
pricingId: string;
|
|
182
|
-
productId: string;
|
|
183
183
|
}>, {
|
|
184
184
|
userId: string;
|
|
185
|
+
productId: string;
|
|
185
186
|
deviceIds: string[];
|
|
186
187
|
pricingId: string;
|
|
187
|
-
productId: string;
|
|
188
188
|
}, {
|
|
189
189
|
userId: string;
|
|
190
|
+
productId: string;
|
|
190
191
|
deviceIds: string[];
|
|
191
192
|
pricingId: string;
|
|
192
|
-
productId: string;
|
|
193
193
|
}>;
|
|
194
194
|
}, "strip", z.ZodTypeAny, {
|
|
195
|
-
params: {
|
|
196
|
-
id: string;
|
|
197
|
-
};
|
|
198
195
|
body: {
|
|
199
196
|
userId: string;
|
|
197
|
+
productId: string;
|
|
200
198
|
deviceIds: string[];
|
|
201
199
|
pricingId: string;
|
|
202
|
-
productId: string;
|
|
203
200
|
};
|
|
204
|
-
}, {
|
|
205
201
|
params: {
|
|
206
202
|
id: string;
|
|
207
203
|
};
|
|
204
|
+
}, {
|
|
208
205
|
body: {
|
|
209
206
|
userId: string;
|
|
207
|
+
productId: string;
|
|
210
208
|
deviceIds: string[];
|
|
211
209
|
pricingId: string;
|
|
212
|
-
|
|
210
|
+
};
|
|
211
|
+
params: {
|
|
212
|
+
id: string;
|
|
213
213
|
};
|
|
214
214
|
}>;
|
|
215
215
|
export declare const recordPaymentSchema: z.ZodObject<{
|
|
@@ -228,33 +228,33 @@ export declare const recordPaymentSchema: z.ZodObject<{
|
|
|
228
228
|
}, "strip", z.ZodTypeAny, {
|
|
229
229
|
amount: number;
|
|
230
230
|
provider: "mtn_momo" | "airtel_money";
|
|
231
|
-
providerReference?: string | undefined;
|
|
232
231
|
metadata?: Record<string, any> | undefined;
|
|
232
|
+
providerReference?: string | undefined;
|
|
233
233
|
}, {
|
|
234
234
|
amount: number;
|
|
235
235
|
provider: "mtn_momo" | "airtel_money";
|
|
236
|
-
providerReference?: string | undefined;
|
|
237
236
|
metadata?: Record<string, any> | undefined;
|
|
237
|
+
providerReference?: string | undefined;
|
|
238
238
|
}>;
|
|
239
239
|
}, "strip", z.ZodTypeAny, {
|
|
240
|
-
params: {
|
|
241
|
-
id: string;
|
|
242
|
-
};
|
|
243
240
|
body: {
|
|
244
241
|
amount: number;
|
|
245
242
|
provider: "mtn_momo" | "airtel_money";
|
|
246
|
-
providerReference?: string | undefined;
|
|
247
243
|
metadata?: Record<string, any> | undefined;
|
|
244
|
+
providerReference?: string | undefined;
|
|
248
245
|
};
|
|
249
|
-
}, {
|
|
250
246
|
params: {
|
|
251
247
|
id: string;
|
|
252
248
|
};
|
|
249
|
+
}, {
|
|
253
250
|
body: {
|
|
254
251
|
amount: number;
|
|
255
252
|
provider: "mtn_momo" | "airtel_money";
|
|
256
|
-
providerReference?: string | undefined;
|
|
257
253
|
metadata?: Record<string, any> | undefined;
|
|
254
|
+
providerReference?: string | undefined;
|
|
255
|
+
};
|
|
256
|
+
params: {
|
|
257
|
+
id: string;
|
|
258
258
|
};
|
|
259
259
|
}>;
|
|
260
260
|
export declare const deletePlanSchema: z.ZodObject<{
|
|
@@ -58,17 +58,17 @@ export declare const updateDeviceSchema: z.ZodObject<{
|
|
|
58
58
|
}, "strip", z.ZodTypeAny, {
|
|
59
59
|
status?: "locked" | "unlocked" | "disabled" | undefined;
|
|
60
60
|
serialNumber?: string | undefined;
|
|
61
|
-
dedicatedUser?: "
|
|
61
|
+
dedicatedUser?: "RIDER" | "PASSENGER" | "N/A" | null | undefined;
|
|
62
62
|
}, {
|
|
63
63
|
status?: "locked" | "unlocked" | "disabled" | undefined;
|
|
64
64
|
serialNumber?: string | undefined;
|
|
65
|
-
dedicatedUser?: "
|
|
65
|
+
dedicatedUser?: "RIDER" | "PASSENGER" | "N/A" | null | undefined;
|
|
66
66
|
}>;
|
|
67
67
|
}, "strip", z.ZodTypeAny, {
|
|
68
68
|
body: {
|
|
69
69
|
status?: "locked" | "unlocked" | "disabled" | undefined;
|
|
70
70
|
serialNumber?: string | undefined;
|
|
71
|
-
dedicatedUser?: "
|
|
71
|
+
dedicatedUser?: "RIDER" | "PASSENGER" | "N/A" | null | undefined;
|
|
72
72
|
};
|
|
73
73
|
params: {
|
|
74
74
|
id: string;
|
|
@@ -77,7 +77,7 @@ export declare const updateDeviceSchema: z.ZodObject<{
|
|
|
77
77
|
body: {
|
|
78
78
|
status?: "locked" | "unlocked" | "disabled" | undefined;
|
|
79
79
|
serialNumber?: string | undefined;
|
|
80
|
-
dedicatedUser?: "
|
|
80
|
+
dedicatedUser?: "RIDER" | "PASSENGER" | "N/A" | null | undefined;
|
|
81
81
|
};
|
|
82
82
|
params: {
|
|
83
83
|
id: string;
|
|
@@ -120,7 +120,7 @@ export declare const getDevicesSchema: z.ZodObject<{
|
|
|
120
120
|
sortBy?: "createdAt" | "updatedAt" | "status" | "serialNumber" | undefined;
|
|
121
121
|
sortOrder?: "DESC" | "ASC" | undefined;
|
|
122
122
|
productId?: string | undefined;
|
|
123
|
-
dedicatedUser?: "
|
|
123
|
+
dedicatedUser?: "RIDER" | "PASSENGER" | "N/A" | undefined;
|
|
124
124
|
isPermanentlyUnlocked?: "true" | "false" | undefined;
|
|
125
125
|
isAssigned?: "true" | "false" | undefined;
|
|
126
126
|
}, {
|
|
@@ -131,7 +131,7 @@ export declare const getDevicesSchema: z.ZodObject<{
|
|
|
131
131
|
sortBy?: "createdAt" | "updatedAt" | "status" | "serialNumber" | undefined;
|
|
132
132
|
sortOrder?: "DESC" | "ASC" | undefined;
|
|
133
133
|
productId?: string | undefined;
|
|
134
|
-
dedicatedUser?: "
|
|
134
|
+
dedicatedUser?: "RIDER" | "PASSENGER" | "N/A" | undefined;
|
|
135
135
|
isPermanentlyUnlocked?: "true" | "false" | undefined;
|
|
136
136
|
isAssigned?: "true" | "false" | undefined;
|
|
137
137
|
}>;
|
|
@@ -144,7 +144,7 @@ export declare const getDevicesSchema: z.ZodObject<{
|
|
|
144
144
|
sortBy?: "createdAt" | "updatedAt" | "status" | "serialNumber" | undefined;
|
|
145
145
|
sortOrder?: "DESC" | "ASC" | undefined;
|
|
146
146
|
productId?: string | undefined;
|
|
147
|
-
dedicatedUser?: "
|
|
147
|
+
dedicatedUser?: "RIDER" | "PASSENGER" | "N/A" | undefined;
|
|
148
148
|
isPermanentlyUnlocked?: "true" | "false" | undefined;
|
|
149
149
|
isAssigned?: "true" | "false" | undefined;
|
|
150
150
|
};
|
|
@@ -157,7 +157,7 @@ export declare const getDevicesSchema: z.ZodObject<{
|
|
|
157
157
|
sortBy?: "createdAt" | "updatedAt" | "status" | "serialNumber" | undefined;
|
|
158
158
|
sortOrder?: "DESC" | "ASC" | undefined;
|
|
159
159
|
productId?: string | undefined;
|
|
160
|
-
dedicatedUser?: "
|
|
160
|
+
dedicatedUser?: "RIDER" | "PASSENGER" | "N/A" | undefined;
|
|
161
161
|
isPermanentlyUnlocked?: "true" | "false" | undefined;
|
|
162
162
|
isAssigned?: "true" | "false" | undefined;
|
|
163
163
|
};
|
|
@@ -121,27 +121,27 @@ export declare const riderLoginSchema: z.ZodObject<{
|
|
|
121
121
|
phoneNumber: z.ZodString;
|
|
122
122
|
nationalId: z.ZodString;
|
|
123
123
|
}, "strip", z.ZodTypeAny, {
|
|
124
|
-
nationalId: string;
|
|
125
124
|
phoneNumber: string;
|
|
126
|
-
}, {
|
|
127
125
|
nationalId: string;
|
|
126
|
+
}, {
|
|
128
127
|
phoneNumber: string;
|
|
128
|
+
nationalId: string;
|
|
129
129
|
}>;
|
|
130
130
|
query: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
|
|
131
131
|
params: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
|
|
132
132
|
headers: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
|
|
133
133
|
}, "strip", z.ZodTypeAny, {
|
|
134
134
|
body: {
|
|
135
|
-
nationalId: string;
|
|
136
135
|
phoneNumber: string;
|
|
136
|
+
nationalId: string;
|
|
137
137
|
};
|
|
138
138
|
query?: {} | undefined;
|
|
139
139
|
params?: {} | undefined;
|
|
140
140
|
headers?: {} | undefined;
|
|
141
141
|
}, {
|
|
142
142
|
body: {
|
|
143
|
-
nationalId: string;
|
|
144
143
|
phoneNumber: string;
|
|
144
|
+
nationalId: string;
|
|
145
145
|
};
|
|
146
146
|
query?: {} | undefined;
|
|
147
147
|
params?: {} | undefined;
|