vr-commons 1.0.89 → 1.0.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,10 @@
1
1
  export { validate } from "./validate.validations";
2
2
  export { riderLoginSchema, forgotPasswordSchema, userLoginSchema, refreshTokenSchema, registerSchema, verifyOtpSchema, resendOtpSchema, requestOtpSchema, } from "./auth.validations";
3
3
  export { createUserSchema, getUserByIdSchema, updateUserProfileSchema, getAllUsersSchema, viewProfileSchema, passengerSignupSchema, updatePassengerProfileSchema, updateRiderProfileSchema, createRiderSchema, deactivateAccountSchema, } from "./profiles.validations";
4
- export { listBansSchema, listPendingAppealsSchema, listSuspensionsSchema, reviewAppealSchema, revokeBanSchema, revokeSuspensionSchema, extendSuspensionSchema, exportBansSchema, } from "./moderation.validations";
5
- export { submitBanAppealSchema, submitSuspensionAppealSchema, } from "./appeals.validations";
6
- export { getBanSchema, getUserRestrictionsSchema, createBanSchema, } from "./bans.validations";
7
- export { getSuspensionSchema, getUserSuspensionsSchema, createSuspensionSchema, } from "./suspensions.validations";
4
+ export { submitBanAppealSchema, submitSuspensionAppealSchema, getBanSchema, getUserRestrictionsSchema, getSuspensionSchema, getUserSuspensionsSchema, getUserBansSchema, listBansSchema, listPendingAppealsSchema, listSuspensionsSchema, reviewAppealSchema, revokeBanSchema, revokeSuspensionSchema, extendSuspensionSchema, createBanSchema, createSuspensionSchema, exportBansSchema, } from "./moderation.validations";
8
5
  export { createAppSpecsSchema, updateAppSpecsSchema, listAppSpecsSchema, getActiveAppSpecsSchema, activateAppSpecsSchema, getAppSpecsSchema, } from "./appSpecs.validations";
9
6
  export { listUserPaymentPlansSchema, getUserPaymentPlanSchema, } from "./devicePaymentPlan.validations";
10
7
  export { unlockDeviceSchema, extendSessionSchema } from "./devices.validations";
11
8
  export { payInstallmentSchema } from "./payinstallment.validations";
12
9
  export { updateProfileSchema, requestPhoneChangeSchema, verifyPhoneChangeSchema, deleteAccountSchema, strongPasswordRegex, changePasswordSchema, } from "./account.validations";
13
- export { updateAdminSchema, updateRiderSchema, deleteUserSchema, getUserSchema, getUsersSchema, hireAdminSchema, promoteAdminSchema, demoteAdminSchema, fireEmployeeSchema, upgradeToRiderSchema, resetPasswordSchema, bulkResetPasswordSchema, } from "./users.admin.validations";
10
+ export { updateAdminSchema, updateRiderSchema, deleteUserSchema, getUserSchema, getUsersSchema, hireAdminSchema, promoteAdminSchema, demoteAdminSchema, fireEmployeeSchema, upgradeToRiderSchema, resetPasswordSchema, } from "./users.admin.validations";
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteAccountSchema = exports.verifyPhoneChangeSchema = exports.requestPhoneChangeSchema = exports.updateProfileSchema = exports.payInstallmentSchema = exports.extendSessionSchema = exports.unlockDeviceSchema = exports.getUserPaymentPlanSchema = exports.listUserPaymentPlansSchema = exports.getAppSpecsSchema = exports.activateAppSpecsSchema = exports.getActiveAppSpecsSchema = exports.listAppSpecsSchema = exports.updateAppSpecsSchema = exports.createAppSpecsSchema = exports.createSuspensionSchema = exports.getUserSuspensionsSchema = exports.getSuspensionSchema = exports.createBanSchema = exports.getUserRestrictionsSchema = exports.getBanSchema = exports.submitSuspensionAppealSchema = exports.submitBanAppealSchema = exports.exportBansSchema = exports.extendSuspensionSchema = exports.revokeSuspensionSchema = exports.revokeBanSchema = exports.reviewAppealSchema = exports.listSuspensionsSchema = exports.listPendingAppealsSchema = exports.listBansSchema = exports.deactivateAccountSchema = exports.createRiderSchema = exports.updateRiderProfileSchema = exports.updatePassengerProfileSchema = exports.passengerSignupSchema = exports.viewProfileSchema = exports.getAllUsersSchema = exports.updateUserProfileSchema = exports.getUserByIdSchema = exports.createUserSchema = exports.requestOtpSchema = exports.resendOtpSchema = exports.verifyOtpSchema = exports.registerSchema = exports.refreshTokenSchema = exports.userLoginSchema = exports.forgotPasswordSchema = exports.riderLoginSchema = exports.validate = void 0;
4
- exports.bulkResetPasswordSchema = exports.resetPasswordSchema = exports.upgradeToRiderSchema = exports.fireEmployeeSchema = exports.demoteAdminSchema = exports.promoteAdminSchema = exports.hireAdminSchema = exports.getUsersSchema = exports.getUserSchema = exports.deleteUserSchema = exports.updateRiderSchema = exports.updateAdminSchema = exports.changePasswordSchema = exports.strongPasswordRegex = void 0;
3
+ exports.verifyPhoneChangeSchema = exports.requestPhoneChangeSchema = exports.updateProfileSchema = exports.payInstallmentSchema = exports.extendSessionSchema = exports.unlockDeviceSchema = exports.getUserPaymentPlanSchema = exports.listUserPaymentPlansSchema = exports.getAppSpecsSchema = exports.activateAppSpecsSchema = exports.getActiveAppSpecsSchema = exports.listAppSpecsSchema = exports.updateAppSpecsSchema = exports.createAppSpecsSchema = exports.exportBansSchema = exports.createSuspensionSchema = exports.createBanSchema = exports.extendSuspensionSchema = exports.revokeSuspensionSchema = exports.revokeBanSchema = exports.reviewAppealSchema = exports.listSuspensionsSchema = exports.listPendingAppealsSchema = exports.listBansSchema = exports.getUserBansSchema = exports.getUserSuspensionsSchema = exports.getSuspensionSchema = exports.getUserRestrictionsSchema = exports.getBanSchema = exports.submitSuspensionAppealSchema = exports.submitBanAppealSchema = exports.deactivateAccountSchema = exports.createRiderSchema = exports.updateRiderProfileSchema = exports.updatePassengerProfileSchema = exports.passengerSignupSchema = exports.viewProfileSchema = exports.getAllUsersSchema = exports.updateUserProfileSchema = exports.getUserByIdSchema = exports.createUserSchema = exports.requestOtpSchema = exports.resendOtpSchema = exports.verifyOtpSchema = exports.registerSchema = exports.refreshTokenSchema = exports.userLoginSchema = exports.forgotPasswordSchema = exports.riderLoginSchema = exports.validate = void 0;
4
+ exports.resetPasswordSchema = exports.upgradeToRiderSchema = exports.fireEmployeeSchema = exports.demoteAdminSchema = exports.promoteAdminSchema = exports.hireAdminSchema = exports.getUsersSchema = exports.getUserSchema = exports.deleteUserSchema = exports.updateRiderSchema = exports.updateAdminSchema = exports.changePasswordSchema = exports.strongPasswordRegex = exports.deleteAccountSchema = void 0;
5
5
  var validate_validations_1 = require("./validate.validations");
6
6
  Object.defineProperty(exports, "validate", { enumerable: true, get: function () { return validate_validations_1.validate; } });
7
7
  var auth_validations_1 = require("./auth.validations");
