vr-commons 1.0.176 → 1.0.178
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.d.ts → admin/admin.devicePayments.utils.d.ts} +2 -1
- package/dist/utils/{admin.devicePayment.utils.js → admin/admin.devicePayments.utils.js} +13 -10
- 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} +5 -4
- package/dist/validations/{admin.devicePayment.validations.d.ts → admin/admin.devicePayments.validations.d.ts} +59 -59
- package/dist/validations/{admin.devicePayment.validations.js → admin/admin.devicePayments.validations.js} +4 -3
- package/dist/validations/{admin.devices.validations.d.ts → admin/admin.devices.validations.d.ts} +22 -22
- package/dist/validations/{admin.devices.validations.js → admin/admin.devices.validations.js} +4 -5
- package/dist/validations/{eventlogs.admin.validations.d.ts → admin/admin.eventLogs.validations.d.ts} +14 -14
- 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} +5 -4
- package/dist/validations/{pricings.validations.d.ts → admin/admin.pricings.validations.d.ts} +60 -60
- package/dist/validations/{pricings.validations.js → admin/admin.pricings.validations.js} +5 -5
- package/dist/validations/{product.validations.d.ts → admin/admin.products.validations.d.ts} +32 -32
- package/dist/validations/{product.validations.js → admin/admin.products.validations.js} +4 -3
- package/dist/validations/{users.admin.validations.d.ts → admin/admin.users.validations.d.ts} +44 -44
- 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.d.ts → shared/shared.appSpecs.validations.d.ts} +14 -14
- 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.d.ts → shared/shared.moderation.validations.d.ts} +111 -111
- package/dist/validations/{moderation.validations.js → shared/shared.moderation.validations.js} +24 -25
- package/dist/validations/{profiles.validations.d.ts → shared/shared.profiles.validations.d.ts} +36 -36
- package/dist/validations/{profiles.validations.js → shared/shared.profiles.validations.js} +22 -21
- package/dist/validations/{devicePaymentPlan.validations.d.ts → users/users.devicePaymentPlans.validations.d.ts} +16 -16
- 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/{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} +8 -8
- package/dist/validations/{bans.validations.js → admin/admin.bans.validations.js} +0 -0
- package/dist/validations/{admin.installment.validations.d.ts → admin/admin.installments.validations.d.ts} +16 -16
- package/dist/validations/{suspensions.validations.d.ts → admin/admin.suspensions.validations.d.ts} +8 -8
- /package/dist/validations/{suspensions.validations.js → admin/admin.suspensions.validations.js} +0 -0
- /package/dist/validations/{account.validations.d.ts → shared/shared.account.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/{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.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)
|
|
@@ -82,7 +83,7 @@ const sendSMS = async (phoneNumber, message) => {
|
|
|
82
83
|
// from: fromNumber,
|
|
83
84
|
// to: phoneNumber,
|
|
84
85
|
// });
|
|
85
|
-
|
|
86
|
+
// Verification codes and full contact details must never be written to logs.
|
|
86
87
|
return true;
|
|
87
88
|
}
|
|
88
89
|
catch (error) {
|
|
@@ -110,7 +111,7 @@ const sendEmail = async (to, subject, html) => {
|
|
|
110
111
|
subject,
|
|
111
112
|
html,
|
|
112
113
|
});
|
|
113
|
-
console.log(
|
|
114
|
+
console.log("Verification email sent");
|
|
114
115
|
return true;
|
|
115
116
|
}
|
|
116
117
|
catch (error) {
|
|
@@ -6,24 +6,24 @@ export declare const createPlanSchema: z.ZodObject<{
|
|
|
6
6
|
productId: z.ZodString;
|
|
7
7
|
}, "strip", z.ZodTypeAny, {
|
|
8
8
|
userId: string;
|
|
9
|
-
productId: string;
|
|
10
9
|
pricingId: string;
|
|
10
|
+
productId: string;
|
|
11
11
|
}, {
|
|
12
12
|
userId: string;
|
|
13
|
-
productId: string;
|
|
14
13
|
pricingId: string;
|
|
14
|
+
productId: string;
|
|
15
15
|
}>;
|
|
16
16
|
}, "strip", z.ZodTypeAny, {
|
|
17
17
|
body: {
|
|
18
18
|
userId: string;
|
|
19
|
-
productId: string;
|
|
20
19
|
pricingId: string;
|
|
20
|
+
productId: string;
|
|
21
21
|
};
|
|
22
22
|
}, {
|
|
23
23
|
body: {
|
|
24
24
|
userId: string;
|
|
25
|
-
productId: string;
|
|
26
25
|
pricingId: string;
|
|
26
|
+
productId: string;
|
|
27
27
|
};
|
|
28
28
|
}>;
|
|
29
29
|
export declare const listPlansSchema: z.ZodObject<{
|
|
@@ -38,49 +38,49 @@ export declare const listPlansSchema: z.ZodObject<{
|
|
|
38
38
|
sortBy: z.ZodOptional<z.ZodEnum<["createdAt", "updatedAt", "nextInstallmentDueAt", "paidAmount", "outstandingAmount"]>>;
|
|
39
39
|
sortOrder: z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>;
|
|
40
40
|
}, "strip", z.ZodTypeAny, {
|
|
41
|
-
limit: number;
|
|
42
41
|
page: number;
|
|
43
|
-
|
|
42
|
+
limit: number;
|
|
43
|
+
status?: "PENDING" | "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
|
|
44
44
|
userId?: string | undefined;
|
|
45
|
-
status?: "ACTIVE" | "DEFAULTED" | "PENDING" | "COMPLETED" | "CANCELLED" | undefined;
|
|
46
|
-
isOverdue?: "true" | "false" | undefined;
|
|
47
|
-
sortBy?: "createdAt" | "updatedAt" | "paidAmount" | "outstandingAmount" | "nextInstallmentDueAt" | undefined;
|
|
48
|
-
sortOrder?: "DESC" | "ASC" | undefined;
|
|
49
45
|
deviceId?: string | undefined;
|
|
50
|
-
|
|
46
|
+
isOverdue?: "true" | "false" | undefined;
|
|
51
47
|
search?: string | undefined;
|
|
48
|
+
sortBy?: "createdAt" | "updatedAt" | "nextInstallmentDueAt" | "paidAmount" | "outstandingAmount" | undefined;
|
|
49
|
+
sortOrder?: "ASC" | "DESC" | undefined;
|
|
50
|
+
}, {
|
|
51
|
+
status?: "PENDING" | "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
|
|
52
|
+
page?: string | undefined;
|
|
52
53
|
limit?: string | undefined;
|
|
53
54
|
userId?: string | undefined;
|
|
54
|
-
status?: "ACTIVE" | "DEFAULTED" | "PENDING" | "COMPLETED" | "CANCELLED" | undefined;
|
|
55
|
-
isOverdue?: "true" | "false" | undefined;
|
|
56
|
-
page?: string | undefined;
|
|
57
|
-
sortBy?: "createdAt" | "updatedAt" | "paidAmount" | "outstandingAmount" | "nextInstallmentDueAt" | undefined;
|
|
58
|
-
sortOrder?: "DESC" | "ASC" | undefined;
|
|
59
55
|
deviceId?: string | undefined;
|
|
56
|
+
isOverdue?: "true" | "false" | undefined;
|
|
57
|
+
search?: string | undefined;
|
|
58
|
+
sortBy?: "createdAt" | "updatedAt" | "nextInstallmentDueAt" | "paidAmount" | "outstandingAmount" | undefined;
|
|
59
|
+
sortOrder?: "ASC" | "DESC" | undefined;
|
|
60
60
|
}>;
|
|
61
61
|
}, "strip", z.ZodTypeAny, {
|
|
62
62
|
query: {
|
|
63
|
-
limit: number;
|
|
64
63
|
page: number;
|
|
65
|
-
|
|
64
|
+
limit: number;
|
|
65
|
+
status?: "PENDING" | "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
|
|
66
66
|
userId?: string | undefined;
|
|
67
|
-
status?: "ACTIVE" | "DEFAULTED" | "PENDING" | "COMPLETED" | "CANCELLED" | undefined;
|
|
68
|
-
isOverdue?: "true" | "false" | undefined;
|
|
69
|
-
sortBy?: "createdAt" | "updatedAt" | "paidAmount" | "outstandingAmount" | "nextInstallmentDueAt" | undefined;
|
|
70
|
-
sortOrder?: "DESC" | "ASC" | undefined;
|
|
71
67
|
deviceId?: string | undefined;
|
|
68
|
+
isOverdue?: "true" | "false" | undefined;
|
|
69
|
+
search?: string | undefined;
|
|
70
|
+
sortBy?: "createdAt" | "updatedAt" | "nextInstallmentDueAt" | "paidAmount" | "outstandingAmount" | undefined;
|
|
71
|
+
sortOrder?: "ASC" | "DESC" | undefined;
|
|
72
72
|
};
|
|
73
73
|
}, {
|
|
74
74
|
query: {
|
|
75
|
-
|
|
75
|
+
status?: "PENDING" | "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
|
|
76
|
+
page?: string | undefined;
|
|
76
77
|
limit?: string | undefined;
|
|
77
78
|
userId?: string | undefined;
|
|
78
|
-
status?: "ACTIVE" | "DEFAULTED" | "PENDING" | "COMPLETED" | "CANCELLED" | undefined;
|
|
79
|
-
isOverdue?: "true" | "false" | undefined;
|
|
80
|
-
page?: string | undefined;
|
|
81
|
-
sortBy?: "createdAt" | "updatedAt" | "paidAmount" | "outstandingAmount" | "nextInstallmentDueAt" | undefined;
|
|
82
|
-
sortOrder?: "DESC" | "ASC" | undefined;
|
|
83
79
|
deviceId?: string | undefined;
|
|
80
|
+
isOverdue?: "true" | "false" | undefined;
|
|
81
|
+
search?: string | undefined;
|
|
82
|
+
sortBy?: "createdAt" | "updatedAt" | "nextInstallmentDueAt" | "paidAmount" | "outstandingAmount" | undefined;
|
|
83
|
+
sortOrder?: "ASC" | "DESC" | undefined;
|
|
84
84
|
};
|
|
85
85
|
}>;
|
|
86
86
|
export declare const getPlanSchema: z.ZodObject<{
|
|
@@ -112,10 +112,10 @@ export declare const getUserPlansSchema: z.ZodObject<{
|
|
|
112
112
|
status: z.ZodOptional<z.ZodEnum<["PENDING", "ACTIVE", "COMPLETED", "DEFAULTED", "CANCELLED"]>>;
|
|
113
113
|
includeCompleted: z.ZodOptional<z.ZodEnum<["true", "false"]>>;
|
|
114
114
|
}, "strip", z.ZodTypeAny, {
|
|
115
|
-
status?: "
|
|
115
|
+
status?: "PENDING" | "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
|
|
116
116
|
includeCompleted?: "true" | "false" | undefined;
|
|
117
117
|
}, {
|
|
118
|
-
status?: "
|
|
118
|
+
status?: "PENDING" | "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
|
|
119
119
|
includeCompleted?: "true" | "false" | undefined;
|
|
120
120
|
}>>;
|
|
121
121
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -123,7 +123,7 @@ export declare const getUserPlansSchema: z.ZodObject<{
|
|
|
123
123
|
userId: string;
|
|
124
124
|
};
|
|
125
125
|
query?: {
|
|
126
|
-
status?: "
|
|
126
|
+
status?: "PENDING" | "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
|
|
127
127
|
includeCompleted?: "true" | "false" | undefined;
|
|
128
128
|
} | undefined;
|
|
129
129
|
}, {
|
|
@@ -131,7 +131,7 @@ export declare const getUserPlansSchema: z.ZodObject<{
|
|
|
131
131
|
userId: string;
|
|
132
132
|
};
|
|
133
133
|
query?: {
|
|
134
|
-
status?: "
|
|
134
|
+
status?: "PENDING" | "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
|
|
135
135
|
includeCompleted?: "true" | "false" | undefined;
|
|
136
136
|
} | undefined;
|
|
137
137
|
}>;
|
|
@@ -166,38 +166,38 @@ export declare const limitedUpdateSchema: z.ZodObject<{
|
|
|
166
166
|
userId: z.ZodOptional<z.ZodString>;
|
|
167
167
|
}, "strip", z.ZodTypeAny, {
|
|
168
168
|
userId?: string | undefined;
|
|
169
|
-
productId?: string | undefined;
|
|
170
169
|
pricingId?: string | undefined;
|
|
170
|
+
productId?: string | undefined;
|
|
171
171
|
}, {
|
|
172
172
|
userId?: string | undefined;
|
|
173
|
-
productId?: string | undefined;
|
|
174
173
|
pricingId?: string | undefined;
|
|
174
|
+
productId?: string | undefined;
|
|
175
175
|
}>, {
|
|
176
176
|
userId?: string | undefined;
|
|
177
|
-
productId?: string | undefined;
|
|
178
177
|
pricingId?: string | undefined;
|
|
178
|
+
productId?: string | undefined;
|
|
179
179
|
}, {
|
|
180
180
|
userId?: string | undefined;
|
|
181
|
-
productId?: string | undefined;
|
|
182
181
|
pricingId?: string | undefined;
|
|
182
|
+
productId?: string | undefined;
|
|
183
183
|
}>;
|
|
184
184
|
}, "strip", z.ZodTypeAny, {
|
|
185
|
+
params: {
|
|
186
|
+
id: string;
|
|
187
|
+
};
|
|
185
188
|
body: {
|
|
186
189
|
userId?: string | undefined;
|
|
187
|
-
productId?: string | undefined;
|
|
188
190
|
pricingId?: string | undefined;
|
|
191
|
+
productId?: string | undefined;
|
|
189
192
|
};
|
|
193
|
+
}, {
|
|
190
194
|
params: {
|
|
191
195
|
id: string;
|
|
192
196
|
};
|
|
193
|
-
}, {
|
|
194
197
|
body: {
|
|
195
198
|
userId?: string | undefined;
|
|
196
|
-
productId?: string | undefined;
|
|
197
199
|
pricingId?: string | undefined;
|
|
198
|
-
|
|
199
|
-
params: {
|
|
200
|
-
id: string;
|
|
200
|
+
productId?: string | undefined;
|
|
201
201
|
};
|
|
202
202
|
}>;
|
|
203
203
|
export declare const recordPaymentSchema: z.ZodObject<{
|
|
@@ -211,7 +211,7 @@ export declare const recordPaymentSchema: z.ZodObject<{
|
|
|
211
211
|
body: z.ZodObject<{
|
|
212
212
|
amount: z.ZodNumber;
|
|
213
213
|
provider: z.ZodDefault<z.ZodEnum<["AIRTEL_MONEY", "CASH", "MOMO_PAY"]>>;
|
|
214
|
-
providerReference: z.
|
|
214
|
+
providerReference: z.ZodString;
|
|
215
215
|
customerPhone: z.ZodOptional<z.ZodString>;
|
|
216
216
|
customerName: z.ZodOptional<z.ZodString>;
|
|
217
217
|
notes: z.ZodOptional<z.ZodString>;
|
|
@@ -219,45 +219,45 @@ export declare const recordPaymentSchema: z.ZodObject<{
|
|
|
219
219
|
}, "strip", z.ZodTypeAny, {
|
|
220
220
|
amount: number;
|
|
221
221
|
provider: "AIRTEL_MONEY" | "CASH" | "MOMO_PAY";
|
|
222
|
-
|
|
223
|
-
providerReference?: string | undefined;
|
|
222
|
+
providerReference: string;
|
|
224
223
|
customerPhone?: string | undefined;
|
|
225
|
-
customerName?: string | undefined;
|
|
226
224
|
notes?: string | undefined;
|
|
225
|
+
metadata?: Record<string, any> | undefined;
|
|
226
|
+
customerName?: string | undefined;
|
|
227
227
|
}, {
|
|
228
228
|
amount: number;
|
|
229
|
-
|
|
229
|
+
providerReference: string;
|
|
230
230
|
provider?: "AIRTEL_MONEY" | "CASH" | "MOMO_PAY" | undefined;
|
|
231
|
-
providerReference?: string | undefined;
|
|
232
231
|
customerPhone?: string | undefined;
|
|
233
|
-
customerName?: string | undefined;
|
|
234
232
|
notes?: string | undefined;
|
|
233
|
+
metadata?: Record<string, any> | undefined;
|
|
234
|
+
customerName?: string | undefined;
|
|
235
235
|
}>;
|
|
236
236
|
}, "strip", z.ZodTypeAny, {
|
|
237
|
+
params: {
|
|
238
|
+
id: string;
|
|
239
|
+
};
|
|
237
240
|
body: {
|
|
238
241
|
amount: number;
|
|
239
242
|
provider: "AIRTEL_MONEY" | "CASH" | "MOMO_PAY";
|
|
240
|
-
|
|
241
|
-
providerReference?: string | undefined;
|
|
243
|
+
providerReference: string;
|
|
242
244
|
customerPhone?: string | undefined;
|
|
243
|
-
customerName?: string | undefined;
|
|
244
245
|
notes?: string | undefined;
|
|
246
|
+
metadata?: Record<string, any> | undefined;
|
|
247
|
+
customerName?: string | undefined;
|
|
245
248
|
};
|
|
249
|
+
}, {
|
|
246
250
|
params: {
|
|
247
251
|
id: string;
|
|
248
252
|
};
|
|
249
|
-
}, {
|
|
250
253
|
body: {
|
|
251
254
|
amount: number;
|
|
252
|
-
|
|
255
|
+
providerReference: string;
|
|
253
256
|
provider?: "AIRTEL_MONEY" | "CASH" | "MOMO_PAY" | undefined;
|
|
254
|
-
providerReference?: string | undefined;
|
|
255
257
|
customerPhone?: string | undefined;
|
|
256
|
-
customerName?: string | undefined;
|
|
257
258
|
notes?: string | undefined;
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
id: string;
|
|
259
|
+
metadata?: Record<string, any> | undefined;
|
|
260
|
+
customerName?: string | undefined;
|
|
261
261
|
};
|
|
262
262
|
}>;
|
|
263
263
|
export declare const deletePlanSchema: z.ZodObject<{
|
|
@@ -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(),
|
|
@@ -78,7 +79,7 @@ exports.recordPaymentSchema = zod_1.z.object({
|
|
|
78
79
|
body: zod_1.z.object({
|
|
79
80
|
amount: zod_1.z.number().min(0.01, "Amount must be greater than 0"),
|
|
80
81
|
provider: zod_1.z.enum(vr_models_1.PAYMENT_PROVIDER).default("MOMO_PAY"),
|
|
81
|
-
providerReference: zod_1.z.string().
|
|
82
|
+
providerReference: zod_1.z.string().trim().min(1).max(255),
|
|
82
83
|
customerPhone: zod_1.z
|
|
83
84
|
.string()
|
|
84
85
|
.regex(/^\+?250[0-9]{9}$/, "Invalid MTN Rwanda phone number")
|