vr-commons 1.0.90 → 1.0.92
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/utils/hierarchy.utils.d.ts +38 -0
- package/dist/utils/hierarchy.utils.js +94 -0
- package/dist/validations/index.d.ts +1 -4
- package/dist/validations/index.js +14 -13
- package/dist/validations/moderation.validations.d.ts +426 -132
- package/dist/validations/moderation.validations.js +140 -24
- package/package.json +1 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { User, SecurityClearance } from "vr-models";
|
|
2
|
+
/**
|
|
3
|
+
* Get user's security clearance level
|
|
4
|
+
* If user with security clearance is provided, extract level directly
|
|
5
|
+
* Otherwise fetch from database
|
|
6
|
+
*/
|
|
7
|
+
export declare function getUserLevel(userOrId: User | string, securityClearance?: SecurityClearance): Promise<{
|
|
8
|
+
level: number;
|
|
9
|
+
role: string;
|
|
10
|
+
clearance: SecurityClearance | null;
|
|
11
|
+
}>;
|
|
12
|
+
/**
|
|
13
|
+
* Check if admin level is superior to target level (strictly greater)
|
|
14
|
+
*/
|
|
15
|
+
export declare function isSuperior(adminLevel: number, targetLevel: number): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Check if admin level is subordinate to target level (strictly less)
|
|
18
|
+
*/
|
|
19
|
+
export declare function isSubordinate(adminLevel: number, targetLevel: number): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Check if admin level is equal to target level
|
|
22
|
+
*/
|
|
23
|
+
export declare function isRankEqual(adminLevel: number, targetLevel: number): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Check if admin level is subordinate or equal to target level
|
|
26
|
+
*/
|
|
27
|
+
export declare function isSubordinateOrEqual(adminLevel: number, targetLevel: number): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Check if admin level is superior or equal to target level
|
|
30
|
+
*/
|
|
31
|
+
export declare function isSuperiorOrEqual(adminLevel: number, targetLevel: number): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Validate hierarchy for an action with custom message
|
|
34
|
+
*/
|
|
35
|
+
export declare function validateHierarchy(adminLevel: number, targetLevel: number, action: string, allowEqual?: boolean): {
|
|
36
|
+
allowed: boolean;
|
|
37
|
+
message?: string;
|
|
38
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getUserLevel = getUserLevel;
|
|
4
|
+
exports.isSuperior = isSuperior;
|
|
5
|
+
exports.isSubordinate = isSubordinate;
|
|
6
|
+
exports.isRankEqual = isRankEqual;
|
|
7
|
+
exports.isSubordinateOrEqual = isSubordinateOrEqual;
|
|
8
|
+
exports.isSuperiorOrEqual = isSuperiorOrEqual;
|
|
9
|
+
exports.validateHierarchy = validateHierarchy;
|
|
10
|
+
// src/utils/hierarchy.utils.ts
|
|
11
|
+
const vr_models_1 = require("vr-models");
|
|
12
|
+
/**
|
|
13
|
+
* Get user's security clearance level
|
|
14
|
+
* If user with security clearance is provided, extract level directly
|
|
15
|
+
* Otherwise fetch from database
|
|
16
|
+
*/
|
|
17
|
+
async function getUserLevel(userOrId, securityClearance) {
|
|
18
|
+
let user = null;
|
|
19
|
+
if (typeof userOrId === "string") {
|
|
20
|
+
user = await vr_models_1.User.findByPk(userOrId, {
|
|
21
|
+
include: [{ model: vr_models_1.SecurityClearance, as: "securityClearance" }],
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
user = userOrId;
|
|
26
|
+
}
|
|
27
|
+
if (!user) {
|
|
28
|
+
throw new Error("User not found");
|
|
29
|
+
}
|
|
30
|
+
// Use provided security clearance or get from user
|
|
31
|
+
const clearance = securityClearance || user.securityClearance;
|
|
32
|
+
if (!clearance) {
|
|
33
|
+
throw new Error("Security clearance not found for user");
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
level: clearance.level,
|
|
37
|
+
role: clearance.role,
|
|
38
|
+
clearance,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Check if admin level is superior to target level (strictly greater)
|
|
43
|
+
*/
|
|
44
|
+
function isSuperior(adminLevel, targetLevel) {
|
|
45
|
+
return adminLevel > targetLevel;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Check if admin level is subordinate to target level (strictly less)
|
|
49
|
+
*/
|
|
50
|
+
function isSubordinate(adminLevel, targetLevel) {
|
|
51
|
+
return adminLevel < targetLevel;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Check if admin level is equal to target level
|
|
55
|
+
*/
|
|
56
|
+
function isRankEqual(adminLevel, targetLevel) {
|
|
57
|
+
return adminLevel === targetLevel;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Check if admin level is subordinate or equal to target level
|
|
61
|
+
*/
|
|
62
|
+
function isSubordinateOrEqual(adminLevel, targetLevel) {
|
|
63
|
+
return adminLevel <= targetLevel;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Check if admin level is superior or equal to target level
|
|
67
|
+
*/
|
|
68
|
+
function isSuperiorOrEqual(adminLevel, targetLevel) {
|
|
69
|
+
return adminLevel >= targetLevel;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Validate hierarchy for an action with custom message
|
|
73
|
+
*/
|
|
74
|
+
function validateHierarchy(adminLevel, targetLevel, action, allowEqual = false) {
|
|
75
|
+
if (isSuperior(adminLevel, targetLevel)) {
|
|
76
|
+
return { allowed: true };
|
|
77
|
+
}
|
|
78
|
+
if (isRankEqual(adminLevel, targetLevel)) {
|
|
79
|
+
if (allowEqual) {
|
|
80
|
+
return { allowed: true };
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
allowed: false,
|
|
84
|
+
message: `Cannot ${action} users with equal role level (${adminLevel} = ${targetLevel})`,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
if (isSubordinate(adminLevel, targetLevel)) {
|
|
88
|
+
return {
|
|
89
|
+
allowed: false,
|
|
90
|
+
message: `Cannot ${action} users with higher role level (${adminLevel} < ${targetLevel})`,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
return { allowed: false, message: `Cannot ${action} this user` };
|
|
94
|
+
}
|
|
@@ -1,10 +1,7 @@
|
|
|
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";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
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 = 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; } });
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
292
|
+
limit?: string | undefined;
|
|
293
|
+
appealStatus?: "pending" | "approved" | "rejected" | undefined;
|
|
37
294
|
fromDate?: string | undefined;
|
|
38
295
|
toDate?: string | undefined;
|
|
39
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
316
|
+
limit?: string | undefined;
|
|
317
|
+
appealStatus?: "pending" | "approved" | "rejected" | undefined;
|
|
61
318
|
fromDate?: string | undefined;
|
|
62
319
|
toDate?: string | undefined;
|
|
63
|
-
|
|
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
|
-
|
|
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
|
-
|
|
334
|
+
search?: string | undefined;
|
|
335
|
+
sortBy?: "reason" | "bannedAt" | "createdAt" | undefined;
|
|
336
|
+
sortOrder?: "ASC" | "DESC" | undefined;
|
|
78
337
|
};
|
|
79
338
|
}, {
|
|
80
339
|
query: {
|
|
81
|
-
|
|
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
|
-
|
|
344
|
+
limit?: string | undefined;
|
|
345
|
+
appealStatus?: "pending" | "approved" | "rejected" | undefined;
|
|
89
346
|
fromDate?: string | undefined;
|
|
90
347
|
toDate?: string | undefined;
|
|
91
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
381
|
+
limit?: string | undefined;
|
|
382
|
+
appealStatus?: "pending" | "approved" | "rejected" | undefined;
|
|
126
383
|
fromDate?: string | undefined;
|
|
127
384
|
toDate?: string | undefined;
|
|
128
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
403
|
+
limit?: string | undefined;
|
|
404
|
+
appealStatus?: "pending" | "approved" | "rejected" | undefined;
|
|
148
405
|
fromDate?: string | undefined;
|
|
149
406
|
toDate?: string | undefined;
|
|
150
|
-
|
|
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
|
-
|
|
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
|
-
|
|
420
|
+
search?: string | undefined;
|
|
421
|
+
sortBy?: "reason" | "endsAt" | "createdAt" | "startedAt" | undefined;
|
|
422
|
+
sortOrder?: "ASC" | "DESC" | undefined;
|
|
164
423
|
};
|
|
165
424
|
}, {
|
|
166
425
|
query: {
|
|
167
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
281
|
-
|
|
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,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
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
|
|
4
5
|
const zod_1 = require("zod");
|
|
5
6
|
const dateRange_validations_1 = require("./dateRange.validations");
|
|
6
7
|
const uuidSchema = zod_1.z.string().uuid("Invalid UUID format");
|
|
7
|
-
//
|
|
8
|
+
// ==================== BASE SCHEMAS ====================
|
|
8
9
|
const paginationSchema = zod_1.z.object({
|
|
9
10
|
page: zod_1.z
|
|
10
11
|
.string()
|
|
@@ -17,6 +18,104 @@ const paginationSchema = zod_1.z.object({
|
|
|
17
18
|
.transform((val) => (val ? parseInt(val) : 20))
|
|
18
19
|
.pipe(zod_1.z.number().min(1).max(100)),
|
|
19
20
|
});
|
|
21
|
+
// ==================== OPERATIONS SCHEMAS ====================
|
|
22
|
+
exports.getBanSchema = zod_1.z.object({
|
|
23
|
+
params: zod_1.z.object({
|
|
24
|
+
banId: uuidSchema,
|
|
25
|
+
}),
|
|
26
|
+
});
|
|
27
|
+
exports.getSuspensionSchema = zod_1.z.object({
|
|
28
|
+
params: zod_1.z.object({
|
|
29
|
+
suspensionId: uuidSchema,
|
|
30
|
+
}),
|
|
31
|
+
});
|
|
32
|
+
exports.getUserRestrictionsSchema = zod_1.z.object({
|
|
33
|
+
params: zod_1.z.object({
|
|
34
|
+
userId: uuidSchema,
|
|
35
|
+
}),
|
|
36
|
+
query: zod_1.z.object({
|
|
37
|
+
includeResolved: zod_1.z.enum(["true", "false"]).optional(),
|
|
38
|
+
}),
|
|
39
|
+
});
|
|
40
|
+
exports.getUserBansSchema = zod_1.z.object({
|
|
41
|
+
params: zod_1.z.object({
|
|
42
|
+
userId: uuidSchema,
|
|
43
|
+
}),
|
|
44
|
+
query: zod_1.z.object({
|
|
45
|
+
includeResolved: zod_1.z.enum(["true", "false"]).optional(),
|
|
46
|
+
}),
|
|
47
|
+
});
|
|
48
|
+
exports.getUserSuspensionsSchema = zod_1.z.object({
|
|
49
|
+
params: zod_1.z.object({
|
|
50
|
+
userId: uuidSchema,
|
|
51
|
+
}),
|
|
52
|
+
query: zod_1.z.object({
|
|
53
|
+
includeResolved: zod_1.z.enum(["true", "false"]).optional(),
|
|
54
|
+
status: zod_1.z.enum(["active", "expired", "revoked"]).optional(),
|
|
55
|
+
}),
|
|
56
|
+
});
|
|
57
|
+
exports.submitBanAppealSchema = zod_1.z.object({
|
|
58
|
+
params: zod_1.z.object({
|
|
59
|
+
banId: uuidSchema,
|
|
60
|
+
}),
|
|
61
|
+
body: zod_1.z
|
|
62
|
+
.object({
|
|
63
|
+
appealReason: zod_1.z
|
|
64
|
+
.string()
|
|
65
|
+
.min(10, "Appeal reason must be at least 10 characters")
|
|
66
|
+
.max(2000, "Appeal reason cannot exceed 2000 characters"),
|
|
67
|
+
})
|
|
68
|
+
.strict(),
|
|
69
|
+
});
|
|
70
|
+
exports.submitSuspensionAppealSchema = zod_1.z.object({
|
|
71
|
+
params: zod_1.z.object({
|
|
72
|
+
suspensionId: uuidSchema,
|
|
73
|
+
}),
|
|
74
|
+
body: zod_1.z
|
|
75
|
+
.object({
|
|
76
|
+
appealReason: zod_1.z
|
|
77
|
+
.string()
|
|
78
|
+
.min(10, "Appeal reason must be at least 10 characters")
|
|
79
|
+
.max(2000, "Appeal reason cannot exceed 2000 characters"),
|
|
80
|
+
})
|
|
81
|
+
.strict(),
|
|
82
|
+
});
|
|
83
|
+
// ==================== MANAGEMENT SCHEMAS ====================
|
|
84
|
+
// Create Ban/ Suspension
|
|
85
|
+
exports.createBanSchema = zod_1.z.object({
|
|
86
|
+
params: zod_1.z.object({
|
|
87
|
+
userId: uuidSchema,
|
|
88
|
+
}),
|
|
89
|
+
body: zod_1.z
|
|
90
|
+
.object({
|
|
91
|
+
reason: zod_1.z
|
|
92
|
+
.string()
|
|
93
|
+
.min(5, "Reason must be at least 5 characters")
|
|
94
|
+
.max(1000, "Reason cannot exceed 1000 characters"),
|
|
95
|
+
isPermanent: zod_1.z.boolean().optional().default(false),
|
|
96
|
+
})
|
|
97
|
+
.strict(),
|
|
98
|
+
});
|
|
99
|
+
exports.createSuspensionSchema = zod_1.z.object({
|
|
100
|
+
params: zod_1.z.object({
|
|
101
|
+
userId: uuidSchema,
|
|
102
|
+
}),
|
|
103
|
+
body: zod_1.z
|
|
104
|
+
.object({
|
|
105
|
+
reason: zod_1.z
|
|
106
|
+
.string()
|
|
107
|
+
.min(5, "Reason must be at least 5 characters")
|
|
108
|
+
.max(1000, "Reason cannot exceed 1000 characters"),
|
|
109
|
+
endsAt: zod_1.z
|
|
110
|
+
.string()
|
|
111
|
+
.datetime("Invalid date format")
|
|
112
|
+
.refine((date) => new Date(date) > new Date(), {
|
|
113
|
+
message: "End date must be in the future",
|
|
114
|
+
}),
|
|
115
|
+
})
|
|
116
|
+
.strict(),
|
|
117
|
+
});
|
|
118
|
+
// List All
|
|
20
119
|
exports.listBansSchema = zod_1.z.object({
|
|
21
120
|
query: paginationSchema
|
|
22
121
|
.extend({
|
|
@@ -31,7 +130,6 @@ exports.listBansSchema = zod_1.z.object({
|
|
|
31
130
|
sortOrder: zod_1.z.enum(["ASC", "DESC"]).optional(),
|
|
32
131
|
})
|
|
33
132
|
.transform((data) => {
|
|
34
|
-
// Normalize dates for DB queries
|
|
35
133
|
if (data.fromDate) {
|
|
36
134
|
data.fromDate = (0, dateRange_validations_1.normalizeDate)(data.fromDate);
|
|
37
135
|
}
|
|
@@ -54,7 +152,6 @@ exports.listSuspensionsSchema = zod_1.z.object({
|
|
|
54
152
|
sortOrder: zod_1.z.enum(["ASC", "DESC"]).optional(),
|
|
55
153
|
})
|
|
56
154
|
.transform((data) => {
|
|
57
|
-
// Normalize dates for DB queries
|
|
58
155
|
if (data.fromDate) {
|
|
59
156
|
data.fromDate = (0, dateRange_validations_1.normalizeDate)(data.fromDate);
|
|
60
157
|
}
|
|
@@ -64,6 +161,24 @@ exports.listSuspensionsSchema = zod_1.z.object({
|
|
|
64
161
|
return data;
|
|
65
162
|
}),
|
|
66
163
|
});
|
|
164
|
+
exports.listPendingAppealsSchema = zod_1.z.object({
|
|
165
|
+
query: paginationSchema
|
|
166
|
+
.extend({
|
|
167
|
+
type: zod_1.z.enum(["ban", "suspension"]).optional(),
|
|
168
|
+
fromDate: dateRange_validations_1.dateValidator.optional(),
|
|
169
|
+
toDate: dateRange_validations_1.dateValidator.optional(),
|
|
170
|
+
})
|
|
171
|
+
.transform((data) => {
|
|
172
|
+
if (data.fromDate) {
|
|
173
|
+
data.fromDate = (0, dateRange_validations_1.normalizeDate)(data.fromDate);
|
|
174
|
+
}
|
|
175
|
+
if (data.toDate) {
|
|
176
|
+
data.toDate = (0, dateRange_validations_1.normalizeDate)(data.toDate);
|
|
177
|
+
}
|
|
178
|
+
return data;
|
|
179
|
+
}),
|
|
180
|
+
});
|
|
181
|
+
// Revoke
|
|
67
182
|
exports.revokeBanSchema = zod_1.z.object({
|
|
68
183
|
params: zod_1.z.object({ banId: uuidSchema }),
|
|
69
184
|
body: zod_1.z.object({ revocationReason: zod_1.z.string().max(500).optional() }).strict(),
|
|
@@ -72,6 +187,7 @@ exports.revokeSuspensionSchema = zod_1.z.object({
|
|
|
72
187
|
params: zod_1.z.object({ suspensionId: uuidSchema }),
|
|
73
188
|
body: zod_1.z.object({ revocationReason: zod_1.z.string().max(500).optional() }).strict(),
|
|
74
189
|
});
|
|
190
|
+
// Extend
|
|
75
191
|
exports.extendSuspensionSchema = zod_1.z.object({
|
|
76
192
|
params: zod_1.z.object({ suspensionId: uuidSchema }),
|
|
77
193
|
body: zod_1.z
|
|
@@ -85,27 +201,10 @@ exports.extendSuspensionSchema = zod_1.z.object({
|
|
|
85
201
|
.strict()
|
|
86
202
|
.transform((data) => ({
|
|
87
203
|
...data,
|
|
88
|
-
newEndDate: (0, dateRange_validations_1.normalizeDate)(data.newEndDate),
|
|
204
|
+
newEndDate: (0, dateRange_validations_1.normalizeDate)(data.newEndDate),
|
|
89
205
|
})),
|
|
90
206
|
});
|
|
91
|
-
|
|
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
|
-
});
|
|
207
|
+
// Process Appeals
|
|
109
208
|
exports.reviewAppealSchema = zod_1.z.object({
|
|
110
209
|
params: zod_1.z.object({
|
|
111
210
|
banId: uuidSchema.optional(),
|
|
@@ -118,6 +217,7 @@ exports.reviewAppealSchema = zod_1.z.object({
|
|
|
118
217
|
})
|
|
119
218
|
.strict(),
|
|
120
219
|
});
|
|
220
|
+
// Export
|
|
121
221
|
exports.exportBansSchema = zod_1.z.object({
|
|
122
222
|
query: zod_1.z
|
|
123
223
|
.object({
|
|
@@ -126,7 +226,23 @@ exports.exportBansSchema = zod_1.z.object({
|
|
|
126
226
|
format: zod_1.z.enum(["csv"]).default("csv"),
|
|
127
227
|
})
|
|
128
228
|
.transform((data) => {
|
|
129
|
-
|
|
229
|
+
if (data.fromDate) {
|
|
230
|
+
data.fromDate = (0, dateRange_validations_1.normalizeDate)(data.fromDate);
|
|
231
|
+
}
|
|
232
|
+
if (data.toDate) {
|
|
233
|
+
data.toDate = (0, dateRange_validations_1.normalizeDate)(data.toDate);
|
|
234
|
+
}
|
|
235
|
+
return data;
|
|
236
|
+
}),
|
|
237
|
+
});
|
|
238
|
+
exports.exportSuspensionsSchema = zod_1.z.object({
|
|
239
|
+
query: zod_1.z
|
|
240
|
+
.object({
|
|
241
|
+
fromDate: dateRange_validations_1.dateValidator.optional(),
|
|
242
|
+
toDate: dateRange_validations_1.dateValidator.optional(),
|
|
243
|
+
format: zod_1.z.enum(["csv"]).default("csv"),
|
|
244
|
+
})
|
|
245
|
+
.transform((data) => {
|
|
130
246
|
if (data.fromDate) {
|
|
131
247
|
data.fromDate = (0, dateRange_validations_1.normalizeDate)(data.fromDate);
|
|
132
248
|
}
|