vr-commons 1.0.176 → 1.0.177
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/constants/regex.constants.d.ts +19 -0
- package/dist/constants/regex.constants.js +24 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -3
- package/dist/middlewares/admin/admin.auth.middleware.js +60 -0
- package/dist/middlewares/index.d.ts +4 -5
- package/dist/middlewares/index.js +11 -14
- package/dist/middlewares/shared/auth.admin.middlewares.d.ts +3 -0
- package/dist/middlewares/{auth.admin.middlewares.js → shared/auth.admin.middlewares.js} +7 -7
- package/dist/middlewares/{account.shared.middlewares.js → shared/shared.account.middleware.js} +8 -8
- package/dist/middlewares/{errorHandler.middleware.js → shared/shared.errorHandler.middleware.js} +0 -1
- package/dist/middlewares/{auth.users.middlewares.js → users/users.auth.middleware.js} +10 -10
- package/dist/utils/{admin.devicePayment.utils.js → admin/admin.devicePayments.utils.js} +0 -1
- package/dist/utils/{admin.device.utils.d.ts → admin/admin.devices.utils.d.ts} +1 -1
- package/dist/utils/{admin.device.utils.js → admin/admin.devices.utils.js} +11 -12
- package/dist/utils/{eventlogs.admin.utils.js → admin/admin.eventLogs.utils.js} +0 -1
- package/dist/utils/{hierarchy.utils.js → admin/admin.hierarchy.utils.js} +0 -2
- package/dist/utils/{product.utils.d.ts → admin/admin.products.utils.d.ts} +1 -1
- package/dist/utils/{systemLog.utils.js → admin/admin.systemLogs.utils.js} +0 -1
- package/dist/utils/index.d.ts +16 -18
- package/dist/utils/index.js +88 -99
- package/dist/utils/{account.utils.js → shared/shared.accounts.utils.js} +0 -1
- package/dist/utils/{profiles.utils.d.ts → shared/shared.profiles.utils.d.ts} +2 -1
- package/dist/utils/{profiles.utils.js → shared/shared.profiles.utils.js} +3 -2
- package/dist/utils/{verification.utils.d.ts → users/users.verification.utils.d.ts} +1 -1
- package/dist/utils/{verification.utils.js → users/users.verification.utils.js} +3 -2
- package/dist/validations/{admin.devicePayment.validations.js → admin/admin.devicePayments.validations.js} +3 -2
- package/dist/validations/{admin.devices.validations.js → admin/admin.devices.validations.js} +4 -5
- package/dist/validations/{eventlogs.admin.validations.js → admin/admin.eventLogs.validations.js} +2 -2
- package/dist/validations/{admin.installment.validations.js → admin/admin.installments.validations.js} +4 -3
- package/dist/validations/{pricings.validations.js → admin/admin.pricings.validations.js} +5 -5
- package/dist/validations/{product.validations.js → admin/admin.products.validations.js} +4 -3
- package/dist/validations/{users.admin.validations.js → admin/admin.users.validations.js} +13 -13
- package/dist/validations/index.d.ts +16 -15
- package/dist/validations/index.js +132 -125
- package/dist/validations/{account.validations.js → shared/shared.account.validations.js} +7 -7
- package/dist/validations/{appSpecs.validations.js → shared/shared.appSpecs.validations.js} +0 -1
- package/dist/validations/{auth.validations.js → shared/shared.auth.validations.js} +6 -6
- package/dist/validations/{dateRange.validations.js → shared/shared.dateRanges.validations.js} +5 -5
- package/dist/validations/{moderation.validations.js → shared/shared.moderation.validations.js} +24 -25
- package/dist/validations/{profiles.validations.js → shared/shared.profiles.validations.js} +22 -21
- package/dist/validations/{devices.validations.js → users/users.devices.validations.js} +2 -1
- package/package.json +1 -1
- package/dist/middlewares/idempotency.middlewares.d.ts +0 -3
- package/dist/middlewares/idempotency.middlewares.js +0 -74
- package/dist/utils/deviceUtils.d.ts +0 -2
- package/dist/utils/deviceUtils.js +0 -21
- package/dist/utils/session.utils.d.ts +0 -6
- package/dist/utils/session.utils.js +0 -25
- package/dist/validations/appeals.validations.d.ts +0 -61
- package/dist/validations/appeals.validations.js +0 -31
- package/dist/validations/payinstallment.validations.d.ts +0 -56
- package/dist/validations/payinstallment.validations.js +0 -23
- package/dist/validations/pricing.validations.d.ts +0 -313
- package/dist/validations/pricing.validations.js +0 -376
- /package/dist/middlewares/{auth.admin.middlewares.d.ts → admin/admin.auth.middleware.d.ts} +0 -0
- /package/dist/middlewares/{account.shared.middlewares.d.ts → shared/shared.account.middleware.d.ts} +0 -0
- /package/dist/middlewares/{errorHandler.middleware.d.ts → shared/shared.errorHandler.middleware.d.ts} +0 -0
- /package/dist/middlewares/{auth.users.middlewares.d.ts → users/users.auth.middleware.d.ts} +0 -0
- /package/dist/utils/{bans.utils.d.ts → admin/admin.bans.utils.d.ts} +0 -0
- /package/dist/utils/{bans.utils.js → admin/admin.bans.utils.js} +0 -0
- /package/dist/utils/{admin.devicePayment.utils.d.ts → admin/admin.devicePayments.utils.d.ts} +0 -0
- /package/dist/utils/{eventlogs.admin.utils.d.ts → admin/admin.eventLogs.utils.d.ts} +0 -0
- /package/dist/utils/{hierarchy.utils.d.ts → admin/admin.hierarchy.utils.d.ts} +0 -0
- /package/dist/utils/{moderation.utils.d.ts → admin/admin.moderation.utils.d.ts} +0 -0
- /package/dist/utils/{moderation.utils.js → admin/admin.moderation.utils.js} +0 -0
- /package/dist/utils/{product.utils.js → admin/admin.products.utils.js} +0 -0
- /package/dist/utils/{suspension.utils.d.ts → admin/admin.suspensions.utils.d.ts} +0 -0
- /package/dist/utils/{suspension.utils.js → admin/admin.suspensions.utils.js} +0 -0
- /package/dist/utils/{systemLog.utils.d.ts → admin/admin.systemLogs.utils.d.ts} +0 -0
- /package/dist/utils/{account.utils.d.ts → shared/shared.accounts.utils.d.ts} +0 -0
- /package/dist/utils/{authTokens.utils.d.ts → shared/shared.authTokens.utils.d.ts} +0 -0
- /package/dist/utils/{authTokens.utils.js → shared/shared.authTokens.utils.js} +0 -0
- /package/dist/utils/{eventLog.utils.d.ts → shared/shared.eventLogs.utils.d.ts} +0 -0
- /package/dist/utils/{eventLog.utils.js → shared/shared.eventLogs.utils.js} +0 -0
- /package/dist/utils/{response.utils.d.ts → shared/shared.responses.utils.d.ts} +0 -0
- /package/dist/utils/{response.utils.js → shared/shared.responses.utils.js} +0 -0
- /package/dist/utils/{types.d.ts → shared/shared.types.d.ts} +0 -0
- /package/dist/utils/{types.js → shared/shared.types.js} +0 -0
- /package/dist/validations/{bans.validations.d.ts → admin/admin.bans.validations.d.ts} +0 -0
- /package/dist/validations/{bans.validations.js → admin/admin.bans.validations.js} +0 -0
- /package/dist/validations/{admin.devicePayment.validations.d.ts → admin/admin.devicePayments.validations.d.ts} +0 -0
- /package/dist/validations/{admin.devices.validations.d.ts → admin/admin.devices.validations.d.ts} +0 -0
- /package/dist/validations/{eventlogs.admin.validations.d.ts → admin/admin.eventLogs.validations.d.ts} +0 -0
- /package/dist/validations/{admin.installment.validations.d.ts → admin/admin.installments.validations.d.ts} +0 -0
- /package/dist/validations/{pricings.validations.d.ts → admin/admin.pricings.validations.d.ts} +0 -0
- /package/dist/validations/{product.validations.d.ts → admin/admin.products.validations.d.ts} +0 -0
- /package/dist/validations/{suspensions.validations.d.ts → admin/admin.suspensions.validations.d.ts} +0 -0
- /package/dist/validations/{suspensions.validations.js → admin/admin.suspensions.validations.js} +0 -0
- /package/dist/validations/{users.admin.validations.d.ts → admin/admin.users.validations.d.ts} +0 -0
- /package/dist/validations/{account.validations.d.ts → shared/shared.account.validations.d.ts} +0 -0
- /package/dist/validations/{appSpecs.validations.d.ts → shared/shared.appSpecs.validations.d.ts} +0 -0
- /package/dist/validations/{auth.validations.d.ts → shared/shared.auth.validations.d.ts} +0 -0
- /package/dist/validations/{dateRange.validations.d.ts → shared/shared.dateRanges.validations.d.ts} +0 -0
- /package/dist/validations/{moderation.validations.d.ts → shared/shared.moderation.validations.d.ts} +0 -0
- /package/dist/validations/{profiles.validations.d.ts → shared/shared.profiles.validations.d.ts} +0 -0
- /package/dist/validations/{validate.validations.d.ts → shared/shared.validate.validations.d.ts} +0 -0
- /package/dist/validations/{validate.validations.js → shared/shared.validate.validations.js} +0 -0
- /package/dist/validations/{devicePaymentPlan.validations.d.ts → users/users.devicePaymentPlans.validations.d.ts} +0 -0
- /package/dist/validations/{devicePaymentPlan.validations.js → users/users.devicePaymentPlans.validations.js} +0 -0
- /package/dist/validations/{devices.validations.d.ts → users/users.devices.validations.d.ts} +0 -0
package/dist/utils/index.js
CHANGED
|
@@ -1,101 +1,90 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
var
|
|
6
|
-
Object.defineProperty(exports, "checkAccountDependencies", { enumerable: true, get: function () { return
|
|
7
|
-
Object.defineProperty(exports, "hasActiveDependencies", { enumerable: true, get: function () { return
|
|
8
|
-
Object.defineProperty(exports, "checkBanStatus", { enumerable: true, get: function () { return
|
|
9
|
-
Object.defineProperty(exports, "checkIsUserBannedOrSuspended", { enumerable: true, get: function () { return
|
|
10
|
-
Object.defineProperty(exports, "checkSuspensionStatus", { enumerable: true, get: function () { return
|
|
11
|
-
var
|
|
12
|
-
Object.defineProperty(exports, "generateAdminToken", { enumerable: true, get: function () { return
|
|
13
|
-
Object.defineProperty(exports, "generatePassengerToken", { enumerable: true, get: function () { return
|
|
14
|
-
Object.defineProperty(exports, "generateRiderToken", { enumerable: true, get: function () { return
|
|
15
|
-
Object.defineProperty(exports, "verifyToken", { enumerable: true, get: function () { return
|
|
16
|
-
Object.defineProperty(exports, "shouldRefreshToken", { enumerable: true, get: function () { return
|
|
17
|
-
Object.defineProperty(exports, "generateToken", { enumerable: true, get: function () { return
|
|
18
|
-
Object.defineProperty(exports, "getTokenTimeRemaining", { enumerable: true, get: function () { return
|
|
19
|
-
Object.defineProperty(exports, "formatTimeRemaining", { enumerable: true, get: function () { return
|
|
20
|
-
var
|
|
21
|
-
Object.defineProperty(exports, "logEvent", { enumerable: true, get: function () { return
|
|
22
|
-
var
|
|
23
|
-
Object.defineProperty(exports, "sendSuccessResponse", { enumerable: true, get: function () { return
|
|
24
|
-
Object.defineProperty(exports, "sendErrorResponse", { enumerable: true, get: function () { return
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
Object.defineProperty(exports, "
|
|
28
|
-
Object.defineProperty(exports, "
|
|
29
|
-
|
|
30
|
-
Object.defineProperty(exports, "
|
|
31
|
-
Object.defineProperty(exports, "
|
|
32
|
-
Object.defineProperty(exports, "
|
|
33
|
-
Object.defineProperty(exports, "
|
|
34
|
-
Object.defineProperty(exports, "
|
|
35
|
-
Object.defineProperty(exports, "
|
|
36
|
-
|
|
37
|
-
Object.defineProperty(exports, "
|
|
38
|
-
Object.defineProperty(exports, "
|
|
39
|
-
Object.defineProperty(exports, "
|
|
40
|
-
Object.defineProperty(exports, "
|
|
41
|
-
Object.defineProperty(exports, "
|
|
42
|
-
Object.defineProperty(exports, "
|
|
43
|
-
|
|
44
|
-
Object.defineProperty(exports, "
|
|
45
|
-
|
|
46
|
-
Object.defineProperty(exports, "
|
|
47
|
-
Object.defineProperty(exports, "
|
|
48
|
-
|
|
49
|
-
Object.defineProperty(exports, "
|
|
50
|
-
|
|
51
|
-
Object.defineProperty(exports, "
|
|
52
|
-
var
|
|
53
|
-
Object.defineProperty(exports, "
|
|
54
|
-
|
|
55
|
-
Object.defineProperty(exports, "
|
|
56
|
-
Object.defineProperty(exports, "
|
|
57
|
-
|
|
58
|
-
Object.defineProperty(exports, "
|
|
59
|
-
|
|
60
|
-
Object.defineProperty(exports, "
|
|
61
|
-
|
|
62
|
-
Object.defineProperty(exports, "
|
|
63
|
-
var
|
|
64
|
-
Object.defineProperty(exports, "
|
|
65
|
-
|
|
66
|
-
Object.defineProperty(exports, "
|
|
67
|
-
|
|
68
|
-
Object.defineProperty(exports, "
|
|
69
|
-
|
|
70
|
-
Object.defineProperty(exports, "
|
|
71
|
-
Object.defineProperty(exports, "
|
|
72
|
-
|
|
73
|
-
Object.defineProperty(exports, "
|
|
74
|
-
Object.defineProperty(exports, "
|
|
75
|
-
Object.defineProperty(exports, "
|
|
76
|
-
|
|
77
|
-
Object.defineProperty(exports, "
|
|
78
|
-
Object.defineProperty(exports, "
|
|
79
|
-
Object.defineProperty(exports, "
|
|
80
|
-
Object.defineProperty(exports, "
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
Object.defineProperty(exports, "
|
|
85
|
-
|
|
86
|
-
Object.defineProperty(exports, "
|
|
87
|
-
|
|
88
|
-
Object.defineProperty(exports, "
|
|
89
|
-
Object.defineProperty(exports, "
|
|
90
|
-
Object.defineProperty(exports, "
|
|
91
|
-
Object.defineProperty(exports, "buildEventLogWhereClause", { enumerable: true, get: function () { return eventlogs_admin_utils_1.buildEventLogWhereClause; } });
|
|
92
|
-
Object.defineProperty(exports, "buildSearchConditions", { enumerable: true, get: function () { return eventlogs_admin_utils_1.buildSearchConditions; } });
|
|
93
|
-
Object.defineProperty(exports, "buildUserSearchConditions", { enumerable: true, get: function () { return eventlogs_admin_utils_1.buildUserSearchConditions; } });
|
|
94
|
-
var deviceUtils_1 = require("./deviceUtils");
|
|
95
|
-
Object.defineProperty(exports, "extractDedicatedUserFromSerial", { enumerable: true, get: function () { return deviceUtils_1.extractDedicatedUserFromSerial; } });
|
|
96
|
-
var systemLog_utils_1 = require("./systemLog.utils");
|
|
97
|
-
Object.defineProperty(exports, "logDebug", { enumerable: true, get: function () { return systemLog_utils_1.logDebug; } });
|
|
98
|
-
Object.defineProperty(exports, "logError", { enumerable: true, get: function () { return systemLog_utils_1.logError; } });
|
|
99
|
-
Object.defineProperty(exports, "logInfo", { enumerable: true, get: function () { return systemLog_utils_1.logInfo; } });
|
|
100
|
-
Object.defineProperty(exports, "logSystem", { enumerable: true, get: function () { return systemLog_utils_1.logSystem; } });
|
|
101
|
-
Object.defineProperty(exports, "logWarning", { enumerable: true, get: function () { return systemLog_utils_1.logWarning; } });
|
|
3
|
+
exports.stockUtil = exports.hierarchicalView = exports.validateHierarchy = exports.isSuperiorOrEqual = exports.isSuperior = exports.isSubordinateOrEqual = exports.isSubordinate = exports.isRankEqual = exports.getUserLevel = exports.suspensionUtil = exports.banUtil = exports.hasHigherAuthority = exports.getModeratableRoles = exports.canModerateUser = exports.canModerate = 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.sendErrorResponse = exports.sendSuccessResponse = exports.logEvent = exports.formatTimeRemaining = exports.getTokenTimeRemaining = exports.generateToken = exports.shouldRefreshToken = exports.verifyToken = exports.generateRiderToken = exports.generatePassengerToken = exports.generateAdminToken = exports.checkSuspensionStatus = exports.checkIsUserBannedOrSuspended = exports.checkBanStatus = exports.hasActiveDependencies = exports.checkAccountDependencies = void 0;
|
|
4
|
+
exports.validateContactValue = exports.detectContactType = exports.sendVerificationCode = exports.sendSMS = exports.sendEmail = exports.getVerificationMethod = exports.getOTPExpiry = exports.generateOTP = exports.logWarning = exports.logSystem = exports.logInfo = exports.logError = exports.logDebug = exports.buildUserSearchConditions = exports.buildSearchConditions = exports.buildEventLogWhereClause = exports.formatEventLogs = exports.formatEventLog = exports.formatDeviceSession = exports.DPP_OperationsUtil = exports.cloudinaryUtil = void 0;
|
|
5
|
+
var shared_accounts_utils_1 = require("./shared/shared.accounts.utils");
|
|
6
|
+
Object.defineProperty(exports, "checkAccountDependencies", { enumerable: true, get: function () { return shared_accounts_utils_1.checkAccountDependencies; } });
|
|
7
|
+
Object.defineProperty(exports, "hasActiveDependencies", { enumerable: true, get: function () { return shared_accounts_utils_1.hasActiveDependencies; } });
|
|
8
|
+
Object.defineProperty(exports, "checkBanStatus", { enumerable: true, get: function () { return shared_accounts_utils_1.checkBanStatus; } });
|
|
9
|
+
Object.defineProperty(exports, "checkIsUserBannedOrSuspended", { enumerable: true, get: function () { return shared_accounts_utils_1.checkIsUserBannedOrSuspended; } });
|
|
10
|
+
Object.defineProperty(exports, "checkSuspensionStatus", { enumerable: true, get: function () { return shared_accounts_utils_1.checkSuspensionStatus; } });
|
|
11
|
+
var shared_authTokens_utils_1 = require("./shared/shared.authTokens.utils");
|
|
12
|
+
Object.defineProperty(exports, "generateAdminToken", { enumerable: true, get: function () { return shared_authTokens_utils_1.generateAdminToken; } });
|
|
13
|
+
Object.defineProperty(exports, "generatePassengerToken", { enumerable: true, get: function () { return shared_authTokens_utils_1.generatePassengerToken; } });
|
|
14
|
+
Object.defineProperty(exports, "generateRiderToken", { enumerable: true, get: function () { return shared_authTokens_utils_1.generateRiderToken; } });
|
|
15
|
+
Object.defineProperty(exports, "verifyToken", { enumerable: true, get: function () { return shared_authTokens_utils_1.verifyToken; } });
|
|
16
|
+
Object.defineProperty(exports, "shouldRefreshToken", { enumerable: true, get: function () { return shared_authTokens_utils_1.shouldRefreshToken; } });
|
|
17
|
+
Object.defineProperty(exports, "generateToken", { enumerable: true, get: function () { return shared_authTokens_utils_1.generateToken; } });
|
|
18
|
+
Object.defineProperty(exports, "getTokenTimeRemaining", { enumerable: true, get: function () { return shared_authTokens_utils_1.getTokenTimeRemaining; } });
|
|
19
|
+
Object.defineProperty(exports, "formatTimeRemaining", { enumerable: true, get: function () { return shared_authTokens_utils_1.formatTimeRemaining; } });
|
|
20
|
+
var shared_eventLogs_utils_1 = require("./shared/shared.eventLogs.utils");
|
|
21
|
+
Object.defineProperty(exports, "logEvent", { enumerable: true, get: function () { return shared_eventLogs_utils_1.logEvent; } });
|
|
22
|
+
var shared_responses_utils_1 = require("./shared/shared.responses.utils");
|
|
23
|
+
Object.defineProperty(exports, "sendSuccessResponse", { enumerable: true, get: function () { return shared_responses_utils_1.sendSuccessResponse; } });
|
|
24
|
+
Object.defineProperty(exports, "sendErrorResponse", { enumerable: true, get: function () { return shared_responses_utils_1.sendErrorResponse; } });
|
|
25
|
+
var shared_profiles_utils_1 = require("./shared/shared.profiles.utils");
|
|
26
|
+
Object.defineProperty(exports, "formatUserProfile", { enumerable: true, get: function () { return shared_profiles_utils_1.formatUserProfile; } });
|
|
27
|
+
Object.defineProperty(exports, "formatUserListResponse", { enumerable: true, get: function () { return shared_profiles_utils_1.formatUserListResponse; } });
|
|
28
|
+
Object.defineProperty(exports, "hasRole", { enumerable: true, get: function () { return shared_profiles_utils_1.hasRole; } });
|
|
29
|
+
Object.defineProperty(exports, "hasPermission", { enumerable: true, get: function () { return shared_profiles_utils_1.hasPermission; } });
|
|
30
|
+
Object.defineProperty(exports, "hasAnyPermission", { enumerable: true, get: function () { return shared_profiles_utils_1.hasAnyPermission; } });
|
|
31
|
+
Object.defineProperty(exports, "hasAllPermissions", { enumerable: true, get: function () { return shared_profiles_utils_1.hasAllPermissions; } });
|
|
32
|
+
Object.defineProperty(exports, "canModifyAccount", { enumerable: true, get: function () { return shared_profiles_utils_1.canModifyAccount; } });
|
|
33
|
+
Object.defineProperty(exports, "isAccountAccessible", { enumerable: true, get: function () { return shared_profiles_utils_1.isAccountAccessible; } });
|
|
34
|
+
Object.defineProperty(exports, "getUserById", { enumerable: true, get: function () { return shared_profiles_utils_1.getUserById; } });
|
|
35
|
+
Object.defineProperty(exports, "getUsersByRole", { enumerable: true, get: function () { return shared_profiles_utils_1.getUsersByRole; } });
|
|
36
|
+
Object.defineProperty(exports, "findSecurityClearanceByRole", { enumerable: true, get: function () { return shared_profiles_utils_1.findSecurityClearanceByRole; } });
|
|
37
|
+
Object.defineProperty(exports, "generateUserSearchConditions", { enumerable: true, get: function () { return shared_profiles_utils_1.generateUserSearchConditions; } });
|
|
38
|
+
Object.defineProperty(exports, "generateEventSearchConditions", { enumerable: true, get: function () { return shared_profiles_utils_1.generateEventSearchConditions; } });
|
|
39
|
+
Object.defineProperty(exports, "getSortOrder", { enumerable: true, get: function () { return shared_profiles_utils_1.getSortOrder; } });
|
|
40
|
+
Object.defineProperty(exports, "generateJacketId", { enumerable: true, get: function () { return shared_profiles_utils_1.generateJacketId; } });
|
|
41
|
+
Object.defineProperty(exports, "validateUniqueFields", { enumerable: true, get: function () { return shared_profiles_utils_1.validateUniqueFields; } });
|
|
42
|
+
Object.defineProperty(exports, "validatePassword", { enumerable: true, get: function () { return shared_profiles_utils_1.validatePassword; } });
|
|
43
|
+
Object.defineProperty(exports, "hashPassword", { enumerable: true, get: function () { return shared_profiles_utils_1.hashPassword; } });
|
|
44
|
+
Object.defineProperty(exports, "softDeleteUser", { enumerable: true, get: function () { return shared_profiles_utils_1.softDeleteUser; } });
|
|
45
|
+
var admin_moderation_utils_1 = require("./admin/admin.moderation.utils");
|
|
46
|
+
Object.defineProperty(exports, "canModerate", { enumerable: true, get: function () { return admin_moderation_utils_1.canModerate; } });
|
|
47
|
+
Object.defineProperty(exports, "canModerateUser", { enumerable: true, get: function () { return admin_moderation_utils_1.canModerateUser; } });
|
|
48
|
+
Object.defineProperty(exports, "getModeratableRoles", { enumerable: true, get: function () { return admin_moderation_utils_1.getModeratableRoles; } });
|
|
49
|
+
Object.defineProperty(exports, "hasHigherAuthority", { enumerable: true, get: function () { return admin_moderation_utils_1.hasHigherAuthority; } });
|
|
50
|
+
var admin_bans_utils_1 = require("./admin/admin.bans.utils");
|
|
51
|
+
Object.defineProperty(exports, "banUtil", { enumerable: true, get: function () { return admin_bans_utils_1.banUtil; } });
|
|
52
|
+
var admin_suspensions_utils_1 = require("./admin/admin.suspensions.utils");
|
|
53
|
+
Object.defineProperty(exports, "suspensionUtil", { enumerable: true, get: function () { return admin_suspensions_utils_1.suspensionUtil; } });
|
|
54
|
+
var admin_hierarchy_utils_1 = require("./admin/admin.hierarchy.utils");
|
|
55
|
+
Object.defineProperty(exports, "getUserLevel", { enumerable: true, get: function () { return admin_hierarchy_utils_1.getUserLevel; } });
|
|
56
|
+
Object.defineProperty(exports, "isRankEqual", { enumerable: true, get: function () { return admin_hierarchy_utils_1.isRankEqual; } });
|
|
57
|
+
Object.defineProperty(exports, "isSubordinate", { enumerable: true, get: function () { return admin_hierarchy_utils_1.isSubordinate; } });
|
|
58
|
+
Object.defineProperty(exports, "isSubordinateOrEqual", { enumerable: true, get: function () { return admin_hierarchy_utils_1.isSubordinateOrEqual; } });
|
|
59
|
+
Object.defineProperty(exports, "isSuperior", { enumerable: true, get: function () { return admin_hierarchy_utils_1.isSuperior; } });
|
|
60
|
+
Object.defineProperty(exports, "isSuperiorOrEqual", { enumerable: true, get: function () { return admin_hierarchy_utils_1.isSuperiorOrEqual; } });
|
|
61
|
+
Object.defineProperty(exports, "validateHierarchy", { enumerable: true, get: function () { return admin_hierarchy_utils_1.validateHierarchy; } });
|
|
62
|
+
Object.defineProperty(exports, "hierarchicalView", { enumerable: true, get: function () { return admin_hierarchy_utils_1.hierarchicalView; } });
|
|
63
|
+
var admin_devices_utils_1 = require("./admin/admin.devices.utils");
|
|
64
|
+
Object.defineProperty(exports, "stockUtil", { enumerable: true, get: function () { return admin_devices_utils_1.stockUtil; } });
|
|
65
|
+
var admin_products_utils_1 = require("./admin/admin.products.utils");
|
|
66
|
+
Object.defineProperty(exports, "cloudinaryUtil", { enumerable: true, get: function () { return admin_products_utils_1.cloudinaryUtil; } });
|
|
67
|
+
var admin_devicePayments_utils_1 = require("./admin/admin.devicePayments.utils");
|
|
68
|
+
Object.defineProperty(exports, "DPP_OperationsUtil", { enumerable: true, get: function () { return admin_devicePayments_utils_1.DPP_OperationsUtil; } });
|
|
69
|
+
var admin_eventLogs_utils_1 = require("./admin/admin.eventLogs.utils");
|
|
70
|
+
Object.defineProperty(exports, "formatDeviceSession", { enumerable: true, get: function () { return admin_eventLogs_utils_1.formatDeviceSession; } });
|
|
71
|
+
Object.defineProperty(exports, "formatEventLog", { enumerable: true, get: function () { return admin_eventLogs_utils_1.formatEventLog; } });
|
|
72
|
+
Object.defineProperty(exports, "formatEventLogs", { enumerable: true, get: function () { return admin_eventLogs_utils_1.formatEventLogs; } });
|
|
73
|
+
Object.defineProperty(exports, "buildEventLogWhereClause", { enumerable: true, get: function () { return admin_eventLogs_utils_1.buildEventLogWhereClause; } });
|
|
74
|
+
Object.defineProperty(exports, "buildSearchConditions", { enumerable: true, get: function () { return admin_eventLogs_utils_1.buildSearchConditions; } });
|
|
75
|
+
Object.defineProperty(exports, "buildUserSearchConditions", { enumerable: true, get: function () { return admin_eventLogs_utils_1.buildUserSearchConditions; } });
|
|
76
|
+
var admin_systemLogs_utils_1 = require("./admin/admin.systemLogs.utils");
|
|
77
|
+
Object.defineProperty(exports, "logDebug", { enumerable: true, get: function () { return admin_systemLogs_utils_1.logDebug; } });
|
|
78
|
+
Object.defineProperty(exports, "logError", { enumerable: true, get: function () { return admin_systemLogs_utils_1.logError; } });
|
|
79
|
+
Object.defineProperty(exports, "logInfo", { enumerable: true, get: function () { return admin_systemLogs_utils_1.logInfo; } });
|
|
80
|
+
Object.defineProperty(exports, "logSystem", { enumerable: true, get: function () { return admin_systemLogs_utils_1.logSystem; } });
|
|
81
|
+
Object.defineProperty(exports, "logWarning", { enumerable: true, get: function () { return admin_systemLogs_utils_1.logWarning; } });
|
|
82
|
+
var users_verification_utils_1 = require("./users/users.verification.utils");
|
|
83
|
+
Object.defineProperty(exports, "generateOTP", { enumerable: true, get: function () { return users_verification_utils_1.generateOTP; } });
|
|
84
|
+
Object.defineProperty(exports, "getOTPExpiry", { enumerable: true, get: function () { return users_verification_utils_1.getOTPExpiry; } });
|
|
85
|
+
Object.defineProperty(exports, "getVerificationMethod", { enumerable: true, get: function () { return users_verification_utils_1.getVerificationMethod; } });
|
|
86
|
+
Object.defineProperty(exports, "sendEmail", { enumerable: true, get: function () { return users_verification_utils_1.sendEmail; } });
|
|
87
|
+
Object.defineProperty(exports, "sendSMS", { enumerable: true, get: function () { return users_verification_utils_1.sendSMS; } });
|
|
88
|
+
Object.defineProperty(exports, "sendVerificationCode", { enumerable: true, get: function () { return users_verification_utils_1.sendVerificationCode; } });
|
|
89
|
+
Object.defineProperty(exports, "detectContactType", { enumerable: true, get: function () { return users_verification_utils_1.detectContactType; } });
|
|
90
|
+
Object.defineProperty(exports, "validateContactValue", { enumerable: true, get: function () { return users_verification_utils_1.validateContactValue; } });
|
|
@@ -75,7 +75,6 @@ const checkIsUserBannedOrSuspended = async (userId) => {
|
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
77
|
exports.checkIsUserBannedOrSuspended = checkIsUserBannedOrSuspended;
|
|
78
|
-
// src/utils/dependency.utils.ts
|
|
79
78
|
/**
|
|
80
79
|
* Check if user has active dependencies that prevent deletion/update
|
|
81
80
|
* FIXED: Removed references to non-existent fields
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { User, SecurityClearance, UserRole, Permission, Gender } from "vr-models";
|
|
2
|
+
import { JACKET_ID_REGEX } from "../../constants/regex.constants";
|
|
2
3
|
import { Transaction, WhereOptions } from "sequelize";
|
|
3
4
|
export type UserType = "RIDER" | "PASSENGER" | "AGENT" | "ADMIN" | "SUPER_ADMIN";
|
|
4
5
|
export interface ProfileFormatOptions {
|
|
@@ -87,7 +88,7 @@ export interface GetUsersResult {
|
|
|
87
88
|
total: number;
|
|
88
89
|
}
|
|
89
90
|
export declare const PHONE_REGEX: RegExp;
|
|
90
|
-
export
|
|
91
|
+
export { JACKET_ID_REGEX };
|
|
91
92
|
export declare const JACKET_ID_PREFIX = "JKT";
|
|
92
93
|
/**
|
|
93
94
|
* Format user profile based on viewer type and options
|
|
@@ -6,12 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
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
|
+
const regex_constants_1 = require("../../constants/regex.constants");
|
|
10
|
+
Object.defineProperty(exports, "JACKET_ID_REGEX", { enumerable: true, get: function () { return regex_constants_1.JACKET_ID_REGEX; } });
|
|
9
11
|
const sequelize_1 = require("sequelize");
|
|
10
12
|
// ============================================================================
|
|
11
13
|
// REGEX PATTERNS & CONSTANTS
|
|
12
14
|
// ============================================================================
|
|
13
|
-
exports.PHONE_REGEX =
|
|
14
|
-
exports.JACKET_ID_REGEX = /^JKT-\d{9}$/;
|
|
15
|
+
exports.PHONE_REGEX = regex_constants_1.LOCAL_RWANDA_PHONE_NUMBER_REGEX;
|
|
15
16
|
exports.JACKET_ID_PREFIX = "JKT";
|
|
16
17
|
// ============================================================================
|
|
17
18
|
// FORMATTING FUNCTIONS (WITH EXPLICIT RETURN TYPES)
|
|
@@ -5,12 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.sendVerificationCode = exports.sendEmail = exports.sendSMS = exports.getOTPExpiry = exports.generateOTP = exports.getVerificationMethod = exports.validateContactValue = exports.detectContactType = exports.emailRegex = exports.phoneRegex = void 0;
|
|
7
7
|
const nodemailer_1 = __importDefault(require("nodemailer"));
|
|
8
|
+
const regex_constants_1 = require("../../constants/regex.constants");
|
|
8
9
|
// ==================== CONTACT VALIDATION HELPERS ====================
|
|
9
10
|
/**
|
|
10
11
|
* Regular expressions for contact validation
|
|
11
12
|
*/
|
|
12
|
-
exports.phoneRegex =
|
|
13
|
-
exports.emailRegex =
|
|
13
|
+
exports.phoneRegex = regex_constants_1.PHONE_NUMBER_REGEX;
|
|
14
|
+
exports.emailRegex = regex_constants_1.EMAIL_ADDRESS_REGEX;
|
|
14
15
|
/**
|
|
15
16
|
* Detect the type of contact value
|
|
16
17
|
* @param value - The contact value to check (email or phone number)
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.deletePlanSchema = exports.recordPaymentSchema = exports.limitedUpdateSchema = exports.getDevicePlanSchema = exports.getUserPlansSchema = exports.getPlanSchema = exports.listPlansSchema = exports.createPlanSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const vr_models_1 = require("vr-models");
|
|
6
|
+
const regex_constants_1 = require("../../constants/regex.constants");
|
|
6
7
|
// ==================== CREATE ====================
|
|
7
8
|
exports.createPlanSchema = zod_1.z.object({
|
|
8
9
|
body: zod_1.z.object({
|
|
@@ -14,8 +15,8 @@ exports.createPlanSchema = zod_1.z.object({
|
|
|
14
15
|
// ==================== READ ====================
|
|
15
16
|
exports.listPlansSchema = zod_1.z.object({
|
|
16
17
|
query: zod_1.z.object({
|
|
17
|
-
page: zod_1.z.string().regex(
|
|
18
|
-
limit: zod_1.z.string().regex(
|
|
18
|
+
page: zod_1.z.string().regex(regex_constants_1.NUMERIC_STRING_REGEX).transform(Number).optional().default("1"),
|
|
19
|
+
limit: zod_1.z.string().regex(regex_constants_1.NUMERIC_STRING_REGEX).transform(Number).optional().default("20"),
|
|
19
20
|
userId: zod_1.z.string().uuid().optional(),
|
|
20
21
|
deviceId: zod_1.z.string().uuid().optional(),
|
|
21
22
|
status: zod_1.z.enum(vr_models_1.PAYMENT_PLAN_STATUS).optional(),
|
package/dist/validations/{admin.devices.validations.js → admin/admin.devices.validations.js}
RENAMED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.customDeviceResetSchema = exports.triggerDeviceResetSchema = exports.checkAvailabilitySchema = exports.makeDevicesPermanentSchema = exports.enableDevicesSchema = exports.disableDevicesSchema = exports.unlockDevicesSchema = exports.lockDevicesSchema = exports.permanentDeleteDevicesByPairsSchema = exports.deleteDevicesByPairsSchema = exports.getDevicesSchema = exports.getDeviceSchema = exports.createDevicePairsSchema = exports.deduplicatePairIds = exports.PAIR_ID_REGEX = void 0;
|
|
4
|
-
// src/validations/device.validations.ts
|
|
5
4
|
const zod_1 = require("zod");
|
|
6
5
|
const vr_models_1 = require("vr-models");
|
|
6
|
+
const regex_constants_1 = require("../../constants/regex.constants");
|
|
7
7
|
// ✅ Pair ID format: 2 letters + 3 numbers + 1 letter
|
|
8
8
|
// Example: AA001A, AB123B, XZ999Z
|
|
9
9
|
// No letter 'O' to avoid confusion with 0
|
|
10
|
-
exports.PAIR_ID_REGEX =
|
|
10
|
+
exports.PAIR_ID_REGEX = regex_constants_1.DEVICE_PAIR_ID_REGEX;
|
|
11
11
|
const PAIR_ID_ERROR = "Pair ID must be 6 characters: 2 letters (A-Z, excluding O) + 3 digits + 1 letter (A-Z, excluding O). Example: AA001A";
|
|
12
12
|
// ✅ Helper to remove duplicates and return unique pair IDs
|
|
13
13
|
const deduplicatePairIds = (pairIds) => {
|
|
@@ -43,8 +43,8 @@ exports.getDeviceSchema = zod_1.z.object({
|
|
|
43
43
|
// Get all devices schema (with pagination and filters)
|
|
44
44
|
exports.getDevicesSchema = zod_1.z.object({
|
|
45
45
|
query: zod_1.z.object({
|
|
46
|
-
page: zod_1.z.string().regex(
|
|
47
|
-
limit: zod_1.z.string().regex(
|
|
46
|
+
page: zod_1.z.string().regex(regex_constants_1.NUMERIC_STRING_REGEX).transform(Number).optional(),
|
|
47
|
+
limit: zod_1.z.string().regex(regex_constants_1.NUMERIC_STRING_REGEX).transform(Number).optional(),
|
|
48
48
|
// Filters
|
|
49
49
|
productId: zod_1.z.string().uuid().optional(),
|
|
50
50
|
status: zod_1.z.enum(vr_models_1.DEVICE_STATUS).optional(),
|
|
@@ -58,7 +58,6 @@ exports.getDevicesSchema = zod_1.z.object({
|
|
|
58
58
|
sortOrder: zod_1.z.enum(["ASC", "DESC"]).optional(),
|
|
59
59
|
}),
|
|
60
60
|
});
|
|
61
|
-
// src/validations/device.validations.ts
|
|
62
61
|
// ==================== DELETE SCHEMAS (PAIR ONLY) ====================
|
|
63
62
|
// Soft delete by pair IDs
|
|
64
63
|
exports.deleteDevicesByPairsSchema = zod_1.z.object({
|
package/dist/validations/{eventlogs.admin.validations.js → admin/admin.eventLogs.validations.js}
RENAMED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getEventLogSchema = exports.listEventLogsSchema = void 0;
|
|
4
|
-
// src/modules/event-logs/validations/eventLogs.validations.ts
|
|
5
4
|
const zod_1 = require("zod");
|
|
6
5
|
const vr_models_1 = require("vr-models");
|
|
6
|
+
const regex_constants_1 = require("../../constants/regex.constants");
|
|
7
7
|
// Base schemas
|
|
8
8
|
const uuidSchema = zod_1.z.string().uuid("Invalid UUID format");
|
|
9
9
|
// Date validator for filtering - keeps as string for query param validation
|
|
10
10
|
const dateValidator = zod_1.z
|
|
11
11
|
.string()
|
|
12
|
-
.regex(
|
|
12
|
+
.regex(regex_constants_1.ISO_DATE_REGEX, "Date must be in YYYY-MM-DD format");
|
|
13
13
|
// Convert readonly array to mutable tuple for zod enum
|
|
14
14
|
const eventActionsList = [...vr_models_1.EVENT_ACTIONS];
|
|
15
15
|
// ==================== GET ALL EVENT LOGS ====================
|
|
@@ -3,14 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.payInstallmentSchema = exports.getInstallmentByIdSchema = exports.getInstallmentsSchema = void 0;
|
|
4
4
|
const vr_models_1 = require("vr-models");
|
|
5
5
|
const zod_1 = require("zod");
|
|
6
|
-
const
|
|
6
|
+
const regex_constants_1 = require("../../constants/regex.constants");
|
|
7
|
+
const phoneRegex = regex_constants_1.PHONE_NUMBER_REGEX;
|
|
7
8
|
console.log("from vr-commons", vr_models_1.PAYMENT_PROVIDER);
|
|
8
9
|
exports.getInstallmentsSchema = zod_1.z.object({
|
|
9
10
|
query: zod_1.z.object({
|
|
10
11
|
planId: zod_1.z.string().uuid().optional(),
|
|
11
12
|
status: zod_1.z.enum([...vr_models_1.INSTALLMENT_STATUS]).optional(),
|
|
12
|
-
page: zod_1.z.string().regex(
|
|
13
|
-
limit: zod_1.z.string().regex(
|
|
13
|
+
page: zod_1.z.string().regex(regex_constants_1.NUMERIC_STRING_REGEX).transform(Number).optional(),
|
|
14
|
+
limit: zod_1.z.string().regex(regex_constants_1.NUMERIC_STRING_REGEX).transform(Number).optional(),
|
|
14
15
|
}),
|
|
15
16
|
});
|
|
16
17
|
exports.getInstallmentByIdSchema = zod_1.z.object({
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.deletePricingSchema = exports.getPricingsSchema = exports.getPricingSchema = exports.updatePricingSchema = exports.createPricingSchema = void 0;
|
|
4
|
-
// src/validations/pricing.validation.ts
|
|
5
4
|
const zod_1 = require("zod");
|
|
6
5
|
const vr_models_1 = require("vr-models");
|
|
6
|
+
const regex_constants_1 = require("../../constants/regex.constants");
|
|
7
7
|
// Base pricing schema
|
|
8
8
|
const pricingBaseSchema = {
|
|
9
9
|
productId: zod_1.z.string().uuid("Invalid product ID"),
|
|
@@ -334,13 +334,13 @@ exports.getPricingSchema = zod_1.z.object({
|
|
|
334
334
|
// Get all pricings schema
|
|
335
335
|
exports.getPricingsSchema = zod_1.z.object({
|
|
336
336
|
query: zod_1.z.object({
|
|
337
|
-
page: zod_1.z.string().regex(
|
|
338
|
-
limit: zod_1.z.string().regex(
|
|
337
|
+
page: zod_1.z.string().regex(regex_constants_1.NUMERIC_STRING_REGEX).transform(Number).optional(),
|
|
338
|
+
limit: zod_1.z.string().regex(regex_constants_1.NUMERIC_STRING_REGEX).transform(Number).optional(),
|
|
339
339
|
productId: zod_1.z.string().uuid().optional(),
|
|
340
340
|
type: zod_1.z.enum(vr_models_1.PRICING_TYPE).optional(),
|
|
341
341
|
isActive: zod_1.z.enum(["true", "false"]).optional(),
|
|
342
|
-
minAmount: zod_1.z.string().regex(
|
|
343
|
-
maxAmount: zod_1.z.string().regex(
|
|
342
|
+
minAmount: zod_1.z.string().regex(regex_constants_1.NUMERIC_STRING_REGEX).transform(Number).optional(),
|
|
343
|
+
maxAmount: zod_1.z.string().regex(regex_constants_1.NUMERIC_STRING_REGEX).transform(Number).optional(),
|
|
344
344
|
search: zod_1.z.string().optional(),
|
|
345
345
|
sortBy: zod_1.z
|
|
346
346
|
.enum(["name", "unitPrice", "createdAt", "updatedAt"]) // ✅ Changed from totalAmount
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateStockSchema = exports.deactivateProductSchema = exports.activateProductSchema = exports.deleteProductSchema = exports.getProductsSchema = exports.getProductSchema = exports.updateProductSchema = exports.createProductSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const regex_constants_1 = require("../../constants/regex.constants");
|
|
5
6
|
// Base product schema
|
|
6
7
|
const productBaseSchema = {
|
|
7
8
|
name: zod_1.z
|
|
@@ -42,11 +43,11 @@ exports.getProductSchema = zod_1.z.object({
|
|
|
42
43
|
// Get all products schema (with pagination and filters)
|
|
43
44
|
exports.getProductsSchema = zod_1.z.object({
|
|
44
45
|
query: zod_1.z.object({
|
|
45
|
-
page: zod_1.z.string().regex(
|
|
46
|
-
limit: zod_1.z.string().regex(
|
|
46
|
+
page: zod_1.z.string().regex(regex_constants_1.NUMERIC_STRING_REGEX).transform(Number).optional(),
|
|
47
|
+
limit: zod_1.z.string().regex(regex_constants_1.NUMERIC_STRING_REGEX).transform(Number).optional(),
|
|
47
48
|
search: zod_1.z.string().optional(),
|
|
48
49
|
isActive: zod_1.z.enum(["true", "false"]).optional(),
|
|
49
|
-
minStock: zod_1.z.string().regex(
|
|
50
|
+
minStock: zod_1.z.string().regex(regex_constants_1.NUMERIC_STRING_REGEX).transform(Number).optional(),
|
|
50
51
|
sortBy: zod_1.z.enum(["name", "stock", "createdAt", "updatedAt"]).optional(),
|
|
51
52
|
sortOrder: zod_1.z.enum(["ASC", "DESC"]).optional(),
|
|
52
53
|
}),
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setUserPrimaryContactSchema = exports.deleteUserContactSchema = exports.verifyUserContactSchema = exports.addUserContactSchema = exports.bulkResetPasswordsSchema = 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
4
|
const zod_1 = require("zod");
|
|
6
|
-
const
|
|
7
|
-
const
|
|
5
|
+
const shared_auth_validations_1 = require("../shared/shared.auth.validations");
|
|
6
|
+
const shared_profiles_validations_1 = require("../shared/shared.profiles.validations");
|
|
7
|
+
const regex_constants_1 = require("../../constants/regex.constants");
|
|
8
8
|
// Birth date validation helpers
|
|
9
9
|
const isValidBirthDate = (date, month, year) => {
|
|
10
10
|
const maxDays = new Date(year, month, 0).getDate();
|
|
@@ -20,11 +20,11 @@ exports.upgradeToRiderSchema = zod_1.z.object({
|
|
|
20
20
|
}),
|
|
21
21
|
body: zod_1.z
|
|
22
22
|
.object({
|
|
23
|
-
jacketId: zod_1.z.string().regex(
|
|
23
|
+
jacketId: zod_1.z.string().regex(shared_profiles_validations_1.jacketIdRegex, "Invalid jacket ID format"),
|
|
24
24
|
contactValue: zod_1.z
|
|
25
25
|
.string()
|
|
26
26
|
.min(1, "Phone number is required")
|
|
27
|
-
.regex(
|
|
27
|
+
.regex(shared_auth_validations_1.phoneRegex, "Invalid phone number format. Must be a valid Rwandan phone number (+250...) followed by 7 digits"),
|
|
28
28
|
plateNumber: zod_1.z.string().min(6).max(6).optional(),
|
|
29
29
|
gender: zod_1.z.enum(["male", "female"], {
|
|
30
30
|
errorMap: () => ({
|
|
@@ -53,13 +53,13 @@ exports.updateRiderSchema = zod_1.z.object({
|
|
|
53
53
|
lastName: zod_1.z.string().min(2).max(100).optional(),
|
|
54
54
|
contactValue: zod_1.z
|
|
55
55
|
.string()
|
|
56
|
-
.refine((val) => (0,
|
|
56
|
+
.refine((val) => (0, shared_auth_validations_1.validateContactValue)(val), {
|
|
57
57
|
message: "Invalid contact value. Must be a valid email or Rwandan phone number (+250...)",
|
|
58
58
|
})
|
|
59
59
|
.optional(),
|
|
60
60
|
jacketId: zod_1.z
|
|
61
61
|
.string()
|
|
62
|
-
.regex(
|
|
62
|
+
.regex(shared_profiles_validations_1.jacketIdRegex, "Invalid jacket ID format")
|
|
63
63
|
.optional(),
|
|
64
64
|
plateNumber: zod_1.z.string().min(3).max(10).optional(),
|
|
65
65
|
gender: zod_1.z.enum(["male", "female"]).optional(),
|
|
@@ -102,8 +102,8 @@ exports.getUserSchema = zod_1.z.object({
|
|
|
102
102
|
// Get All Users (with pagination)
|
|
103
103
|
exports.getUsersSchema = zod_1.z.object({
|
|
104
104
|
query: zod_1.z.object({
|
|
105
|
-
page: zod_1.z.string().regex(
|
|
106
|
-
limit: zod_1.z.string().regex(
|
|
105
|
+
page: zod_1.z.string().regex(regex_constants_1.NUMERIC_STRING_REGEX).transform(Number).optional(),
|
|
106
|
+
limit: zod_1.z.string().regex(regex_constants_1.NUMERIC_STRING_REGEX).transform(Number).optional(),
|
|
107
107
|
search: zod_1.z.string().optional(),
|
|
108
108
|
isActive: zod_1.z.enum(["true", "false"]).optional(),
|
|
109
109
|
isDeactivated: zod_1.z.enum(["true", "false"]).optional(),
|
|
@@ -124,7 +124,7 @@ exports.hireAdminSchema = zod_1.z.object({
|
|
|
124
124
|
contactValue: zod_1.z
|
|
125
125
|
.string()
|
|
126
126
|
.min(1, "Email or phone number is required")
|
|
127
|
-
.refine((val) => (0,
|
|
127
|
+
.refine((val) => (0, shared_auth_validations_1.validateContactValue)(val), {
|
|
128
128
|
message: "Invalid contact value. Must be a valid email or Rwandan phone number (+250...)",
|
|
129
129
|
}),
|
|
130
130
|
firstName: zod_1.z.string().min(2).max(100),
|
|
@@ -196,7 +196,7 @@ exports.updateAdminSchema = zod_1.z.object({
|
|
|
196
196
|
lastName: zod_1.z.string().min(2).max(100).optional(),
|
|
197
197
|
contactValue: zod_1.z
|
|
198
198
|
.string()
|
|
199
|
-
.refine((val) => (0,
|
|
199
|
+
.refine((val) => (0, shared_auth_validations_1.validateContactValue)(val), {
|
|
200
200
|
message: "Invalid contact value. Must be a valid email or Rwandan phone number (+250...)",
|
|
201
201
|
})
|
|
202
202
|
.optional(),
|
|
@@ -238,7 +238,7 @@ exports.bulkResetPasswordsSchema = zod_1.z.object({
|
|
|
238
238
|
allUsers: zod_1.z.boolean().optional(),
|
|
239
239
|
}),
|
|
240
240
|
headers: zod_1.z.object({
|
|
241
|
-
authorization: zod_1.z.string().regex(
|
|
241
|
+
authorization: zod_1.z.string().regex(regex_constants_1.BEARER_TOKEN_PREFIX_REGEX, {
|
|
242
242
|
message: "Authorization header must start with 'Bearer '",
|
|
243
243
|
}),
|
|
244
244
|
}),
|
|
@@ -255,7 +255,7 @@ exports.addUserContactSchema = zod_1.z.object({
|
|
|
255
255
|
contactValue: zod_1.z
|
|
256
256
|
.string()
|
|
257
257
|
.min(1, "Email or phone number is required")
|
|
258
|
-
.refine((val) => (0,
|
|
258
|
+
.refine((val) => (0, shared_auth_validations_1.validateContactValue)(val), {
|
|
259
259
|
message: "Invalid contact value. Must be a valid email or Rwandan phone number (+250...)",
|
|
260
260
|
}),
|
|
261
261
|
type: zod_1.z.enum(["EMAIL", "PHONE", "WHATSAPP"]).optional(),
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
export
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
1
|
+
export * from "../constants/regex.constants";
|
|
2
|
+
export { validate } from "./shared/shared.validate.validations";
|
|
3
|
+
export { riderLoginSchema, forgotPasswordSchema, userLoginSchema, refreshTokenSchema, registerSchema, verifyOtpSchema, resendOtpSchema, requestOtpSchema, phoneRegex, emailRegex, passwordRegex, riderPasswordRegex, setRiderPasswordSchema, checkRiderAccountSchema, completePassengerProfileSchema, googleLoginSchema, } from "./shared/shared.auth.validations";
|
|
4
|
+
export { createUserSchema, getUserByIdSchema, updateUserProfileSchema, getAllUsersSchema, viewProfileSchema, passengerSignupSchema, updatePassengerProfileSchema, updateRiderProfileSchema, createRiderSchema, deactivateAccountSchema, } from "./shared/shared.profiles.validations";
|
|
5
|
+
export { submitBanAppealSchema, submitSuspensionAppealSchema, getBanSchema, getUserRestrictionsSchema, getSuspensionSchema, getUserSuspensionsSchema, getUserBansSchema, listBansSchema, listPendingAppealsSchema, listSuspensionsSchema, reviewAppealSchema, revokeBanSchema, revokeSuspensionSchema, extendSuspensionSchema, createBanSchema, createSuspensionSchema, exportBansSchema, } from "./shared/shared.moderation.validations";
|
|
6
|
+
export { createAppSpecsSchema, updateAppSpecsSchema, listAppSpecsSchema, getActiveAppSpecsSchema, getAppSpecsByNameSchema, activateAppSpecsSchema, getAppSpecsSchema, } from "./shared/shared.appSpecs.validations";
|
|
7
|
+
export { updateProfileSchema, requestPhoneChangeSchema, verifyPhoneChangeSchema, deleteAccountSchema, strongPasswordRegex, changePasswordSchema, riderPasswordSchema, registerRiderSchema, } from "./shared/shared.account.validations";
|
|
8
|
+
export { listUserPaymentPlansSchema, getUserPaymentPlanSchema, } from "./users/users.devicePaymentPlans.validations";
|
|
9
|
+
export { unlockDeviceSchema, extendSessionSchema, serialRegex, } from "./users/users.devices.validations";
|
|
10
|
+
export { payInstallmentSchema, getInstallmentByIdSchema, getInstallmentsSchema, } from "./admin/admin.installments.validations";
|
|
11
|
+
export { updateAdminSchema, updateRiderSchema, deleteUserSchema, getUserSchema, getUsersSchema, hireAdminSchema, promoteAdminSchema, demoteAdminSchema, fireEmployeeSchema, upgradeToRiderSchema, resetPasswordSchema, } from "./admin/admin.users.validations";
|
|
12
|
+
export { createProductSchema, updateProductSchema, getProductSchema, getProductsSchema, deactivateProductSchema, activateProductSchema, deleteProductSchema, updateStockSchema, } from "./admin/admin.products.validations";
|
|
13
|
+
export { createPricingSchema, updatePricingSchema, getPricingSchema, getPricingsSchema, deletePricingSchema, } from "./admin/admin.pricings.validations";
|
|
14
|
+
export { checkAvailabilitySchema, createDevicePairsSchema, lockDevicesSchema, unlockDevicesSchema, deleteDevicesByPairsSchema, makeDevicesPermanentSchema, permanentDeleteDevicesByPairsSchema, disableDevicesSchema, enableDevicesSchema, getDeviceSchema, getDevicesSchema, triggerDeviceResetSchema, customDeviceResetSchema, } from "./admin/admin.devices.validations";
|
|
15
|
+
export { createPlanSchema, limitedUpdateSchema, getDevicePlanSchema, getPlanSchema, getUserPlansSchema, listPlansSchema, recordPaymentSchema, deletePlanSchema, } from "./admin/admin.devicePayments.validations";
|
|
16
|
+
export { listEventLogsSchema, getEventLogSchema, } from "./admin/admin.eventLogs.validations";
|