vr-commons 1.0.172 → 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.d.ts → shared/shared.appSpecs.validations.d.ts} +30 -100
- package/dist/validations/{appSpecs.validations.js → shared/shared.appSpecs.validations.js} +3 -7
- 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 +2 -2
- 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/{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
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getAppSpecsByNameSchema = exports.getActiveAppSpecsSchema = exports.activateAppSpecsSchema = exports.getAppSpecsSchema = exports.listAppSpecsSchema = exports.updateAppSpecsSchema = exports.createAppSpecsSchema = void 0;
|
|
4
|
-
// src/validations/appSpecs.validations.ts
|
|
5
4
|
const zod_1 = require("zod");
|
|
6
5
|
const urlRegex = /^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/;
|
|
7
6
|
const optionalUrl = zod_1.z.preprocess((value) => typeof value === "string" && value.trim() === "" ? null : value, zod_1.z.string().url().nullable().optional());
|
|
@@ -15,13 +14,10 @@ const appSpecsBaseSchema = {
|
|
|
15
14
|
appSupportedLanguages: zod_1.z
|
|
16
15
|
.array(zod_1.z.string().min(2).max(10))
|
|
17
16
|
.default(["en", "fr"]),
|
|
17
|
+
developmentBaseUrl: zod_1.z.string().url(),
|
|
18
|
+
stagingBaseUrl: zod_1.z.string().url(),
|
|
19
|
+
productionBaseUrl: zod_1.z.string().url(),
|
|
18
20
|
runtimeConfig: zod_1.z.object({
|
|
19
|
-
apiBaseUrl: zod_1.z.string().url().optional(),
|
|
20
|
-
apiBaseUrls: zod_1.z.object({
|
|
21
|
-
production: zod_1.z.string().url().optional(),
|
|
22
|
-
staging: zod_1.z.string().url().optional(),
|
|
23
|
-
develop: zod_1.z.string().url().optional(),
|
|
24
|
-
}).optional(),
|
|
25
21
|
googleWebClientId: zod_1.z.string().max(255).optional(),
|
|
26
22
|
speedGovernor: zod_1.z.object({
|
|
27
23
|
isActive: zod_1.z.boolean(),
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addContactSchema = exports.updateContactSchema = exports.createUserSchema = exports.completePassengerProfileSchema = exports.googleLoginSchema = exports.resendOtpSchema = exports.verifyOtpSchema = exports.requestOtpSchema = exports.riderLoginSchema = exports.setRiderPasswordSchema = exports.checkRiderAccountSchema = exports.riderPasswordRegex = exports.registerSchema = exports.refreshTokenSchema = exports.changePasswordSchema = exports.forgotPasswordSchema = exports.userLoginSchema = exports.validateContactValue = exports.detectContactType = exports.strongPasswordRegex = exports.passwordRegex = exports.emailRegex = exports.phoneRegex = void 0;
|
|
4
|
-
// src/validations/auth.schema.ts
|
|
5
4
|
const zod_1 = require("zod");
|
|
5
|
+
const regex_constants_1 = require("../../constants/regex.constants");
|
|
6
6
|
// ==================== REGEX PATTERNS ====================
|
|
7
|
-
exports.phoneRegex =
|
|
8
|
-
exports.emailRegex =
|
|
9
|
-
exports.passwordRegex =
|
|
10
|
-
exports.strongPasswordRegex =
|
|
7
|
+
exports.phoneRegex = regex_constants_1.PHONE_NUMBER_REGEX;
|
|
8
|
+
exports.emailRegex = regex_constants_1.EMAIL_ADDRESS_REGEX;
|
|
9
|
+
exports.passwordRegex = regex_constants_1.PASSWORD_REGEX;
|
|
10
|
+
exports.strongPasswordRegex = regex_constants_1.STRONG_PASSWORD_REGEX;
|
|
11
11
|
// ==================== CONTACT VALIDATION HELPERS ====================
|
|
12
12
|
const detectContactType = (value) => {
|
|
13
13
|
if (!value)
|
|
@@ -97,7 +97,7 @@ exports.registerSchema = zod_1.z.object({
|
|
|
97
97
|
});
|
|
98
98
|
// ==================== USER (RIDER/PASSENGER) AUTH VALIDATIONS ====================
|
|
99
99
|
// Rider login with contact
|
|
100
|
-
exports.riderPasswordRegex =
|
|
100
|
+
exports.riderPasswordRegex = regex_constants_1.RIDER_PIN_REGEX;
|
|
101
101
|
exports.checkRiderAccountSchema = zod_1.z.object({
|
|
102
102
|
body: zod_1.z.object({
|
|
103
103
|
phoneNumber: zod_1.z
|
package/dist/validations/{dateRange.validations.js → shared/shared.dateRanges.validations.js}
RENAMED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ddMmYyyySchema = exports.yyyyMmDdSchema = exports.dateRangeSchema = exports.createDateSchema = exports.normalizeDate = exports.dateValidator = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const regex_constants_1 = require("../../constants/regex.constants");
|
|
5
6
|
// Regular expressions for date formats
|
|
6
|
-
const YYYY_MM_DD_REGEX =
|
|
7
|
-
const DD_MM_YYYY_REGEX =
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const YYYY_MM_DD_SLASH_REGEX = /^\d{4}\/\d{2}\/\d{2}$/;
|
|
7
|
+
const YYYY_MM_DD_REGEX = regex_constants_1.ISO_DATE_REGEX;
|
|
8
|
+
const DD_MM_YYYY_REGEX = regex_constants_1.DAY_MONTH_YEAR_REGEX;
|
|
9
|
+
const DD_MM_YYYY_SLASH_REGEX = regex_constants_1.DAY_MONTH_YEAR_SLASH_REGEX;
|
|
10
|
+
const YYYY_MM_DD_SLASH_REGEX = regex_constants_1.ISO_DATE_SLASH_REGEX;
|
|
11
11
|
/**
|
|
12
12
|
* Validates if a string is a valid date in any of the supported formats
|
|
13
13
|
* Supported formats:
|
package/dist/validations/{moderation.validations.js → shared/shared.moderation.validations.js}
RENAMED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.exportSuspensionsSchema = exports.exportBansSchema = exports.reviewAppealSchema = exports.extendSuspensionSchema = exports.revokeSuspensionSchema = exports.revokeBanSchema = exports.listPendingAppealsSchema = exports.listSuspensionsSchema = exports.listBansSchema = exports.createSuspensionSchema = exports.createBanSchema = exports.submitSuspensionAppealSchema = exports.submitBanAppealSchema = exports.getUserSuspensionsSchema = exports.getUserBansSchema = exports.getUserRestrictionsSchema = exports.getSuspensionSchema = exports.getBanSchema = void 0;
|
|
4
|
-
// src/validations/moderation.validations.ts
|
|
5
4
|
const zod_1 = require("zod");
|
|
6
|
-
const
|
|
5
|
+
const shared_dateRanges_validations_1 = require("./shared.dateRanges.validations");
|
|
7
6
|
const uuidSchema = zod_1.z.string().uuid("Invalid UUID format");
|
|
8
7
|
// ==================== BASE SCHEMAS ====================
|
|
9
8
|
const paginationSchema = zod_1.z.object({
|
|
@@ -123,18 +122,18 @@ exports.listBansSchema = zod_1.z.object({
|
|
|
123
122
|
status: zod_1.z.enum(["active", "revoked"]).optional(),
|
|
124
123
|
appealStatus: zod_1.z.enum(["pending", "approved", "rejected"]).optional(),
|
|
125
124
|
isPermanent: zod_1.z.enum(["true", "false"]).optional(),
|
|
126
|
-
fromDate:
|
|
127
|
-
toDate:
|
|
125
|
+
fromDate: shared_dateRanges_validations_1.dateValidator.optional(),
|
|
126
|
+
toDate: shared_dateRanges_validations_1.dateValidator.optional(),
|
|
128
127
|
search: zod_1.z.string().optional(),
|
|
129
128
|
sortBy: zod_1.z.enum(["bannedAt", "createdAt", "reason"]).optional(),
|
|
130
129
|
sortOrder: zod_1.z.enum(["ASC", "DESC"]).optional(),
|
|
131
130
|
})
|
|
132
131
|
.transform((data) => {
|
|
133
132
|
if (data.fromDate) {
|
|
134
|
-
data.fromDate = (0,
|
|
133
|
+
data.fromDate = (0, shared_dateRanges_validations_1.normalizeDate)(data.fromDate);
|
|
135
134
|
}
|
|
136
135
|
if (data.toDate) {
|
|
137
|
-
data.toDate = (0,
|
|
136
|
+
data.toDate = (0, shared_dateRanges_validations_1.normalizeDate)(data.toDate);
|
|
138
137
|
}
|
|
139
138
|
return data;
|
|
140
139
|
}),
|
|
@@ -145,18 +144,18 @@ exports.listSuspensionsSchema = zod_1.z.object({
|
|
|
145
144
|
userId: zod_1.z.string().uuid("Invalid user ID").optional(),
|
|
146
145
|
status: zod_1.z.enum(["active", "expired", "revoked"]).optional(),
|
|
147
146
|
appealStatus: zod_1.z.enum(["pending", "approved", "rejected"]).optional(),
|
|
148
|
-
fromDate:
|
|
149
|
-
toDate:
|
|
147
|
+
fromDate: shared_dateRanges_validations_1.dateValidator.optional(),
|
|
148
|
+
toDate: shared_dateRanges_validations_1.dateValidator.optional(),
|
|
150
149
|
search: zod_1.z.string().optional(),
|
|
151
150
|
sortBy: zod_1.z.enum(["startedAt", "endsAt", "createdAt", "reason"]).optional(),
|
|
152
151
|
sortOrder: zod_1.z.enum(["ASC", "DESC"]).optional(),
|
|
153
152
|
})
|
|
154
153
|
.transform((data) => {
|
|
155
154
|
if (data.fromDate) {
|
|
156
|
-
data.fromDate = (0,
|
|
155
|
+
data.fromDate = (0, shared_dateRanges_validations_1.normalizeDate)(data.fromDate);
|
|
157
156
|
}
|
|
158
157
|
if (data.toDate) {
|
|
159
|
-
data.toDate = (0,
|
|
158
|
+
data.toDate = (0, shared_dateRanges_validations_1.normalizeDate)(data.toDate);
|
|
160
159
|
}
|
|
161
160
|
return data;
|
|
162
161
|
}),
|
|
@@ -165,15 +164,15 @@ exports.listPendingAppealsSchema = zod_1.z.object({
|
|
|
165
164
|
query: paginationSchema
|
|
166
165
|
.extend({
|
|
167
166
|
type: zod_1.z.enum(["ban", "suspension"]).optional(),
|
|
168
|
-
fromDate:
|
|
169
|
-
toDate:
|
|
167
|
+
fromDate: shared_dateRanges_validations_1.dateValidator.optional(),
|
|
168
|
+
toDate: shared_dateRanges_validations_1.dateValidator.optional(),
|
|
170
169
|
})
|
|
171
170
|
.transform((data) => {
|
|
172
171
|
if (data.fromDate) {
|
|
173
|
-
data.fromDate = (0,
|
|
172
|
+
data.fromDate = (0, shared_dateRanges_validations_1.normalizeDate)(data.fromDate);
|
|
174
173
|
}
|
|
175
174
|
if (data.toDate) {
|
|
176
|
-
data.toDate = (0,
|
|
175
|
+
data.toDate = (0, shared_dateRanges_validations_1.normalizeDate)(data.toDate);
|
|
177
176
|
}
|
|
178
177
|
return data;
|
|
179
178
|
}),
|
|
@@ -192,8 +191,8 @@ exports.extendSuspensionSchema = zod_1.z.object({
|
|
|
192
191
|
params: zod_1.z.object({ suspensionId: uuidSchema }),
|
|
193
192
|
body: zod_1.z
|
|
194
193
|
.object({
|
|
195
|
-
newEndDate:
|
|
196
|
-
const normalizedDate = (0,
|
|
194
|
+
newEndDate: shared_dateRanges_validations_1.dateValidator.refine((date) => {
|
|
195
|
+
const normalizedDate = (0, shared_dateRanges_validations_1.normalizeDate)(date);
|
|
197
196
|
return new Date(normalizedDate) > new Date();
|
|
198
197
|
}, { message: "New end date must be in the future" }),
|
|
199
198
|
extensionReason: zod_1.z.string().max(500).optional(),
|
|
@@ -201,7 +200,7 @@ exports.extendSuspensionSchema = zod_1.z.object({
|
|
|
201
200
|
.strict()
|
|
202
201
|
.transform((data) => ({
|
|
203
202
|
...data,
|
|
204
|
-
newEndDate: (0,
|
|
203
|
+
newEndDate: (0, shared_dateRanges_validations_1.normalizeDate)(data.newEndDate),
|
|
205
204
|
})),
|
|
206
205
|
});
|
|
207
206
|
// Process Appeals
|
|
@@ -221,16 +220,16 @@ exports.reviewAppealSchema = zod_1.z.object({
|
|
|
221
220
|
exports.exportBansSchema = zod_1.z.object({
|
|
222
221
|
query: zod_1.z
|
|
223
222
|
.object({
|
|
224
|
-
fromDate:
|
|
225
|
-
toDate:
|
|
223
|
+
fromDate: shared_dateRanges_validations_1.dateValidator.optional(),
|
|
224
|
+
toDate: shared_dateRanges_validations_1.dateValidator.optional(),
|
|
226
225
|
format: zod_1.z.enum(["csv"]).default("csv"),
|
|
227
226
|
})
|
|
228
227
|
.transform((data) => {
|
|
229
228
|
if (data.fromDate) {
|
|
230
|
-
data.fromDate = (0,
|
|
229
|
+
data.fromDate = (0, shared_dateRanges_validations_1.normalizeDate)(data.fromDate);
|
|
231
230
|
}
|
|
232
231
|
if (data.toDate) {
|
|
233
|
-
data.toDate = (0,
|
|
232
|
+
data.toDate = (0, shared_dateRanges_validations_1.normalizeDate)(data.toDate);
|
|
234
233
|
}
|
|
235
234
|
return data;
|
|
236
235
|
}),
|
|
@@ -238,16 +237,16 @@ exports.exportBansSchema = zod_1.z.object({
|
|
|
238
237
|
exports.exportSuspensionsSchema = zod_1.z.object({
|
|
239
238
|
query: zod_1.z
|
|
240
239
|
.object({
|
|
241
|
-
fromDate:
|
|
242
|
-
toDate:
|
|
240
|
+
fromDate: shared_dateRanges_validations_1.dateValidator.optional(),
|
|
241
|
+
toDate: shared_dateRanges_validations_1.dateValidator.optional(),
|
|
243
242
|
format: zod_1.z.enum(["csv"]).default("csv"),
|
|
244
243
|
})
|
|
245
244
|
.transform((data) => {
|
|
246
245
|
if (data.fromDate) {
|
|
247
|
-
data.fromDate = (0,
|
|
246
|
+
data.fromDate = (0, shared_dateRanges_validations_1.normalizeDate)(data.fromDate);
|
|
248
247
|
}
|
|
249
248
|
if (data.toDate) {
|
|
250
|
-
data.toDate = (0,
|
|
249
|
+
data.toDate = (0, shared_dateRanges_validations_1.normalizeDate)(data.toDate);
|
|
251
250
|
}
|
|
252
251
|
return data;
|
|
253
252
|
}),
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setPrimaryContactSchema = exports.deleteContactSchema = exports.confirmVerificationSchema = exports.verifyContactSchema = exports.addContactSchema = exports.updateProfileSchema = exports.deleteAccountSchema = exports.deactivateAccountSchema = exports.updateRiderProfileSchema = exports.createRiderSchema = exports.updatePassengerProfileSchema = exports.passengerSignupSchema = exports.viewProfileSchema = exports.getAllUsersSchema = exports.updateUserProfileSchema = exports.getUserByIdSchema = exports.createUserSchema = exports.validateContactValue = exports.detectContactType = exports.strongPasswordRegex = exports.jacketIdRegex = exports.emailRegex = exports.phoneNumberRegex = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const regex_constants_1 = require("../../constants/regex.constants");
|
|
5
6
|
// ============================================================================
|
|
6
7
|
// COMMON VALIDATIONS
|
|
7
8
|
// ============================================================================
|
|
8
|
-
exports.phoneNumberRegex =
|
|
9
|
-
exports.emailRegex =
|
|
10
|
-
exports.jacketIdRegex =
|
|
11
|
-
const plateRegex =
|
|
12
|
-
exports.strongPasswordRegex =
|
|
9
|
+
exports.phoneNumberRegex = regex_constants_1.PHONE_NUMBER_REGEX;
|
|
10
|
+
exports.emailRegex = regex_constants_1.EMAIL_ADDRESS_REGEX;
|
|
11
|
+
exports.jacketIdRegex = regex_constants_1.JACKET_ID_REGEX;
|
|
12
|
+
const plateRegex = regex_constants_1.PLATE_NUMBER_REGEX;
|
|
13
|
+
exports.strongPasswordRegex = regex_constants_1.STRONG_PASSWORD_REGEX;
|
|
13
14
|
// ============================================================================
|
|
14
15
|
// CONTACT VALIDATION HELPERS
|
|
15
16
|
// ============================================================================
|
|
@@ -89,7 +90,7 @@ exports.createUserSchema = zod_1.z.object({
|
|
|
89
90
|
path: ["birthDate"],
|
|
90
91
|
}),
|
|
91
92
|
headers: zod_1.z.object({
|
|
92
|
-
authorization: zod_1.z.string().regex(
|
|
93
|
+
authorization: zod_1.z.string().regex(regex_constants_1.BEARER_TOKEN_PREFIX_REGEX, {
|
|
93
94
|
message: "Authorization header must start with 'Bearer '",
|
|
94
95
|
}),
|
|
95
96
|
}),
|
|
@@ -100,7 +101,7 @@ exports.getUserByIdSchema = zod_1.z.object({
|
|
|
100
101
|
userId: zod_1.z.string().uuid("Invalid user ID format"),
|
|
101
102
|
}),
|
|
102
103
|
headers: zod_1.z.object({
|
|
103
|
-
authorization: zod_1.z.string().regex(
|
|
104
|
+
authorization: zod_1.z.string().regex(regex_constants_1.BEARER_TOKEN_PREFIX_REGEX, {
|
|
104
105
|
message: "Authorization header must start with 'Bearer '",
|
|
105
106
|
}),
|
|
106
107
|
}),
|
|
@@ -168,7 +169,7 @@ exports.updateUserProfileSchema = zod_1.z.object({
|
|
|
168
169
|
path: ["birthDate"],
|
|
169
170
|
}),
|
|
170
171
|
headers: zod_1.z.object({
|
|
171
|
-
authorization: zod_1.z.string().regex(
|
|
172
|
+
authorization: zod_1.z.string().regex(regex_constants_1.BEARER_TOKEN_PREFIX_REGEX, {
|
|
172
173
|
message: "Authorization header must start with 'Bearer '",
|
|
173
174
|
}),
|
|
174
175
|
}),
|
|
@@ -176,8 +177,8 @@ exports.updateUserProfileSchema = zod_1.z.object({
|
|
|
176
177
|
// Get All Users Schema (with pagination/filtering)
|
|
177
178
|
exports.getAllUsersSchema = zod_1.z.object({
|
|
178
179
|
query: zod_1.z.object({
|
|
179
|
-
page: zod_1.z.string().regex(
|
|
180
|
-
limit: zod_1.z.string().regex(
|
|
180
|
+
page: zod_1.z.string().regex(regex_constants_1.NUMERIC_STRING_REGEX).default("1").transform(Number).optional(),
|
|
181
|
+
limit: zod_1.z.string().regex(regex_constants_1.NUMERIC_STRING_REGEX).default("20").transform(Number).optional(),
|
|
181
182
|
role: zod_1.z
|
|
182
183
|
.enum(["RIDER", "PASSENGER", "AGENT", "ADMIN", "SUPER_ADMIN"])
|
|
183
184
|
.optional(),
|
|
@@ -200,7 +201,7 @@ exports.getAllUsersSchema = zod_1.z.object({
|
|
|
200
201
|
order: zod_1.z.enum(["asc", "desc"]).default("desc"),
|
|
201
202
|
}),
|
|
202
203
|
headers: zod_1.z.object({
|
|
203
|
-
authorization: zod_1.z.string().regex(
|
|
204
|
+
authorization: zod_1.z.string().regex(regex_constants_1.BEARER_TOKEN_PREFIX_REGEX, {
|
|
204
205
|
message: "Authorization header must start with 'Bearer '",
|
|
205
206
|
}),
|
|
206
207
|
}),
|
|
@@ -214,7 +215,7 @@ exports.viewProfileSchema = zod_1.z.object({
|
|
|
214
215
|
body: zod_1.z.object({}).optional(),
|
|
215
216
|
query: zod_1.z.object({}).optional(),
|
|
216
217
|
headers: zod_1.z.object({
|
|
217
|
-
authorization: zod_1.z.string().regex(
|
|
218
|
+
authorization: zod_1.z.string().regex(regex_constants_1.BEARER_TOKEN_PREFIX_REGEX, {
|
|
218
219
|
message: "Authorization header must start with 'Bearer '",
|
|
219
220
|
}),
|
|
220
221
|
}),
|
|
@@ -321,7 +322,7 @@ exports.updatePassengerProfileSchema = zod_1.z.object({
|
|
|
321
322
|
path: ["birthDate"],
|
|
322
323
|
}),
|
|
323
324
|
headers: zod_1.z.object({
|
|
324
|
-
authorization: zod_1.z.string().regex(
|
|
325
|
+
authorization: zod_1.z.string().regex(regex_constants_1.BEARER_TOKEN_PREFIX_REGEX, {
|
|
325
326
|
message: "Authorization header must start with 'Bearer '",
|
|
326
327
|
}),
|
|
327
328
|
}),
|
|
@@ -432,7 +433,7 @@ exports.updateRiderProfileSchema = zod_1.z.object({
|
|
|
432
433
|
}),
|
|
433
434
|
query: zod_1.z.object({}).optional(),
|
|
434
435
|
headers: zod_1.z.object({
|
|
435
|
-
authorization: zod_1.z.string().regex(
|
|
436
|
+
authorization: zod_1.z.string().regex(regex_constants_1.BEARER_TOKEN_PREFIX_REGEX, {
|
|
436
437
|
message: "Authorization header must start with 'Bearer '",
|
|
437
438
|
}),
|
|
438
439
|
}),
|
|
@@ -453,7 +454,7 @@ exports.deactivateAccountSchema = zod_1.z.object({
|
|
|
453
454
|
.optional(),
|
|
454
455
|
}),
|
|
455
456
|
headers: zod_1.z.object({
|
|
456
|
-
authorization: zod_1.z.string().regex(
|
|
457
|
+
authorization: zod_1.z.string().regex(regex_constants_1.BEARER_TOKEN_PREFIX_REGEX, {
|
|
457
458
|
message: "Authorization header must start with 'Bearer '",
|
|
458
459
|
}),
|
|
459
460
|
}),
|
|
@@ -471,7 +472,7 @@ exports.deleteAccountSchema = zod_1.z.object({
|
|
|
471
472
|
.optional(),
|
|
472
473
|
}),
|
|
473
474
|
headers: zod_1.z.object({
|
|
474
|
-
authorization: zod_1.z.string().regex(
|
|
475
|
+
authorization: zod_1.z.string().regex(regex_constants_1.BEARER_TOKEN_PREFIX_REGEX, {
|
|
475
476
|
message: "Authorization header must start with 'Bearer '",
|
|
476
477
|
}),
|
|
477
478
|
}),
|
|
@@ -529,7 +530,7 @@ exports.addContactSchema = zod_1.z.object({
|
|
|
529
530
|
type: zod_1.z.enum(["EMAIL", "PHONE", "WHATSAPP"]).optional(),
|
|
530
531
|
}),
|
|
531
532
|
headers: zod_1.z.object({
|
|
532
|
-
authorization: zod_1.z.string().regex(
|
|
533
|
+
authorization: zod_1.z.string().regex(regex_constants_1.BEARER_TOKEN_PREFIX_REGEX, {
|
|
533
534
|
message: "Authorization header must start with 'Bearer '",
|
|
534
535
|
}),
|
|
535
536
|
}),
|
|
@@ -540,7 +541,7 @@ exports.verifyContactSchema = zod_1.z.object({
|
|
|
540
541
|
contactId: zod_1.z.string().uuid("Invalid contact ID format"),
|
|
541
542
|
}),
|
|
542
543
|
headers: zod_1.z.object({
|
|
543
|
-
authorization: zod_1.z.string().regex(
|
|
544
|
+
authorization: zod_1.z.string().regex(regex_constants_1.BEARER_TOKEN_PREFIX_REGEX, {
|
|
544
545
|
message: "Authorization header must start with 'Bearer '",
|
|
545
546
|
}),
|
|
546
547
|
}),
|
|
@@ -554,7 +555,7 @@ exports.confirmVerificationSchema = zod_1.z.object({
|
|
|
554
555
|
contactId: zod_1.z.string().uuid("Invalid contact ID format"),
|
|
555
556
|
}),
|
|
556
557
|
headers: zod_1.z.object({
|
|
557
|
-
authorization: zod_1.z.string().regex(
|
|
558
|
+
authorization: zod_1.z.string().regex(regex_constants_1.BEARER_TOKEN_PREFIX_REGEX, {
|
|
558
559
|
message: "Authorization header must start with 'Bearer '",
|
|
559
560
|
}),
|
|
560
561
|
}),
|
|
@@ -565,7 +566,7 @@ exports.deleteContactSchema = zod_1.z.object({
|
|
|
565
566
|
contactId: zod_1.z.string().uuid("Invalid contact ID format"),
|
|
566
567
|
}),
|
|
567
568
|
headers: zod_1.z.object({
|
|
568
|
-
authorization: zod_1.z.string().regex(
|
|
569
|
+
authorization: zod_1.z.string().regex(regex_constants_1.BEARER_TOKEN_PREFIX_REGEX, {
|
|
569
570
|
message: "Authorization header must start with 'Bearer '",
|
|
570
571
|
}),
|
|
571
572
|
}),
|
|
@@ -576,7 +577,7 @@ exports.setPrimaryContactSchema = zod_1.z.object({
|
|
|
576
577
|
contactId: zod_1.z.string().uuid("Invalid contact ID format"),
|
|
577
578
|
}),
|
|
578
579
|
headers: zod_1.z.object({
|
|
579
|
-
authorization: zod_1.z.string().regex(
|
|
580
|
+
authorization: zod_1.z.string().regex(regex_constants_1.BEARER_TOKEN_PREFIX_REGEX, {
|
|
580
581
|
message: "Authorization header must start with 'Bearer '",
|
|
581
582
|
}),
|
|
582
583
|
}),
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.extendSessionSchema = exports.unlockDeviceSchema = exports.serialRegex = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
|
|
5
|
+
const regex_constants_1 = require("../../constants/regex.constants");
|
|
6
|
+
exports.serialRegex = regex_constants_1.DEVICE_SERIAL_NUMBER_REGEX;
|
|
6
7
|
exports.unlockDeviceSchema = zod_1.z.object({
|
|
7
8
|
body: zod_1.z.object({
|
|
8
9
|
deviceSerialNumber: zod_1.z
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vr-commons",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.177",
|
|
4
4
|
"description": "Shared functions package",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"rimraf": "^5.0.5",
|
|
104
104
|
"streamifier": "^0.1.1",
|
|
105
105
|
"typescript": "^5.3.3",
|
|
106
|
-
"vr-models": "^1.0.
|
|
106
|
+
"vr-models": "^1.0.99",
|
|
107
107
|
"zod": "^3.25.20"
|
|
108
108
|
},
|
|
109
109
|
"dependencies": {
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { Request, Response, NextFunction } from "express";
|
|
2
|
-
export declare const idempotencyMiddleware: (req: Request, res: Response, next: NextFunction) => Promise<void | Response<any, Record<string, any>>>;
|
|
3
|
-
export declare const storeIdempotencyResponse: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.storeIdempotencyResponse = exports.idempotencyMiddleware = void 0;
|
|
4
|
-
const vr_models_1 = require("vr-models");
|
|
5
|
-
const response_utils_1 = require("../utils/response.utils");
|
|
6
|
-
const idempotencyMiddleware = async (req, res, next) => {
|
|
7
|
-
// Skip for GET requests
|
|
8
|
-
if (req.method === "GET") {
|
|
9
|
-
return next();
|
|
10
|
-
}
|
|
11
|
-
const idempotencyKey = req.headers["idempotency-key"];
|
|
12
|
-
if (!idempotencyKey) {
|
|
13
|
-
return (0, response_utils_1.sendErrorResponse)(res, "Idempotency-Key header is required", 400);
|
|
14
|
-
}
|
|
15
|
-
// Validate UUID format
|
|
16
|
-
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
17
|
-
if (!uuidRegex.test(idempotencyKey)) {
|
|
18
|
-
return (0, response_utils_1.sendErrorResponse)(res, "Idempotency-Key must be a valid UUID", 400);
|
|
19
|
-
}
|
|
20
|
-
try {
|
|
21
|
-
const existing = await vr_models_1.IdempotencyRecord.findOne({
|
|
22
|
-
where: { key: idempotencyKey },
|
|
23
|
-
});
|
|
24
|
-
if (existing && existing.isValid()) {
|
|
25
|
-
const response = existing.getResponse();
|
|
26
|
-
return res.status(response?.statusCode || 200).json(response?.body);
|
|
27
|
-
}
|
|
28
|
-
if (existing && existing.isExpired()) {
|
|
29
|
-
await vr_models_1.IdempotencyRecord.invalidate(idempotencyKey);
|
|
30
|
-
}
|
|
31
|
-
// Store original response methods
|
|
32
|
-
const originalJson = res.json.bind(res);
|
|
33
|
-
const originalStatus = res.status.bind(res);
|
|
34
|
-
res.json = function (body) {
|
|
35
|
-
res.locals.responseBody = body;
|
|
36
|
-
return originalJson(body);
|
|
37
|
-
};
|
|
38
|
-
res.status = function (code) {
|
|
39
|
-
res.locals.statusCode = code;
|
|
40
|
-
return originalStatus(code);
|
|
41
|
-
};
|
|
42
|
-
req.idempotencyKey = idempotencyKey;
|
|
43
|
-
next();
|
|
44
|
-
}
|
|
45
|
-
catch (error) {
|
|
46
|
-
console.error("Idempotency middleware error:", error);
|
|
47
|
-
next(error);
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
exports.idempotencyMiddleware = idempotencyMiddleware;
|
|
51
|
-
// Store response after completion
|
|
52
|
-
const storeIdempotencyResponse = async (req, res, next) => {
|
|
53
|
-
if (req.method === "GET" || !req.idempotencyKey) {
|
|
54
|
-
return next();
|
|
55
|
-
}
|
|
56
|
-
try {
|
|
57
|
-
const expiresAt = new Date();
|
|
58
|
-
expiresAt.setHours(expiresAt.getHours() + 24);
|
|
59
|
-
await vr_models_1.IdempotencyRecord.create({
|
|
60
|
-
key: req.idempotencyKey,
|
|
61
|
-
requestMethod: req.method,
|
|
62
|
-
requestPath: req.path,
|
|
63
|
-
requestParams: req.body,
|
|
64
|
-
responseStatusCode: res.locals.statusCode || 200,
|
|
65
|
-
responseBody: res.locals.responseBody || {},
|
|
66
|
-
expiresAt, // Add this
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
catch (error) {
|
|
70
|
-
console.error("Failed to store idempotency record:", error);
|
|
71
|
-
}
|
|
72
|
-
next();
|
|
73
|
-
};
|
|
74
|
-
exports.storeIdempotencyResponse = storeIdempotencyResponse;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.extractDedicatedUserFromSerial = void 0;
|
|
4
|
-
const __1 = require("..");
|
|
5
|
-
const extractDedicatedUserFromSerial = (serialNumber) => {
|
|
6
|
-
// Validate format first
|
|
7
|
-
const match = serialNumber.match(__1.serialRegex);
|
|
8
|
-
if (!match) {
|
|
9
|
-
console.warn(`Invalid serial number format: ${serialNumber}. Defaulting to N/A.`);
|
|
10
|
-
return "N/A";
|
|
11
|
-
}
|
|
12
|
-
// match[1] = VBRD or VIBERIDE (company)
|
|
13
|
-
// match[2] = PASSENGER or RIDER (dedicated user)
|
|
14
|
-
// match[3] = AA001A (serial)
|
|
15
|
-
const role = match[2];
|
|
16
|
-
if (role === "PASSENGER" || role === "RIDER") {
|
|
17
|
-
return role;
|
|
18
|
-
}
|
|
19
|
-
return "N/A";
|
|
20
|
-
};
|
|
21
|
-
exports.extractDedicatedUserFromSerial = extractDedicatedUserFromSerial;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { DeviceSessionPayload } from "vr-models";
|
|
2
|
-
/**
|
|
3
|
-
* Create a new device session (for BLE unlock)
|
|
4
|
-
* This is separate from the long-lasting auth token
|
|
5
|
-
*/
|
|
6
|
-
export declare const createDeviceSession: (userId: string, tokenVersion: number, deviceSerialNumber: string) => DeviceSessionPayload;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createDeviceSession = void 0;
|
|
4
|
-
const uuid_1 = require("uuid");
|
|
5
|
-
// Session duration for device unlock sessions (12 minutes)
|
|
6
|
-
const SESSION_DURATION = parseInt(process.env.DEVICE_SESSION_DURATION || "12") * 60 * 1000; // Convert minutes to milliseconds
|
|
7
|
-
/**
|
|
8
|
-
* Create a new device session (for BLE unlock)
|
|
9
|
-
* This is separate from the long-lasting auth token
|
|
10
|
-
*/
|
|
11
|
-
const createDeviceSession = (userId, tokenVersion, deviceSerialNumber) => {
|
|
12
|
-
const now = Date.now();
|
|
13
|
-
return {
|
|
14
|
-
sessionId: (0, uuid_1.v4)(),
|
|
15
|
-
startedAt: now,
|
|
16
|
-
expiresAt: now + SESSION_DURATION,
|
|
17
|
-
userId,
|
|
18
|
-
tokenVersion,
|
|
19
|
-
deviceSerialNumber,
|
|
20
|
-
minutesGranted: SESSION_DURATION,
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
exports.createDeviceSession = createDeviceSession;
|
|
24
|
-
// Note: We no longer need session-related functions for auth tokens
|
|
25
|
-
// since we're using a single 30-day token without session tracking
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const submitBanAppealSchema: z.ZodObject<{
|
|
3
|
-
params: z.ZodObject<{
|
|
4
|
-
banId: z.ZodString;
|
|
5
|
-
}, "strip", z.ZodTypeAny, {
|
|
6
|
-
banId: string;
|
|
7
|
-
}, {
|
|
8
|
-
banId: string;
|
|
9
|
-
}>;
|
|
10
|
-
body: z.ZodObject<{
|
|
11
|
-
appealReason: z.ZodString;
|
|
12
|
-
}, "strict", z.ZodTypeAny, {
|
|
13
|
-
appealReason: string;
|
|
14
|
-
}, {
|
|
15
|
-
appealReason: string;
|
|
16
|
-
}>;
|
|
17
|
-
}, "strip", z.ZodTypeAny, {
|
|
18
|
-
body: {
|
|
19
|
-
appealReason: string;
|
|
20
|
-
};
|
|
21
|
-
params: {
|
|
22
|
-
banId: string;
|
|
23
|
-
};
|
|
24
|
-
}, {
|
|
25
|
-
body: {
|
|
26
|
-
appealReason: string;
|
|
27
|
-
};
|
|
28
|
-
params: {
|
|
29
|
-
banId: string;
|
|
30
|
-
};
|
|
31
|
-
}>;
|
|
32
|
-
export declare const submitSuspensionAppealSchema: z.ZodObject<{
|
|
33
|
-
params: z.ZodObject<{
|
|
34
|
-
suspensionId: z.ZodString;
|
|
35
|
-
}, "strip", z.ZodTypeAny, {
|
|
36
|
-
suspensionId: string;
|
|
37
|
-
}, {
|
|
38
|
-
suspensionId: string;
|
|
39
|
-
}>;
|
|
40
|
-
body: z.ZodObject<{
|
|
41
|
-
appealReason: z.ZodString;
|
|
42
|
-
}, "strict", z.ZodTypeAny, {
|
|
43
|
-
appealReason: string;
|
|
44
|
-
}, {
|
|
45
|
-
appealReason: string;
|
|
46
|
-
}>;
|
|
47
|
-
}, "strip", z.ZodTypeAny, {
|
|
48
|
-
body: {
|
|
49
|
-
appealReason: string;
|
|
50
|
-
};
|
|
51
|
-
params: {
|
|
52
|
-
suspensionId: string;
|
|
53
|
-
};
|
|
54
|
-
}, {
|
|
55
|
-
body: {
|
|
56
|
-
appealReason: string;
|
|
57
|
-
};
|
|
58
|
-
params: {
|
|
59
|
-
suspensionId: string;
|
|
60
|
-
};
|
|
61
|
-
}>;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.submitSuspensionAppealSchema = exports.submitBanAppealSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const uuidSchema = zod_1.z.string().uuid("Invalid ID format");
|
|
6
|
-
exports.submitBanAppealSchema = zod_1.z.object({
|
|
7
|
-
params: zod_1.z.object({
|
|
8
|
-
banId: uuidSchema,
|
|
9
|
-
}),
|
|
10
|
-
body: zod_1.z
|
|
11
|
-
.object({
|
|
12
|
-
appealReason: zod_1.z
|
|
13
|
-
.string()
|
|
14
|
-
.min(10, "Appeal reason must be at least 10 characters")
|
|
15
|
-
.max(2000, "Appeal reason cannot exceed 2000 characters"),
|
|
16
|
-
})
|
|
17
|
-
.strict(),
|
|
18
|
-
});
|
|
19
|
-
exports.submitSuspensionAppealSchema = zod_1.z.object({
|
|
20
|
-
params: zod_1.z.object({
|
|
21
|
-
suspensionId: uuidSchema,
|
|
22
|
-
}),
|
|
23
|
-
body: zod_1.z
|
|
24
|
-
.object({
|
|
25
|
-
appealReason: zod_1.z
|
|
26
|
-
.string()
|
|
27
|
-
.min(10, "Appeal reason must be at least 10 characters")
|
|
28
|
-
.max(2000, "Appeal reason cannot exceed 2000 characters"),
|
|
29
|
-
})
|
|
30
|
-
.strict(),
|
|
31
|
-
});
|