@@ -30,6 +30,15 @@ Object.defineProperty(exports, "createRiderSchema", { enumerable: true, get: fun
30
30
  // Account Management Schemas
31
31
  Object.defineProperty(exports, "deactivateAccountSchema", { enumerable: true, get: function () { return profiles_validations_1.deactivateAccountSchema; } });
32
32
  var moderation_validations_1 = require("./moderation.validations");
33
+ //operations
34
+ Object.defineProperty(exports, "submitBanAppealSchema", { enumerable: true, get: function () { return moderation_validations_1.submitBanAppealSchema; } });
35
+ Object.defineProperty(exports, "submitSuspensionAppealSchema", { enumerable: true, get: function () { return moderation_validations_1.submitSuspensionAppealSchema; } });
36
+ Object.defineProperty(exports, "getBanSchema", { enumerable: true, get: function () { return moderation_validations_1.getBanSchema; } });
37
+ Object.defineProperty(exports, "getUserRestrictionsSchema", { enumerable: true, get: function () { return moderation_validations_1.getUserRestrictionsSchema; } });
38
+ Object.defineProperty(exports, "getSuspensionSchema", { enumerable: true, get: function () { return moderation_validations_1.getSuspensionSchema; } });
39
+ Object.defineProperty(exports, "getUserSuspensionsSchema", { enumerable: true, get: function () { return moderation_validations_1.getUserSuspensionsSchema; } });
40
+ Object.defineProperty(exports, "getUserBansSchema", { enumerable: true, get: function () { return moderation_validations_1.getUserBansSchema; } });
41
+ //management
33
42
  Object.defineProperty(exports, "listBansSchema", { enumerable: true, get: function () { return moderation_validations_1.listBansSchema; } });
34
43
  Object.defineProperty(exports, "listPendingAppealsSchema", { enumerable: true, get: function () { return moderation_validations_1.listPendingAppealsSchema; } });
35
44
  Object.defineProperty(exports, "listSuspensionsSchema", { enumerable: true, get: function () { return moderation_validations_1.listSuspensionsSchema; } });
@@ -37,18 +46,10 @@ Object.defineProperty(exports, "reviewAppealSchema", { enumerable: true, get: fu
37
46
  Object.defineProperty(exports, "revokeBanSchema", { enumerable: true, get: function () { return moderation_validations_1.revokeBanSchema; } });
38
47
  Object.defineProperty(exports, "revokeSuspensionSchema", { enumerable: true, get: function () { return moderation_validations_1.revokeSuspensionSchema; } });
39
48
  Object.defineProperty(exports, "extendSuspensionSchema", { enumerable: true, get: function () { return moderation_validations_1.extendSuspensionSchema; } });
49
+ Object.defineProperty(exports, "createBanSchema", { enumerable: true, get: function () { return moderation_validations_1.createBanSchema; } });
50
+ Object.defineProperty(exports, "createSuspensionSchema", { enumerable: true, get: function () { return moderation_validations_1.createSuspensionSchema; } });
51
+ //analytics
40
52
  Object.defineProperty(exports, "exportBansSchema", { enumerable: true, get: function () { return moderation_validations_1.exportBansSchema; } });
41
- var appeals_validations_1 = require("./appeals.validations");
42
- Object.defineProperty(exports, "submitBanAppealSchema", { enumerable: true, get: function () { return appeals_validations_1.submitBanAppealSchema; } });
43
- Object.defineProperty(exports, "submitSuspensionAppealSchema", { enumerable: true, get: function () { return appeals_validations_1.submitSuspensionAppealSchema; } });
44
- var bans_validations_1 = require("./bans.validations");
45
- Object.defineProperty(exports, "getBanSchema", { enumerable: true, get: function () { return bans_validations_1.getBanSchema; } });
46
- Object.defineProperty(exports, "getUserRestrictionsSchema", { enumerable: true, get: function () { return bans_validations_1.getUserRestrictionsSchema; } });
47
- Object.defineProperty(exports, "createBanSchema", { enumerable: true, get: function () { return bans_validations_1.createBanSchema; } });
48
- var suspensions_validations_1 = require("./suspensions.validations");
49
- Object.defineProperty(exports, "getSuspensionSchema", { enumerable: true, get: function () { return suspensions_validations_1.getSuspensionSchema; } });
50
- Object.defineProperty(exports, "getUserSuspensionsSchema", { enumerable: true, get: function () { return suspensions_validations_1.getUserSuspensionsSchema; } });
51
- Object.defineProperty(exports, "createSuspensionSchema", { enumerable: true, get: function () { return suspensions_validations_1.createSuspensionSchema; } });
52
53
  var appSpecs_validations_1 = require("./appSpecs.validations");
53
54
  Object.defineProperty(exports, "createAppSpecsSchema", { enumerable: true, get: function () { return appSpecs_validations_1.createAppSpecsSchema; } });
54
55
  Object.defineProperty(exports, "updateAppSpecsSchema", { enumerable: true, get: function () { return appSpecs_validations_1.updateAppSpecsSchema; } });
@@ -83,4 +84,3 @@ Object.defineProperty(exports, "demoteAdminSchema", { enumerable: true, get: fun
83
84
  Object.defineProperty(exports, "fireEmployeeSchema", { enumerable: true, get: function () { return users_admin_validations_1.fireEmployeeSchema; } });
84
85
  Object.defineProperty(exports, "upgradeToRiderSchema", { enumerable: true, get: function () { return users_admin_validations_1.upgradeToRiderSchema; } });
85
86
  Object.defineProperty(exports, "resetPasswordSchema", { enumerable: true, get: function () { return users_admin_validations_1.resetPasswordSchema; } });
86
- Object.defineProperty(exports, "bulkResetPasswordSchema", { enumerable: true, get: function () { return users_admin_validations_1.bulkResetPasswordSchema; } });
@@ -1,4 +1,263 @@
1
1
  import { z } from "zod";
2
+ export declare const getBanSchema: z.ZodObject<{
3
+ params: z.ZodObject<{
4
+ banId: z.ZodString;
5
+ }, "strip", z.ZodTypeAny, {
6
+ banId: string;
7
+ }, {
8
+ banId: string;
9
+ }>;
10
+ }, "strip", z.ZodTypeAny, {
11
+ params: {
12
+ banId: string;
13
+ };
14
+ }, {
15
+ params: {
16
+ banId: string;
17
+ };
18
+ }>;
19
+ export declare const getSuspensionSchema: z.ZodObject<{
20
+ params: z.ZodObject<{
21
+ suspensionId: z.ZodString;
22
+ }, "strip", z.ZodTypeAny, {
23
+ suspensionId: string;
24
+ }, {
25
+ suspensionId: string;
26
+ }>;
27
+ }, "strip", z.ZodTypeAny, {
28
+ params: {
29
+ suspensionId: string;
30
+ };
31
+ }, {
32
+ params: {
33
+ suspensionId: string;
34
+ };
35
+ }>;
36
+ export declare const getUserRestrictionsSchema: z.ZodObject<{
37
+ params: z.ZodObject<{
38
+ userId: z.ZodString;
39
+ }, "strip", z.ZodTypeAny, {
40
+ userId: string;
41
+ }, {
42
+ userId: string;
43
+ }>;
44
+ query: z.ZodObject<{
45
+ includeResolved: z.ZodOptional<z.ZodEnum<["true", "false"]>>;
46
+ }, "strip", z.ZodTypeAny, {
47
+ includeResolved?: "true" | "false" | undefined;
48
+ }, {
49
+ includeResolved?: "true" | "false" | undefined;
50
+ }>;
51
+ }, "strip", z.ZodTypeAny, {
52
+ params: {
53
+ userId: string;
54
+ };
55
+ query: {
56
+ includeResolved?: "true" | "false" | undefined;
57
+ };
58
+ }, {
59
+ params: {
60
+ userId: string;
61
+ };
62
+ query: {
63
+ includeResolved?: "true" | "false" | undefined;
64
+ };
65
+ }>;
66
+ export declare const getUserBansSchema: z.ZodObject<{
67
+ params: z.ZodObject<{
68
+ userId: z.ZodString;
69
+ }, "strip", z.ZodTypeAny, {
70
+ userId: string;
71
+ }, {
72
+ userId: string;
73
+ }>;
74
+ query: z.ZodObject<{
75
+ includeResolved: z.ZodOptional<z.ZodEnum<["true", "false"]>>;
76
+ }, "strip", z.ZodTypeAny, {
77
+ includeResolved?: "true" | "false" | undefined;
78
+ }, {
79
+ includeResolved?: "true" | "false" | undefined;
80
+ }>;
81
+ }, "strip", z.ZodTypeAny, {
82
+ params: {
83
+ userId: string;
84
+ };
85
+ query: {
86
+ includeResolved?: "true" | "false" | undefined;
87
+ };
88
+ }, {
89
+ params: {
90
+ userId: string;
91
+ };
92
+ query: {
93
+ includeResolved?: "true" | "false" | undefined;
94
+ };
95
+ }>;
96
+ export declare const getUserSuspensionsSchema: z.ZodObject<{
97
+ params: z.ZodObject<{
98
+ userId: z.ZodString;
99
+ }, "strip", z.ZodTypeAny, {
100
+ userId: string;
101
+ }, {
102
+ userId: string;
103
+ }>;
104
+ query: z.ZodObject<{
105
+ includeResolved: z.ZodOptional<z.ZodEnum<["true", "false"]>>;
106
+ status: z.ZodOptional<z.ZodEnum<["active", "expired", "revoked"]>>;
107
+ }, "strip", z.ZodTypeAny, {
108
+ status?: "active" | "expired" | "revoked" | undefined;
109
+ includeResolved?: "true" | "false" | undefined;
110
+ }, {
111
+ status?: "active" | "expired" | "revoked" | undefined;
112
+ includeResolved?: "true" | "false" | undefined;
113
+ }>;
114
+ }, "strip", z.ZodTypeAny, {
115
+ params: {
116
+ userId: string;
117
+ };
118
+ query: {
119
+ status?: "active" | "expired" | "revoked" | undefined;
120
+ includeResolved?: "true" | "false" | undefined;
121
+ };
122
+ }, {
123
+ params: {
124
+ userId: string;
125
+ };
126
+ query: {
127
+ status?: "active" | "expired" | "revoked" | undefined;
128
+ includeResolved?: "true" | "false" | undefined;
129
+ };
130
+ }>;
131
+ export declare const submitBanAppealSchema: z.ZodObject<{
132
+ params: z.ZodObject<{
133
+ banId: z.ZodString;
134
+ }, "strip", z.ZodTypeAny, {
135
+ banId: string;
136
+ }, {
137
+ banId: string;
138
+ }>;
139
+ body: z.ZodObject<{
140
+ appealReason: z.ZodString;
141
+ }, "strict", z.ZodTypeAny, {
142
+ appealReason: string;
143
+ }, {
144
+ appealReason: string;
145
+ }>;
146
+ }, "strip", z.ZodTypeAny, {
147
+ params: {
148
+ banId: string;
149
+ };
150
+ body: {
151
+ appealReason: string;
152
+ };
153
+ }, {
154
+ params: {
155
+ banId: string;
156
+ };
157
+ body: {
158
+ appealReason: string;
159
+ };
160
+ }>;
161
+ export declare const submitSuspensionAppealSchema: z.ZodObject<{
162
+ params: z.ZodObject<{
163
+ suspensionId: z.ZodString;
164
+ }, "strip", z.ZodTypeAny, {
165
+ suspensionId: string;
166
+ }, {
167
+ suspensionId: string;
168
+ }>;
169
+ body: z.ZodObject<{
170
+ appealReason: z.ZodString;
171
+ }, "strict", z.ZodTypeAny, {
172
+ appealReason: string;
173
+ }, {
174
+ appealReason: string;
175
+ }>;
176
+ }, "strip", z.ZodTypeAny, {
177
+ params: {
178
+ suspensionId: string;
179
+ };
180
+ body: {
181
+ appealReason: string;
182
+ };
183
+ }, {
184
+ params: {
185
+ suspensionId: string;
186
+ };
187
+ body: {
188
+ appealReason: string;
189
+ };
190
+ }>;
191
+ export declare const createBanSchema: z.ZodObject<{
192
+ params: z.ZodObject<{
193
+ userId: z.ZodString;
194
+ }, "strip", z.ZodTypeAny, {
195
+ userId: string;
196
+ }, {
197
+ userId: string;
198
+ }>;
199
+ body: z.ZodObject<{
200
+ reason: z.ZodString;
201
+ isPermanent: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
202
+ }, "strict", z.ZodTypeAny, {
203
+ reason: string;
204
+ isPermanent: boolean;
205
+ }, {
206
+ reason: string;
207
+ isPermanent?: boolean | undefined;
208
+ }>;
209
+ }, "strip", z.ZodTypeAny, {
210
+ params: {
211
+ userId: string;
212
+ };
213
+ body: {
214
+ reason: string;
215
+ isPermanent: boolean;
216
+ };
217
+ }, {
218
+ params: {
219
+ userId: string;
220
+ };
221
+ body: {
222
+ reason: string;
223
+ isPermanent?: boolean | undefined;
224
+ };
225
+ }>;
226
+ export declare const createSuspensionSchema: z.ZodObject<{
227
+ params: z.ZodObject<{
228
+ userId: z.ZodString;
229
+ }, "strip", z.ZodTypeAny, {
230
+ userId: string;
231
+ }, {
232
+ userId: string;
233
+ }>;
234
+ body: z.ZodObject<{
235
+ reason: z.ZodString;
236
+ endsAt: z.ZodEffects<z.ZodString, string, string>;
237
+ }, "strict", z.ZodTypeAny, {
238
+ reason: string;
239
+ endsAt: string;
240
+ }, {
241
+ reason: string;
242
+ endsAt: string;
243
+ }>;
244
+ }, "strip", z.ZodTypeAny, {
245
+ params: {
246
+ userId: string;
247
+ };
248
+ body: {
249
+ reason: string;
250
+ endsAt: string;
251
+ };
252
+ }, {
253
+ params: {
254
+ userId: string;
255
+ };
256
+ body: {
257
+ reason: string;
258
+ endsAt: string;
259
+ };
260
+ }>;
2
261
  export declare const listBansSchema: z.ZodObject<{
3
262
  query: z.ZodEffects<z.ZodObject<{
4
263
  page: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodString>, number, string | undefined>, z.ZodNumber>;
@@ -14,81 +273,81 @@ export declare const listBansSchema: z.ZodObject<{
14
273
  sortBy: z.ZodOptional<z.ZodEnum<["bannedAt", "createdAt", "reason"]>>;
15
274
  sortOrder: z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>;
16
275
  }, "strip", z.ZodTypeAny, {
17
- limit: number;
18
276
  page: number;
19
- search?: string | undefined;
277
+ limit: number;
278
+ status?: "active" | "revoked" | undefined;
20
279
  userId?: string | undefined;
21
280
  isPermanent?: "true" | "false" | undefined;
22
281
  appealStatus?: "pending" | "approved" | "rejected" | undefined;
23
- status?: "active" | "revoked" | undefined;
24
- sortBy?: "createdAt" | "reason" | "bannedAt" | undefined;
25
282
  fromDate?: string | undefined;
26
283
  toDate?: string | undefined;
27
- sortOrder?: "DESC" | "ASC" | undefined;
28
- }, {
29
284
  search?: string | undefined;
30
- limit?: string | undefined;
285
+ sortBy?: "reason" | "bannedAt" | "createdAt" | undefined;
286
+ sortOrder?: "ASC" | "DESC" | undefined;
287
+ }, {
288
+ status?: "active" | "revoked" | undefined;
31
289
  userId?: string | undefined;
32
290
  isPermanent?: "true" | "false" | undefined;
33
- appealStatus?: "pending" | "approved" | "rejected" | undefined;
34
- status?: "active" | "revoked" | undefined;
35
291
  page?: string | undefined;
36
- sortBy?: "createdAt" | "reason" | "bannedAt" | undefined;
292
+ limit?: string | undefined;
293
+ appealStatus?: "pending" | "approved" | "rejected" | undefined;
37
294
  fromDate?: string | undefined;
38
295
  toDate?: string | undefined;
39
- sortOrder?: "DESC" | "ASC" | undefined;
296
+ search?: string | undefined;
297
+ sortBy?: "reason" | "bannedAt" | "createdAt" | undefined;
298
+ sortOrder?: "ASC" | "DESC" | undefined;
40
299
  }>, {
41
- limit: number;
42
300
  page: number;
43
- search?: string | undefined;
301
+ limit: number;
302
+ status?: "active" | "revoked" | undefined;
44
303
  userId?: string | undefined;
45
304
  isPermanent?: "true" | "false" | undefined;
46
305
  appealStatus?: "pending" | "approved" | "rejected" | undefined;
47
- status?: "active" | "revoked" | undefined;
48
- sortBy?: "createdAt" | "reason" | "bannedAt" | undefined;
49
306
  fromDate?: string | undefined;
50
307
  toDate?: string | undefined;
51
- sortOrder?: "DESC" | "ASC" | undefined;
52
- }, {
53
308
  search?: string | undefined;
54
- limit?: string | undefined;
309
+ sortBy?: "reason" | "bannedAt" | "createdAt" | undefined;
310
+ sortOrder?: "ASC" | "DESC" | undefined;
311
+ }, {
312
+ status?: "active" | "revoked" | undefined;
55
313
  userId?: string | undefined;
56
314
  isPermanent?: "true" | "false" | undefined;
57
- appealStatus?: "pending" | "approved" | "rejected" | undefined;
58
- status?: "active" | "revoked" | undefined;
59
315
  page?: string | undefined;
60
- sortBy?: "createdAt" | "reason" | "bannedAt" | undefined;
316
+ limit?: string | undefined;
317
+ appealStatus?: "pending" | "approved" | "rejected" | undefined;
61
318
  fromDate?: string | undefined;
62
319
  toDate?: string | undefined;
63
- sortOrder?: "DESC" | "ASC" | undefined;
320
+ search?: string | undefined;
321
+ sortBy?: "reason" | "bannedAt" | "createdAt" | undefined;
322
+ sortOrder?: "ASC" | "DESC" | undefined;
64
323
  }>;
65
324
  }, "strip", z.ZodTypeAny, {
66
325
  query: {
67
- limit: number;
68
326
  page: number;
69
- search?: string | undefined;
327
+ limit: number;
328
+ status?: "active" | "revoked" | undefined;
70
329
  userId?: string | undefined;
71
330
  isPermanent?: "true" | "false" | undefined;
72
331
  appealStatus?: "pending" | "approved" | "rejected" | undefined;
73
- status?: "active" | "revoked" | undefined;
74
- sortBy?: "createdAt" | "reason" | "bannedAt" | undefined;
75
332
  fromDate?: string | undefined;
76
333
  toDate?: string | undefined;
77
- sortOrder?: "DESC" | "ASC" | undefined;
334
+ search?: string | undefined;
335
+ sortBy?: "reason" | "bannedAt" | "createdAt" | undefined;
336
+ sortOrder?: "ASC" | "DESC" | undefined;
78
337
  };
79
338
  }, {
80
339
  query: {
81
- search?: string | undefined;
82
- limit?: string | undefined;
340
+ status?: "active" | "revoked" | undefined;
83
341
  userId?: string | undefined;
84
342
  isPermanent?: "true" | "false" | undefined;
85
- appealStatus?: "pending" | "approved" | "rejected" | undefined;
86
- status?: "active" | "revoked" | undefined;
87
343
  page?: string | undefined;
88
- sortBy?: "createdAt" | "reason" | "bannedAt" | undefined;
344
+ limit?: string | undefined;
345
+ appealStatus?: "pending" | "approved" | "rejected" | undefined;
89
346
  fromDate?: string | undefined;
90
347
  toDate?: string | undefined;
91
- sortOrder?: "DESC" | "ASC" | undefined;
348
+ search?: string | undefined;
349
+ sortBy?: "reason" | "bannedAt" | "createdAt" | undefined;
350
+ sortOrder?: "ASC" | "DESC" | undefined;
92
351
  };
93
352
  }>;
94
353
  export declare const listSuspensionsSchema: z.ZodObject<{
@@ -105,75 +364,125 @@ export declare const listSuspensionsSchema: z.ZodObject<{
105
364
  sortBy: z.ZodOptional<z.ZodEnum<["startedAt", "endsAt", "createdAt", "reason"]>>;
106
365
  sortOrder: z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>;
107
366
  }, "strip", z.ZodTypeAny, {
108
- limit: number;
109
367
  page: number;
110
- search?: string | undefined;
368
+ limit: number;
369
+ status?: "active" | "expired" | "revoked" | undefined;
111
370
  userId?: string | undefined;
112
371
  appealStatus?: "pending" | "approved" | "rejected" | undefined;
113
- status?: "active" | "revoked" | "expired" | undefined;
114
- sortBy?: "createdAt" | "reason" | "endsAt" | "startedAt" | undefined;
115
372
  fromDate?: string | undefined;
116
373
  toDate?: string | undefined;
117
- sortOrder?: "DESC" | "ASC" | undefined;
118
- }, {
119
374
  search?: string | undefined;
120
- limit?: string | undefined;
375
+ sortBy?: "reason" | "endsAt" | "createdAt" | "startedAt" | undefined;
376
+ sortOrder?: "ASC" | "DESC" | undefined;
377
+ }, {
378
+ status?: "active" | "expired" | "revoked" | undefined;
121
379
  userId?: string | undefined;
122
- appealStatus?: "pending" | "approved" | "rejected" | undefined;
123
- status?: "active" | "revoked" | "expired" | undefined;
124
380
  page?: string | undefined;
125
- sortBy?: "createdAt" | "reason" | "endsAt" | "startedAt" | undefined;
381
+ limit?: string | undefined;
382
+ appealStatus?: "pending" | "approved" | "rejected" | undefined;
126
383
  fromDate?: string | undefined;
127
384
  toDate?: string | undefined;
128
- sortOrder?: "DESC" | "ASC" | undefined;
385
+ search?: string | undefined;
386
+ sortBy?: "reason" | "endsAt" | "createdAt" | "startedAt" | undefined;
387
+ sortOrder?: "ASC" | "DESC" | undefined;
129
388
  }>, {
130
- limit: number;
131
389
  page: number;
132
- search?: string | undefined;
390
+ limit: number;
391
+ status?: "active" | "expired" | "revoked" | undefined;
133
392
  userId?: string | undefined;
134
393
  appealStatus?: "pending" | "approved" | "rejected" | undefined;
135
- status?: "active" | "revoked" | "expired" | undefined;
136
- sortBy?: "createdAt" | "reason" | "endsAt" | "startedAt" | undefined;
137
394
  fromDate?: string | undefined;
138
395
  toDate?: string | undefined;
139
- sortOrder?: "DESC" | "ASC" | undefined;
140
- }, {
141
396
  search?: string | undefined;
142
- limit?: string | undefined;
397
+ sortBy?: "reason" | "endsAt" | "createdAt" | "startedAt" | undefined;
398
+ sortOrder?: "ASC" | "DESC" | undefined;
399
+ }, {
400
+ status?: "active" | "expired" | "revoked" | undefined;
143
401
  userId?: string | undefined;
144
- appealStatus?: "pending" | "approved" | "rejected" | undefined;
145
- status?: "active" | "revoked" | "expired" | undefined;
146
402
  page?: string | undefined;
147
- sortBy?: "createdAt" | "reason" | "endsAt" | "startedAt" | undefined;
403
+ limit?: string | undefined;
404
+ appealStatus?: "pending" | "approved" | "rejected" | undefined;
148
405
  fromDate?: string | undefined;
149
406
  toDate?: string | undefined;
150
- sortOrder?: "DESC" | "ASC" | undefined;
407
+ search?: string | undefined;
408
+ sortBy?: "reason" | "endsAt" | "createdAt" | "startedAt" | undefined;
409
+ sortOrder?: "ASC" | "DESC" | undefined;
151
410
  }>;
152
411
  }, "strip", z.ZodTypeAny, {
153
412
  query: {
154
- limit: number;
155
413
  page: number;
156
- search?: string | undefined;
414
+ limit: number;
415
+ status?: "active" | "expired" | "revoked" | undefined;
157
416
  userId?: string | undefined;
158
417
  appealStatus?: "pending" | "approved" | "rejected" | undefined;
159
- status?: "active" | "revoked" | "expired" | undefined;
160
- sortBy?: "createdAt" | "reason" | "endsAt" | "startedAt" | undefined;
161
418
  fromDate?: string | undefined;
162
419
  toDate?: string | undefined;
163
- sortOrder?: "DESC" | "ASC" | undefined;
420
+ search?: string | undefined;
421
+ sortBy?: "reason" | "endsAt" | "createdAt" | "startedAt" | undefined;
422
+ sortOrder?: "ASC" | "DESC" | undefined;
164
423
  };
165
424
  }, {
166
425
  query: {
167
- search?: string | undefined;
168
- limit?: string | undefined;
426
+ status?: "active" | "expired" | "revoked" | undefined;
169
427
  userId?: string | undefined;
428
+ page?: string | undefined;
429
+ limit?: string | undefined;
170
430
  appealStatus?: "pending" | "approved" | "rejected" | undefined;
171
- status?: "active" | "revoked" | "expired" | undefined;
431
+ fromDate?: string | undefined;
432
+ toDate?: string | undefined;
433
+ search?: string | undefined;
434
+ sortBy?: "reason" | "endsAt" | "createdAt" | "startedAt" | undefined;
435
+ sortOrder?: "ASC" | "DESC" | undefined;
436
+ };
437
+ }>;
438
+ export declare const listPendingAppealsSchema: z.ZodObject<{
439
+ query: z.ZodEffects<z.ZodObject<{
440
+ page: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodString>, number, string | undefined>, z.ZodNumber>;
441
+ limit: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodString>, number, string | undefined>, z.ZodNumber>;
442
+ } & {
443
+ type: z.ZodOptional<z.ZodEnum<["ban", "suspension"]>>;
444
+ fromDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
445
+ toDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
446
+ }, "strip", z.ZodTypeAny, {
447
+ page: number;
448
+ limit: number;
449
+ type?: "ban" | "suspension" | undefined;
450
+ fromDate?: string | undefined;
451
+ toDate?: string | undefined;
452
+ }, {
453
+ type?: "ban" | "suspension" | undefined;
454
+ page?: string | undefined;
455
+ limit?: string | undefined;
456
+ fromDate?: string | undefined;
457
+ toDate?: string | undefined;
458
+ }>, {
459
+ page: number;
460
+ limit: number;
461
+ type?: "ban" | "suspension" | undefined;
462
+ fromDate?: string | undefined;
463
+ toDate?: string | undefined;
464
+ }, {
465
+ type?: "ban" | "suspension" | undefined;
172
466
  page?: string | undefined;
173
- sortBy?: "createdAt" | "reason" | "endsAt" | "startedAt" | undefined;
467
+ limit?: string | undefined;
468
+ fromDate?: string | undefined;
469
+ toDate?: string | undefined;
470
+ }>;
471
+ }, "strip", z.ZodTypeAny, {
472
+ query: {
473
+ page: number;
474
+ limit: number;
475
+ type?: "ban" | "suspension" | undefined;
476
+ fromDate?: string | undefined;
477
+ toDate?: string | undefined;
478
+ };
479
+ }, {
480
+ query: {
481
+ type?: "ban" | "suspension" | undefined;
482
+ page?: string | undefined;
483
+ limit?: string | undefined;
174
484
  fromDate?: string | undefined;
175
485
  toDate?: string | undefined;
176
- sortOrder?: "DESC" | "ASC" | undefined;
177
486
  };
178
487
  }>;
179
488
  export declare const revokeBanSchema: z.ZodObject<{
@@ -192,19 +501,19 @@ export declare const revokeBanSchema: z.ZodObject<{
192
501
  revocationReason?: string | undefined;
193
502
  }>;
194
503
  }, "strip", z.ZodTypeAny, {
195
- body: {
196
- revocationReason?: string | undefined;
197
- };
198
504
  params: {
199
505
  banId: string;
200
506
  };
201
- }, {
202
507
  body: {
203
508
  revocationReason?: string | undefined;
204
509
  };
510
+ }, {
205
511
  params: {
206
512
  banId: string;
207
513
  };
514
+ body: {
515
+ revocationReason?: string | undefined;
516
+ };
208
517
  }>;
209
518
  export declare const revokeSuspensionSchema: z.ZodObject<{
210
519
  params: z.ZodObject<{
@@ -222,19 +531,19 @@ export declare const revokeSuspensionSchema: z.ZodObject<{
222
531
  revocationReason?: string | undefined;
223
532
  }>;
224
533
  }, "strip", z.ZodTypeAny, {
225
- body: {
226
- revocationReason?: string | undefined;
227
- };
228
534
  params: {
229
535
  suspensionId: string;
230
536
  };
231
- }, {
232
537
  body: {
233
538
  revocationReason?: string | undefined;
234
539
  };
540
+ }, {
235
541
  params: {
236
542
  suspensionId: string;
237
543
  };
544
+ body: {
545
+ revocationReason?: string | undefined;
546
+ };
238
547
  }>;
239
548
  export declare const extendSuspensionSchema: z.ZodObject<{
240
549
  params: z.ZodObject<{
@@ -261,70 +570,20 @@ export declare const extendSuspensionSchema: z.ZodObject<{
261
570
  extensionReason?: string | undefined;
262
571
  }>;
263
572
  }, "strip", z.ZodTypeAny, {
264
- body: {
265
- newEndDate: string;
266
- extensionReason?: string | undefined;
267
- };
268
573
  params: {
269
574
  suspensionId: string;
270
575
  };
271
- }, {
272
576
  body: {
273
577
  newEndDate: string;
274
578
  extensionReason?: string | undefined;
275
579
  };
580
+ }, {
276
581
  params: {
277
582
  suspensionId: string;
278
583
  };
279
- }>;
280
- export declare const listPendingAppealsSchema: z.ZodObject<{
281
- query: z.ZodEffects<z.ZodObject<{
282
- page: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodString>, number, string | undefined>, z.ZodNumber>;
283
- limit: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodString>, number, string | undefined>, z.ZodNumber>;
284
- } & {
285
- type: z.ZodOptional<z.ZodEnum<["ban", "suspension"]>>;
286
- fromDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
287
- toDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
288
- }, "strip", z.ZodTypeAny, {
289
- limit: number;
290
- page: number;
291
- type?: "ban" | "suspension" | undefined;
292
- fromDate?: string | undefined;
293
- toDate?: string | undefined;
294
- }, {
295
- type?: "ban" | "suspension" | undefined;
296
- limit?: string | undefined;
297
- page?: string | undefined;
298
- fromDate?: string | undefined;
299
- toDate?: string | undefined;
300
- }>, {
301
- limit: number;
302
- page: number;
303
- type?: "ban" | "suspension" | undefined;
304
- fromDate?: string | undefined;
305
- toDate?: string | undefined;
306
- }, {
307
- type?: "ban" | "suspension" | undefined;
308
- limit?: string | undefined;
309
- page?: string | undefined;
310
- fromDate?: string | undefined;
311
- toDate?: string | undefined;
312
- }>;
313
- }, "strip", z.ZodTypeAny, {
314
- query: {
315
- limit: number;
316
- page: number;
317
- type?: "ban" | "suspension" | undefined;
318
- fromDate?: string | undefined;
319
- toDate?: string | undefined;
320
- };
321
- }, {
322
- query: {
323
- type?: "ban" | "suspension" | undefined;
324
- limit?: string | undefined;
325
- page?: string | undefined;
326
- fromDate?: string | undefined;
327
- toDate?: string | undefined;
584
+ body: {
585
+ newEndDate: string;
586
+ extensionReason?: string | undefined;
328
587
  };
329
588
  }>;
330
589
  export declare const reviewAppealSchema: z.ZodObject<{
@@ -349,23 +608,23 @@ export declare const reviewAppealSchema: z.ZodObject<{
349
608
  adminNotes?: string | undefined;
350
609
  }>;
351
610
  }, "strip", z.ZodTypeAny, {
352
- body: {
353
- appealStatus: "approved" | "rejected";
354
- adminNotes?: string | undefined;
355
- };
356
611
  params: {
357
612
  banId?: string | undefined;
358
613
  suspensionId?: string | undefined;
359
614
  };
360
- }, {
361
615
  body: {
362
616
  appealStatus: "approved" | "rejected";
363
617
  adminNotes?: string | undefined;
364
618
  };
619
+ }, {
365
620
  params: {
366
621
  banId?: string | undefined;
367
622
  suspensionId?: string | undefined;
368
623
  };
624
+ body: {
625
+ appealStatus: "approved" | "rejected";
626
+ adminNotes?: string | undefined;
627
+ };
369
628
  }>;
370
629
  export declare const exportBansSchema: z.ZodObject<{
371
630
  query: z.ZodEffects<z.ZodObject<{
@@ -402,3 +661,38 @@ export declare const exportBansSchema: z.ZodObject<{
402
661
  format?: "csv" | undefined;
403
662
  };
404
663
  }>;
664
+ export declare const exportSuspensionsSchema: z.ZodObject<{
665
+ query: z.ZodEffects<z.ZodObject<{
666
+ fromDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
667
+ toDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
668
+ format: z.ZodDefault<z.ZodEnum<["csv"]>>;
669
+ }, "strip", z.ZodTypeAny, {
670
+ format: "csv";
671
+ fromDate?: string | undefined;
672
+ toDate?: string | undefined;
673
+ }, {
674
+ fromDate?: string | undefined;
675
+ toDate?: string | undefined;
676
+ format?: "csv" | undefined;
677
+ }>, {
678
+ format: "csv";
679
+ fromDate?: string | undefined;
680
+ toDate?: string | undefined;
681
+ }, {
682
+ fromDate?: string | undefined;
683
+ toDate?: string | undefined;
684
+ format?: "csv" | undefined;
685
+ }>;
686
+ }, "strip", z.ZodTypeAny, {
687
+ query: {
688
+ format: "csv";
689
+ fromDate?: string | undefined;
690
+ toDate?: string | undefined;
691
+ };
692
+ }, {
693
+ query: {
694
+ fromDate?: string | undefined;
695
+ toDate?: string | undefined;
696
+ format?: "csv" | undefined;
697
+ };
698
+ }>;
@@ -1,10 +1,149 @@
1
1
  "use strict";
2
+ // import { z } from "zod";
3
+ // import { dateValidator, normalizeDate } from "./dateRange.validations";
2
4
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.exportBansSchema = exports.reviewAppealSchema = exports.listPendingAppealsSchema = exports.extendSuspensionSchema = exports.revokeSuspensionSchema = exports.revokeBanSchema = exports.listSuspensionsSchema = exports.listBansSchema = void 0;
5
+ 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;
6
+ // const uuidSchema = z.string().uuid("Invalid UUID format");
7
+ // // Base query schema with common pagination fields
8
+ // const paginationSchema = z.object({
9
+ // page: z
10
+ // .string()
11
+ // .optional()
12
+ // .transform((val) => (val ? parseInt(val) : 1))
13
+ // .pipe(z.number().min(1)),
14
+ // limit: z
15
+ // .string()
16
+ // .optional()
17
+ // .transform((val) => (val ? parseInt(val) : 20))
18
+ // .pipe(z.number().min(1).max(100)),
19
+ // });
20
+ // export const listBansSchema = z.object({
21
+ // query: paginationSchema
22
+ // .extend({
23
+ // userId: z.string().uuid("Invalid user ID").optional(),
24
+ // status: z.enum(["active", "revoked"]).optional(),
25
+ // appealStatus: z.enum(["pending", "approved", "rejected"]).optional(),
26
+ // isPermanent: z.enum(["true", "false"]).optional(),
27
+ // fromDate: dateValidator.optional(),
28
+ // toDate: dateValidator.optional(),
29
+ // search: z.string().optional(),
30
+ // sortBy: z.enum(["bannedAt", "createdAt", "reason"]).optional(),
31
+ // sortOrder: z.enum(["ASC", "DESC"]).optional(),
32
+ // })
33
+ // .transform((data) => {
34
+ // // Normalize dates for DB queries
35
+ // if (data.fromDate) {
36
+ // data.fromDate = normalizeDate(data.fromDate);
37
+ // }
38
+ // if (data.toDate) {
39
+ // data.toDate = normalizeDate(data.toDate);
40
+ // }
41
+ // return data;
42
+ // }),
43
+ // });
44
+ // export const listSuspensionsSchema = z.object({
45
+ // query: paginationSchema
46
+ // .extend({
47
+ // userId: z.string().uuid("Invalid user ID").optional(),
48
+ // status: z.enum(["active", "expired", "revoked"]).optional(),
49
+ // appealStatus: z.enum(["pending", "approved", "rejected"]).optional(),
50
+ // fromDate: dateValidator.optional(),
51
+ // toDate: dateValidator.optional(),
52
+ // search: z.string().optional(),
53
+ // sortBy: z.enum(["startedAt", "endsAt", "createdAt", "reason"]).optional(),
54
+ // sortOrder: z.enum(["ASC", "DESC"]).optional(),
55
+ // })
56
+ // .transform((data) => {
57
+ // // Normalize dates for DB queries
58
+ // if (data.fromDate) {
59
+ // data.fromDate = normalizeDate(data.fromDate);
60
+ // }
61
+ // if (data.toDate) {
62
+ // data.toDate = normalizeDate(data.toDate);
63
+ // }
64
+ // return data;
65
+ // }),
66
+ // });
67
+ // export const revokeBanSchema = z.object({
68
+ // params: z.object({ banId: uuidSchema }),
69
+ // body: z.object({ revocationReason: z.string().max(500).optional() }).strict(),
70
+ // });
71
+ // export const revokeSuspensionSchema = z.object({
72
+ // params: z.object({ suspensionId: uuidSchema }),
73
+ // body: z.object({ revocationReason: z.string().max(500).optional() }).strict(),
74
+ // });
75
+ // export const extendSuspensionSchema = z.object({
76
+ // params: z.object({ suspensionId: uuidSchema }),
77
+ // body: z
78
+ // .object({
79
+ // newEndDate: dateValidator.refine(
80
+ // (date) => {
81
+ // const normalizedDate = normalizeDate(date);
82
+ // return new Date(normalizedDate) > new Date();
83
+ // },
84
+ // { message: "New end date must be in the future" }
85
+ // ),
86
+ // extensionReason: z.string().max(500).optional(),
87
+ // })
88
+ // .strict()
89
+ // .transform((data) => ({
90
+ // ...data,
91
+ // newEndDate: normalizeDate(data.newEndDate), // Normalize for DB
92
+ // })),
93
+ // });
94
+ // export const listPendingAppealsSchema = z.object({
95
+ // query: paginationSchema
96
+ // .extend({
97
+ // type: z.enum(["ban", "suspension"]).optional(),
98
+ // fromDate: dateValidator.optional(),
99
+ // toDate: dateValidator.optional(),
100
+ // })
101
+ // .transform((data) => {
102
+ // // Normalize dates for DB queries
103
+ // if (data.fromDate) {
104
+ // data.fromDate = normalizeDate(data.fromDate);
105
+ // }
106
+ // if (data.toDate) {
107
+ // data.toDate = normalizeDate(data.toDate);
108
+ // }
109
+ // return data;
110
+ // }),
111
+ // });
112
+ // export const reviewAppealSchema = z.object({
113
+ // params: z.object({
114
+ // banId: uuidSchema.optional(),
115
+ // suspensionId: uuidSchema.optional(),
116
+ // }),
117
+ // body: z
118
+ // .object({
119
+ // appealStatus: z.enum(["approved", "rejected"]),
120
+ // adminNotes: z.string().max(1000).optional(),
121
+ // })
122
+ // .strict(),
123
+ // });
124
+ // export const exportBansSchema = z.object({
125
+ // query: z
126
+ // .object({
127
+ // fromDate: dateValidator.optional(),
128
+ // toDate: dateValidator.optional(),
129
+ // format: z.enum(["csv"]).default("csv"),
130
+ // })
131
+ // .transform((data) => {
132
+ // // Normalize dates for DB queries
133
+ // if (data.fromDate) {
134
+ // data.fromDate = normalizeDate(data.fromDate);
135
+ // }
136
+ // if (data.toDate) {
137
+ // data.toDate = normalizeDate(data.toDate);
138
+ // }
139
+ // return data;
140
+ // }),
141
+ // });
142
+ // src/validations/moderation.validations.ts
4
143
  const zod_1 = require("zod");
5
144
  const dateRange_validations_1 = require("./dateRange.validations");
6
145
  const uuidSchema = zod_1.z.string().uuid("Invalid UUID format");
7
- // Base query schema with common pagination fields
146
+ // ==================== BASE SCHEMAS ====================
8
147
  const paginationSchema = zod_1.z.object({
9
148
  page: zod_1.z
10
149
  .string()
@@ -17,6 +156,104 @@ const paginationSchema = zod_1.z.object({
17
156
  .transform((val) => (val ? parseInt(val) : 20))
18
157
  .pipe(zod_1.z.number().min(1).max(100)),
19
158
  });
159
+ // ==================== OPERATIONS SCHEMAS ====================
160
+ exports.getBanSchema = zod_1.z.object({
161
+ params: zod_1.z.object({
162
+ banId: uuidSchema,
163
+ }),
164
+ });
165
+ exports.getSuspensionSchema = zod_1.z.object({
166
+ params: zod_1.z.object({
167
+ suspensionId: uuidSchema,
168
+ }),
169
+ });
170
+ exports.getUserRestrictionsSchema = zod_1.z.object({
171
+ params: zod_1.z.object({
172
+ userId: uuidSchema,
173
+ }),
174
+ query: zod_1.z.object({
175
+ includeResolved: zod_1.z.enum(["true", "false"]).optional(),
176
+ }),
177
+ });
178
+ exports.getUserBansSchema = zod_1.z.object({
179
+ params: zod_1.z.object({
180
+ userId: uuidSchema,
181
+ }),
182
+ query: zod_1.z.object({
183
+ includeResolved: zod_1.z.enum(["true", "false"]).optional(),
184
+ }),
185
+ });
186
+ exports.getUserSuspensionsSchema = zod_1.z.object({
187
+ params: zod_1.z.object({
188
+ userId: uuidSchema,
189
+ }),
190
+ query: zod_1.z.object({
191
+ includeResolved: zod_1.z.enum(["true", "false"]).optional(),
192
+ status: zod_1.z.enum(["active", "expired", "revoked"]).optional(),
193
+ }),
194
+ });
195
+ exports.submitBanAppealSchema = zod_1.z.object({
196
+ params: zod_1.z.object({
197
+ banId: uuidSchema,
198
+ }),
199
+ body: zod_1.z
200
+ .object({
201
+ appealReason: zod_1.z
202
+ .string()
203
+ .min(10, "Appeal reason must be at least 10 characters")
204
+ .max(2000, "Appeal reason cannot exceed 2000 characters"),
205
+ })
206
+ .strict(),
207
+ });
208
+ exports.submitSuspensionAppealSchema = zod_1.z.object({
209
+ params: zod_1.z.object({
210
+ suspensionId: uuidSchema,
211
+ }),
212
+ body: zod_1.z
213
+ .object({
214
+ appealReason: zod_1.z
215
+ .string()
216
+ .min(10, "Appeal reason must be at least 10 characters")
217
+ .max(2000, "Appeal reason cannot exceed 2000 characters"),
218
+ })
219
+ .strict(),
220
+ });
221
+ // ==================== MANAGEMENT SCHEMAS ====================
222
+ // Create Ban/ Suspension
223
+ exports.createBanSchema = zod_1.z.object({
224
+ params: zod_1.z.object({
225
+ userId: uuidSchema,
226
+ }),
227
+ body: zod_1.z
228
+ .object({
229
+ reason: zod_1.z
230
+ .string()
231
+ .min(5, "Reason must be at least 5 characters")
232
+ .max(1000, "Reason cannot exceed 1000 characters"),
233
+ isPermanent: zod_1.z.boolean().optional().default(false),
234
+ })
235
+ .strict(),
236
+ });
237
+ exports.createSuspensionSchema = zod_1.z.object({
238
+ params: zod_1.z.object({
239
+ userId: uuidSchema,
240
+ }),
241
+ body: zod_1.z
242
+ .object({
243
+ reason: zod_1.z
244
+ .string()
245
+ .min(5, "Reason must be at least 5 characters")
246
+ .max(1000, "Reason cannot exceed 1000 characters"),
247
+ endsAt: zod_1.z
248
+ .string()
249
+ .datetime("Invalid date format")
250
+ .refine((date) => new Date(date) > new Date(), {
251
+ message: "End date must be in the future",
252
+ }),
253
+ })
254
+ .strict(),
255
+ });
256
+ // List All
20
257
  exports.listBansSchema = zod_1.z.object({
21
258
  query: paginationSchema
22
259
  .extend({
@@ -31,7 +268,6 @@ exports.listBansSchema = zod_1.z.object({
31
268
  sortOrder: zod_1.z.enum(["ASC", "DESC"]).optional(),
32
269
  })
33
270
  .transform((data) => {
34
- // Normalize dates for DB queries
35
271
  if (data.fromDate) {
36
272
  data.fromDate = (0, dateRange_validations_1.normalizeDate)(data.fromDate);
37
273
  }
@@ -54,7 +290,6 @@ exports.listSuspensionsSchema = zod_1.z.object({
54
290
  sortOrder: zod_1.z.enum(["ASC", "DESC"]).optional(),
55
291
  })
56
292
  .transform((data) => {
57
- // Normalize dates for DB queries
58
293
  if (data.fromDate) {
59
294
  data.fromDate = (0, dateRange_validations_1.normalizeDate)(data.fromDate);
60
295
  }
@@ -64,6 +299,24 @@ exports.listSuspensionsSchema = zod_1.z.object({
64
299
  return data;
65
300
  }),
66
301
  });
302
+ exports.listPendingAppealsSchema = zod_1.z.object({
303
+ query: paginationSchema
304
+ .extend({
305
+ type: zod_1.z.enum(["ban", "suspension"]).optional(),
306
+ fromDate: dateRange_validations_1.dateValidator.optional(),
307
+ toDate: dateRange_validations_1.dateValidator.optional(),
308
+ })
309
+ .transform((data) => {
310
+ if (data.fromDate) {
311
+ data.fromDate = (0, dateRange_validations_1.normalizeDate)(data.fromDate);
312
+ }
313
+ if (data.toDate) {
314
+ data.toDate = (0, dateRange_validations_1.normalizeDate)(data.toDate);
315
+ }
316
+ return data;
317
+ }),
318
+ });
319
+ // Revoke
67
320
  exports.revokeBanSchema = zod_1.z.object({
68
321
  params: zod_1.z.object({ banId: uuidSchema }),
69
322
  body: zod_1.z.object({ revocationReason: zod_1.z.string().max(500).optional() }).strict(),
@@ -72,6 +325,7 @@ exports.revokeSuspensionSchema = zod_1.z.object({
72
325
  params: zod_1.z.object({ suspensionId: uuidSchema }),
73
326
  body: zod_1.z.object({ revocationReason: zod_1.z.string().max(500).optional() }).strict(),
74
327
  });
328
+ // Extend
75
329
  exports.extendSuspensionSchema = zod_1.z.object({
76
330
  params: zod_1.z.object({ suspensionId: uuidSchema }),
77
331
  body: zod_1.z
@@ -85,27 +339,10 @@ exports.extendSuspensionSchema = zod_1.z.object({
85
339
  .strict()
86
340
  .transform((data) => ({
87
341
  ...data,
88
- newEndDate: (0, dateRange_validations_1.normalizeDate)(data.newEndDate), // Normalize for DB
342
+ newEndDate: (0, dateRange_validations_1.normalizeDate)(data.newEndDate),
89
343
  })),
90
344
  });
91
- exports.listPendingAppealsSchema = zod_1.z.object({
92
- query: paginationSchema
93
- .extend({
94
- type: zod_1.z.enum(["ban", "suspension"]).optional(),
95
- fromDate: dateRange_validations_1.dateValidator.optional(),
96
- toDate: dateRange_validations_1.dateValidator.optional(),
97
- })
98
- .transform((data) => {
99
- // Normalize dates for DB queries
100
- if (data.fromDate) {
101
- data.fromDate = (0, dateRange_validations_1.normalizeDate)(data.fromDate);
102
- }
103
- if (data.toDate) {
104
- data.toDate = (0, dateRange_validations_1.normalizeDate)(data.toDate);
105
- }
106
- return data;
107
- }),
108
- });
345
+ // Process Appeals
109
346
  exports.reviewAppealSchema = zod_1.z.object({
110
347
  params: zod_1.z.object({
111
348
  banId: uuidSchema.optional(),
@@ -118,6 +355,7 @@ exports.reviewAppealSchema = zod_1.z.object({
118
355
  })
119
356
  .strict(),
120
357
  });
358
+ // Export
121
359
  exports.exportBansSchema = zod_1.z.object({
122
360
  query: zod_1.z
123
361
  .object({
@@ -126,7 +364,23 @@ exports.exportBansSchema = zod_1.z.object({
126
364
  format: zod_1.z.enum(["csv"]).default("csv"),
127
365
  })
128
366
  .transform((data) => {
129
- // Normalize dates for DB queries
367
+ if (data.fromDate) {
368
+ data.fromDate = (0, dateRange_validations_1.normalizeDate)(data.fromDate);
369
+ }
370
+ if (data.toDate) {
371
+ data.toDate = (0, dateRange_validations_1.normalizeDate)(data.toDate);
372
+ }
373
+ return data;
374
+ }),
375
+ });
376
+ exports.exportSuspensionsSchema = zod_1.z.object({
377
+ query: zod_1.z
378
+ .object({
379
+ fromDate: dateRange_validations_1.dateValidator.optional(),
380
+ toDate: dateRange_validations_1.dateValidator.optional(),
381
+ format: zod_1.z.enum(["csv"]).default("csv"),
382
+ })
383
+ .transform((data) => {
130
384
  if (data.fromDate) {
131
385
  data.fromDate = (0, dateRange_validations_1.normalizeDate)(data.fromDate);
132
386
  }
@@ -191,27 +191,46 @@ export declare const getUsersSchema: z.ZodObject<{
191
191
  };
192
192
  }>;
193
193
  export declare const hireAdminSchema: z.ZodObject<{
194
- body: z.ZodObject<{
194
+ body: z.ZodEffects<z.ZodObject<{
195
195
  email: z.ZodString;
196
196
  firstName: z.ZodString;
197
197
  lastName: z.ZodString;
198
198
  phoneNumber: z.ZodString;
199
199
  password: z.ZodString;
200
- role: z.ZodEnum<["AGENT", "ADMIN"]>;
200
+ role: z.ZodEnum<["AGENT", "ADMIN", "SUPER_ADMIN"]>;
201
+ superAdminPassword: z.ZodOptional<z.ZodString>;
201
202
  }, "strip", z.ZodTypeAny, {
202
203
  phoneNumber: string;
203
204
  firstName: string;
204
205
  lastName: string;
205
206
  email: string;
206
- role: "AGENT" | "ADMIN";
207
+ role: "AGENT" | "ADMIN" | "SUPER_ADMIN";
208
+ password: string;
209
+ superAdminPassword?: string | undefined;
210
+ }, {
211
+ phoneNumber: string;
212
+ firstName: string;
213
+ lastName: string;
214
+ email: string;
215
+ role: "AGENT" | "ADMIN" | "SUPER_ADMIN";
216
+ password: string;
217
+ superAdminPassword?: string | undefined;
218
+ }>, {
219
+ phoneNumber: string;
220
+ firstName: string;
221
+ lastName: string;
222
+ email: string;
223
+ role: "AGENT" | "ADMIN" | "SUPER_ADMIN";
207
224
  password: string;
225
+ superAdminPassword?: string | undefined;
208
226
  }, {
209
227
  phoneNumber: string;
210
228
  firstName: string;
211
229
  lastName: string;
212
230
  email: string;
213
- role: "AGENT" | "ADMIN";
231
+ role: "AGENT" | "ADMIN" | "SUPER_ADMIN";
214
232
  password: string;
233
+ superAdminPassword?: string | undefined;
215
234
  }>;
216
235
  }, "strip", z.ZodTypeAny, {
217
236
  body: {
@@ -219,8 +238,9 @@ export declare const hireAdminSchema: z.ZodObject<{
219
238
  firstName: string;
220
239
  lastName: string;
221
240
  email: string;
222
- role: "AGENT" | "ADMIN";
241
+ role: "AGENT" | "ADMIN" | "SUPER_ADMIN";
223
242
  password: string;
243
+ superAdminPassword?: string | undefined;
224
244
  };
225
245
  }, {
226
246
  body: {
@@ -228,8 +248,9 @@ export declare const hireAdminSchema: z.ZodObject<{
228
248
  firstName: string;
229
249
  lastName: string;
230
250
  email: string;
231
- role: "AGENT" | "ADMIN";
251
+ role: "AGENT" | "ADMIN" | "SUPER_ADMIN";
232
252
  password: string;
253
+ superAdminPassword?: string | undefined;
233
254
  };
234
255
  }>;
235
256
  export declare const promoteAdminSchema: z.ZodObject<{
@@ -384,4 +405,3 @@ export declare const resetPasswordSchema: z.ZodObject<{
384
405
  userId: string;
385
406
  };
386
407
  }>;
387
- export declare const bulkResetPasswordSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
@@ -1,16 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.bulkResetPasswordSchema = exports.resetPasswordSchema = exports.updateAdminSchema = exports.fireEmployeeSchema = exports.demoteAdminSchema = exports.promoteAdminSchema = exports.hireAdminSchema = exports.getUsersSchema = exports.getUserSchema = exports.deleteUserSchema = exports.updateRiderSchema = exports.upgradeToRiderSchema = void 0;
3
+ 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
4
  // src/validations/users.validations.ts
5
5
  const zod_1 = require("zod");
6
6
  const auth_validations_1 = require("./auth.validations");
7
+ const profiles_validations_1 = require("./profiles.validations");
7
8
  // Operations Schemas
8
9
  exports.upgradeToRiderSchema = zod_1.z.object({
9
10
  params: zod_1.z.object({
10
11
  userId: zod_1.z.string().uuid("Invalid user ID format"),
11
12
  }),
12
13
  body: zod_1.z.object({
13
- jacketId: zod_1.z.string().min(5).max(20),
14
+ jacketId: zod_1.z.string().regex(profiles_validations_1.jacketIdRegex, "invalid jacke id"),
14
15
  nationalId: zod_1.z.string().min(5).max(20),
15
16
  phoneNumber: zod_1.z.string().regex(auth_validations_1.phoneRegex, "Invalid phone number format"),
16
17
  plateNumber: zod_1.z.string().min(3).max(10).optional(),
@@ -54,13 +55,25 @@ exports.getUsersSchema = zod_1.z.object({
54
55
  });
55
56
  // Management Schemas
56
57
  exports.hireAdminSchema = zod_1.z.object({
57
- body: zod_1.z.object({
58
+ body: zod_1.z
59
+ .object({
58
60
  email: zod_1.z.string().email(),
59
61
  firstName: zod_1.z.string().min(2).max(100),
60
62
  lastName: zod_1.z.string().min(2).max(100),
61
63
  phoneNumber: zod_1.z.string().regex(auth_validations_1.phoneRegex),
62
64
  password: zod_1.z.string().min(6),
63
- role: zod_1.z.enum(["AGENT", "ADMIN"]),
65
+ role: zod_1.z.enum(["AGENT", "ADMIN", "SUPER_ADMIN"]),
66
+ superAdminPassword: zod_1.z.string().optional(),
67
+ })
68
+ .refine((data) => {
69
+ // If hiring SUPER_ADMIN, superAdminPassword is required
70
+ if (data.role === "SUPER_ADMIN" && !data.superAdminPassword) {
71
+ return false;
72
+ }
73
+ return true;
74
+ }, {
75
+ message: "superAdminPassword is required when hiring SUPER_ADMIN",
76
+ path: ["superAdminPassword"],
64
77
  }),
65
78
  });
66
79
  exports.promoteAdminSchema = zod_1.z.object({
@@ -103,4 +116,3 @@ exports.resetPasswordSchema = zod_1.z.object({
103
116
  userId: zod_1.z.string().uuid("Invalid user ID format"),
104
117
  }),
105
118
  });
106
- exports.bulkResetPasswordSchema = zod_1.z.object({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vr-commons",
3
- "version": "1.0.89",
3
+ "version": "1.0.91",
4
4
  "description": "Shared functions package",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",