vr-commons 1.0.45 → 1.0.47
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/middlewares/index.d.ts +1 -0
- package/dist/middlewares/index.js +5 -1
- package/dist/validations/appeals.validations.d.ts +61 -0
- package/dist/validations/appeals.validations.js +31 -0
- package/dist/validations/bans.validations.d.ts +83 -0
- package/dist/validations/bans.validations.js +33 -0
- package/dist/validations/dateRange.validations.d.ts +39 -0
- package/dist/validations/dateRange.validations.js +115 -0
- package/dist/validations/index.d.ts +4 -0
- package/dist/validations/index.js +21 -1
- package/dist/validations/moderation.validations.d.ts +404 -0
- package/dist/validations/moderation.validations.js +138 -0
- package/dist/validations/suspensions.validations.d.ts +88 -0
- package/dist/validations/suspensions.validations.js +39 -0
- package/package.json +1 -1
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.checkUserAuthentication = void 0;
|
|
3
|
+
exports.checkIsUserSuspended = exports.checkIsUserBanned = exports.checkUserAccountStatus = exports.checkUserAuthentication = void 0;
|
|
4
4
|
var auth_middlewares_1 = require("./auth.middlewares");
|
|
5
5
|
Object.defineProperty(exports, "checkUserAuthentication", { enumerable: true, get: function () { return auth_middlewares_1.checkUserAuthentication; } });
|
|
6
|
+
var account_middlewares_1 = require("./account.middlewares");
|
|
7
|
+
Object.defineProperty(exports, "checkUserAccountStatus", { enumerable: true, get: function () { return account_middlewares_1.checkUserAccountStatus; } });
|
|
8
|
+
Object.defineProperty(exports, "checkIsUserBanned", { enumerable: true, get: function () { return account_middlewares_1.checkIsUserBanned; } });
|
|
9
|
+
Object.defineProperty(exports, "checkIsUserSuspended", { enumerable: true, get: function () { return account_middlewares_1.checkIsUserSuspended; } });
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const submitBanAppealSchema: z.ZodObject<{
|
|
3
|
+
params: z.ZodObject<{
|
|
4
|
+
banId: z.ZodString;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
banId: string;
|
|
7
|
+
}, {
|
|
8
|
+
banId: string;
|
|
9
|
+
}>;
|
|
10
|
+
body: z.ZodObject<{
|
|
11
|
+
appealReason: z.ZodString;
|
|
12
|
+
}, "strict", z.ZodTypeAny, {
|
|
13
|
+
appealReason: string;
|
|
14
|
+
}, {
|
|
15
|
+
appealReason: string;
|
|
16
|
+
}>;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
params: {
|
|
19
|
+
banId: string;
|
|
20
|
+
};
|
|
21
|
+
body: {
|
|
22
|
+
appealReason: string;
|
|
23
|
+
};
|
|
24
|
+
}, {
|
|
25
|
+
params: {
|
|
26
|
+
banId: string;
|
|
27
|
+
};
|
|
28
|
+
body: {
|
|
29
|
+
appealReason: string;
|
|
30
|
+
};
|
|
31
|
+
}>;
|
|
32
|
+
export declare const submitSuspensionAppealSchema: z.ZodObject<{
|
|
33
|
+
params: z.ZodObject<{
|
|
34
|
+
suspensionId: z.ZodString;
|
|
35
|
+
}, "strip", z.ZodTypeAny, {
|
|
36
|
+
suspensionId: string;
|
|
37
|
+
}, {
|
|
38
|
+
suspensionId: string;
|
|
39
|
+
}>;
|
|
40
|
+
body: z.ZodObject<{
|
|
41
|
+
appealReason: z.ZodString;
|
|
42
|
+
}, "strict", z.ZodTypeAny, {
|
|
43
|
+
appealReason: string;
|
|
44
|
+
}, {
|
|
45
|
+
appealReason: string;
|
|
46
|
+
}>;
|
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
params: {
|
|
49
|
+
suspensionId: string;
|
|
50
|
+
};
|
|
51
|
+
body: {
|
|
52
|
+
appealReason: string;
|
|
53
|
+
};
|
|
54
|
+
}, {
|
|
55
|
+
params: {
|
|
56
|
+
suspensionId: string;
|
|
57
|
+
};
|
|
58
|
+
body: {
|
|
59
|
+
appealReason: string;
|
|
60
|
+
};
|
|
61
|
+
}>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.submitSuspensionAppealSchema = exports.submitBanAppealSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const uuidSchema = zod_1.z.string().uuid("Invalid ID format");
|
|
6
|
+
exports.submitBanAppealSchema = zod_1.z.object({
|
|
7
|
+
params: zod_1.z.object({
|
|
8
|
+
banId: uuidSchema,
|
|
9
|
+
}),
|
|
10
|
+
body: zod_1.z
|
|
11
|
+
.object({
|
|
12
|
+
appealReason: zod_1.z
|
|
13
|
+
.string()
|
|
14
|
+
.min(10, "Appeal reason must be at least 10 characters")
|
|
15
|
+
.max(2000, "Appeal reason cannot exceed 2000 characters"),
|
|
16
|
+
})
|
|
17
|
+
.strict(),
|
|
18
|
+
});
|
|
19
|
+
exports.submitSuspensionAppealSchema = zod_1.z.object({
|
|
20
|
+
params: zod_1.z.object({
|
|
21
|
+
suspensionId: uuidSchema,
|
|
22
|
+
}),
|
|
23
|
+
body: zod_1.z
|
|
24
|
+
.object({
|
|
25
|
+
appealReason: zod_1.z
|
|
26
|
+
.string()
|
|
27
|
+
.min(10, "Appeal reason must be at least 10 characters")
|
|
28
|
+
.max(2000, "Appeal reason cannot exceed 2000 characters"),
|
|
29
|
+
})
|
|
30
|
+
.strict(),
|
|
31
|
+
});
|
|
@@ -0,0 +1,83 @@
|
|
|
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 getUserRestrictionsSchema: z.ZodObject<{
|
|
20
|
+
params: z.ZodObject<{
|
|
21
|
+
userId: z.ZodString;
|
|
22
|
+
}, "strip", z.ZodTypeAny, {
|
|
23
|
+
userId: string;
|
|
24
|
+
}, {
|
|
25
|
+
userId: string;
|
|
26
|
+
}>;
|
|
27
|
+
query: z.ZodObject<{
|
|
28
|
+
includeResolved: z.ZodOptional<z.ZodEnum<["true", "false"]>>;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
includeResolved?: "true" | "false" | undefined;
|
|
31
|
+
}, {
|
|
32
|
+
includeResolved?: "true" | "false" | undefined;
|
|
33
|
+
}>;
|
|
34
|
+
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
params: {
|
|
36
|
+
userId: string;
|
|
37
|
+
};
|
|
38
|
+
query: {
|
|
39
|
+
includeResolved?: "true" | "false" | undefined;
|
|
40
|
+
};
|
|
41
|
+
}, {
|
|
42
|
+
params: {
|
|
43
|
+
userId: string;
|
|
44
|
+
};
|
|
45
|
+
query: {
|
|
46
|
+
includeResolved?: "true" | "false" | undefined;
|
|
47
|
+
};
|
|
48
|
+
}>;
|
|
49
|
+
export declare const createBanSchema: z.ZodObject<{
|
|
50
|
+
params: z.ZodObject<{
|
|
51
|
+
userId: z.ZodString;
|
|
52
|
+
}, "strip", z.ZodTypeAny, {
|
|
53
|
+
userId: string;
|
|
54
|
+
}, {
|
|
55
|
+
userId: string;
|
|
56
|
+
}>;
|
|
57
|
+
body: z.ZodObject<{
|
|
58
|
+
reason: z.ZodString;
|
|
59
|
+
isPermanent: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
60
|
+
}, "strict", z.ZodTypeAny, {
|
|
61
|
+
isPermanent: boolean;
|
|
62
|
+
reason: string;
|
|
63
|
+
}, {
|
|
64
|
+
reason: string;
|
|
65
|
+
isPermanent?: boolean | undefined;
|
|
66
|
+
}>;
|
|
67
|
+
}, "strip", z.ZodTypeAny, {
|
|
68
|
+
params: {
|
|
69
|
+
userId: string;
|
|
70
|
+
};
|
|
71
|
+
body: {
|
|
72
|
+
isPermanent: boolean;
|
|
73
|
+
reason: string;
|
|
74
|
+
};
|
|
75
|
+
}, {
|
|
76
|
+
params: {
|
|
77
|
+
userId: string;
|
|
78
|
+
};
|
|
79
|
+
body: {
|
|
80
|
+
reason: string;
|
|
81
|
+
isPermanent?: boolean | undefined;
|
|
82
|
+
};
|
|
83
|
+
}>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createBanSchema = exports.getUserRestrictionsSchema = exports.getBanSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
// Base schemas
|
|
6
|
+
const uuidSchema = zod_1.z.string().uuid("Invalid UUID format");
|
|
7
|
+
exports.getBanSchema = zod_1.z.object({
|
|
8
|
+
params: zod_1.z.object({
|
|
9
|
+
banId: uuidSchema,
|
|
10
|
+
}),
|
|
11
|
+
});
|
|
12
|
+
exports.getUserRestrictionsSchema = zod_1.z.object({
|
|
13
|
+
params: zod_1.z.object({
|
|
14
|
+
userId: uuidSchema,
|
|
15
|
+
}),
|
|
16
|
+
query: zod_1.z.object({
|
|
17
|
+
includeResolved: zod_1.z.enum(["true", "false"]).optional(),
|
|
18
|
+
}),
|
|
19
|
+
});
|
|
20
|
+
exports.createBanSchema = zod_1.z.object({
|
|
21
|
+
params: zod_1.z.object({
|
|
22
|
+
userId: uuidSchema,
|
|
23
|
+
}),
|
|
24
|
+
body: zod_1.z
|
|
25
|
+
.object({
|
|
26
|
+
reason: zod_1.z
|
|
27
|
+
.string()
|
|
28
|
+
.min(5, "Reason must be at least 5 characters")
|
|
29
|
+
.max(1000, "Reason cannot exceed 1000 characters"),
|
|
30
|
+
isPermanent: zod_1.z.boolean().optional().default(false),
|
|
31
|
+
})
|
|
32
|
+
.strict(),
|
|
33
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Validates if a string is a valid date in any of the supported formats
|
|
4
|
+
* Supported formats:
|
|
5
|
+
* - YYYY-MM-DD (2024-03-18)
|
|
6
|
+
* - DD-MM-YYYY (18-03-2024)
|
|
7
|
+
* - YYYY/MM/DD (2024/03/18)
|
|
8
|
+
* - DD/MM/YYYY (18/03/2024)
|
|
9
|
+
*/
|
|
10
|
+
export declare const dateValidator: z.ZodEffects<z.ZodString, string, string>;
|
|
11
|
+
/**
|
|
12
|
+
* Normalizes any supported date format to YYYY-MM-DD for database queries
|
|
13
|
+
*/
|
|
14
|
+
export declare const normalizeDate: (dateStr: string) => string;
|
|
15
|
+
/**
|
|
16
|
+
* Creates a date schema that can be required or optional
|
|
17
|
+
*/
|
|
18
|
+
export declare const createDateSchema: (required?: boolean) => z.ZodEffects<z.ZodString, string, string> | z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
19
|
+
/**
|
|
20
|
+
* Date range schema for filtering between two dates
|
|
21
|
+
*/
|
|
22
|
+
export declare const dateRangeSchema: z.ZodEffects<z.ZodObject<{
|
|
23
|
+
fromDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
24
|
+
toDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
25
|
+
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
fromDate?: string | undefined;
|
|
27
|
+
toDate?: string | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
fromDate?: string | undefined;
|
|
30
|
+
toDate?: string | undefined;
|
|
31
|
+
}>, {
|
|
32
|
+
fromDate?: string | undefined;
|
|
33
|
+
toDate?: string | undefined;
|
|
34
|
+
}, {
|
|
35
|
+
fromDate?: string | undefined;
|
|
36
|
+
toDate?: string | undefined;
|
|
37
|
+
}>;
|
|
38
|
+
export declare const yyyyMmDdSchema: z.ZodString;
|
|
39
|
+
export declare const ddMmYyyySchema: z.ZodString;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ddMmYyyySchema = exports.yyyyMmDdSchema = exports.dateRangeSchema = exports.createDateSchema = exports.normalizeDate = exports.dateValidator = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
// Regular expressions for date formats
|
|
6
|
+
const YYYY_MM_DD_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
7
|
+
const DD_MM_YYYY_REGEX = /^\d{2}-\d{2}-\d{4}$/;
|
|
8
|
+
const YYYY_MM_DD_HYPHEN_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
9
|
+
const DD_MM_YYYY_SLASH_REGEX = /^\d{2}\/\d{2}\/\d{4}$/;
|
|
10
|
+
const YYYY_MM_DD_SLASH_REGEX = /^\d{4}\/\d{2}\/\d{2}$/;
|
|
11
|
+
/**
|
|
12
|
+
* Validates if a string is a valid date in any of the supported formats
|
|
13
|
+
* Supported formats:
|
|
14
|
+
* - YYYY-MM-DD (2024-03-18)
|
|
15
|
+
* - DD-MM-YYYY (18-03-2024)
|
|
16
|
+
* - YYYY/MM/DD (2024/03/18)
|
|
17
|
+
* - DD/MM/YYYY (18/03/2024)
|
|
18
|
+
*/
|
|
19
|
+
exports.dateValidator = zod_1.z.string().refine((val) => {
|
|
20
|
+
// Check YYYY-MM-DD format
|
|
21
|
+
if (YYYY_MM_DD_REGEX.test(val)) {
|
|
22
|
+
const [year, month, day] = val.split("-").map(Number);
|
|
23
|
+
const date = new Date(year, month - 1, day);
|
|
24
|
+
return (date.getFullYear() === year &&
|
|
25
|
+
date.getMonth() === month - 1 &&
|
|
26
|
+
date.getDate() === day);
|
|
27
|
+
}
|
|
28
|
+
// Check DD-MM-YYYY format
|
|
29
|
+
if (DD_MM_YYYY_REGEX.test(val)) {
|
|
30
|
+
const [day, month, year] = val.split("-").map(Number);
|
|
31
|
+
const date = new Date(year, month - 1, day);
|
|
32
|
+
return (date.getFullYear() === year &&
|
|
33
|
+
date.getMonth() === month - 1 &&
|
|
34
|
+
date.getDate() === day);
|
|
35
|
+
}
|
|
36
|
+
// Check YYYY/MM/DD format
|
|
37
|
+
if (YYYY_MM_DD_SLASH_REGEX.test(val)) {
|
|
38
|
+
const [year, month, day] = val.split("/").map(Number);
|
|
39
|
+
const date = new Date(year, month - 1, day);
|
|
40
|
+
return (date.getFullYear() === year &&
|
|
41
|
+
date.getMonth() === month - 1 &&
|
|
42
|
+
date.getDate() === day);
|
|
43
|
+
}
|
|
44
|
+
// Check DD/MM/YYYY format
|
|
45
|
+
if (DD_MM_YYYY_SLASH_REGEX.test(val)) {
|
|
46
|
+
const [day, month, year] = val.split("/").map(Number);
|
|
47
|
+
const date = new Date(year, month - 1, day);
|
|
48
|
+
return (date.getFullYear() === year &&
|
|
49
|
+
date.getMonth() === month - 1 &&
|
|
50
|
+
date.getDate() === day);
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
}, {
|
|
54
|
+
message: "Date must be in one of these formats: YYYY-MM-DD, DD-MM-YYYY, YYYY/MM/DD, or DD/MM/YYYY",
|
|
55
|
+
});
|
|
56
|
+
/**
|
|
57
|
+
* Normalizes any supported date format to YYYY-MM-DD for database queries
|
|
58
|
+
*/
|
|
59
|
+
const normalizeDate = (dateStr) => {
|
|
60
|
+
// Already YYYY-MM-DD
|
|
61
|
+
if (YYYY_MM_DD_REGEX.test(dateStr)) {
|
|
62
|
+
return dateStr;
|
|
63
|
+
}
|
|
64
|
+
// DD-MM-YYYY to YYYY-MM-DD
|
|
65
|
+
if (DD_MM_YYYY_REGEX.test(dateStr)) {
|
|
66
|
+
const [day, month, year] = dateStr.split("-");
|
|
67
|
+
return `${year}-${month}-${day}`;
|
|
68
|
+
}
|
|
69
|
+
// YYYY/MM/DD to YYYY-MM-DD
|
|
70
|
+
if (YYYY_MM_DD_SLASH_REGEX.test(dateStr)) {
|
|
71
|
+
const [year, month, day] = dateStr.split("/");
|
|
72
|
+
return `${year}-${month}-${day}`;
|
|
73
|
+
}
|
|
74
|
+
// DD/MM/YYYY to YYYY-MM-DD
|
|
75
|
+
if (DD_MM_YYYY_SLASH_REGEX.test(dateStr)) {
|
|
76
|
+
const [day, month, year] = dateStr.split("/");
|
|
77
|
+
return `${year}-${month}-${day}`;
|
|
78
|
+
}
|
|
79
|
+
return dateStr;
|
|
80
|
+
};
|
|
81
|
+
exports.normalizeDate = normalizeDate;
|
|
82
|
+
/**
|
|
83
|
+
* Creates a date schema that can be required or optional
|
|
84
|
+
*/
|
|
85
|
+
const createDateSchema = (required = false) => {
|
|
86
|
+
if (required) {
|
|
87
|
+
return exports.dateValidator;
|
|
88
|
+
}
|
|
89
|
+
return exports.dateValidator.optional();
|
|
90
|
+
};
|
|
91
|
+
exports.createDateSchema = createDateSchema;
|
|
92
|
+
/**
|
|
93
|
+
* Date range schema for filtering between two dates
|
|
94
|
+
*/
|
|
95
|
+
exports.dateRangeSchema = zod_1.z
|
|
96
|
+
.object({
|
|
97
|
+
fromDate: exports.dateValidator.optional(),
|
|
98
|
+
toDate: exports.dateValidator.optional(),
|
|
99
|
+
})
|
|
100
|
+
.transform((data) => {
|
|
101
|
+
if (data.fromDate) {
|
|
102
|
+
data.fromDate = (0, exports.normalizeDate)(data.fromDate);
|
|
103
|
+
}
|
|
104
|
+
if (data.toDate) {
|
|
105
|
+
data.toDate = (0, exports.normalizeDate)(data.toDate);
|
|
106
|
+
}
|
|
107
|
+
return data;
|
|
108
|
+
});
|
|
109
|
+
// Export individual format validators if needed
|
|
110
|
+
exports.yyyyMmDdSchema = zod_1.z
|
|
111
|
+
.string()
|
|
112
|
+
.regex(YYYY_MM_DD_REGEX, "Date must be in YYYY-MM-DD format");
|
|
113
|
+
exports.ddMmYyyySchema = zod_1.z
|
|
114
|
+
.string()
|
|
115
|
+
.regex(DD_MM_YYYY_REGEX, "Date must be in DD-MM-YYYY format");
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
export { validate } from "./validate.validations";
|
|
2
2
|
export { riderLoginSchema, forgotPasswordSchema, userLoginSchema, } from "./auth.validations";
|
|
3
3
|
export { createUserSchema, getUserByIdSchema, updateUserProfileSchema, getAllUsersSchema, viewProfileSchema, passengerSignupSchema, updatePassengerProfileSchema, updateRiderProfileSchema, createRiderSchema, changePasswordSchema, deactivateAccountSchema, deleteAccountSchema, } 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";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deleteAccountSchema = exports.deactivateAccountSchema = exports.changePasswordSchema = exports.createRiderSchema = exports.updateRiderProfileSchema = exports.updatePassengerProfileSchema = exports.passengerSignupSchema = exports.viewProfileSchema = exports.getAllUsersSchema = exports.updateUserProfileSchema = exports.getUserByIdSchema = exports.createUserSchema = exports.userLoginSchema = exports.forgotPasswordSchema = exports.riderLoginSchema = exports.validate = void 0;
|
|
3
|
+
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.deleteAccountSchema = exports.deactivateAccountSchema = exports.changePasswordSchema = exports.createRiderSchema = exports.updateRiderProfileSchema = exports.updatePassengerProfileSchema = exports.passengerSignupSchema = exports.viewProfileSchema = exports.getAllUsersSchema = exports.updateUserProfileSchema = exports.getUserByIdSchema = exports.createUserSchema = exports.userLoginSchema = exports.forgotPasswordSchema = exports.riderLoginSchema = exports.validate = void 0;
|
|
4
4
|
var validate_validations_1 = require("./validate.validations");
|
|
5
5
|
Object.defineProperty(exports, "validate", { enumerable: true, get: function () { return validate_validations_1.validate; } });
|
|
6
6
|
var auth_validations_1 = require("./auth.validations");
|
|
@@ -25,3 +25,23 @@ Object.defineProperty(exports, "createRiderSchema", { enumerable: true, get: fun
|
|
|
25
25
|
Object.defineProperty(exports, "changePasswordSchema", { enumerable: true, get: function () { return profiles_validations_1.changePasswordSchema; } });
|
|
26
26
|
Object.defineProperty(exports, "deactivateAccountSchema", { enumerable: true, get: function () { return profiles_validations_1.deactivateAccountSchema; } });
|
|
27
27
|
Object.defineProperty(exports, "deleteAccountSchema", { enumerable: true, get: function () { return profiles_validations_1.deleteAccountSchema; } });
|
|
28
|
+
var moderation_validations_1 = require("./moderation.validations");
|
|
29
|
+
Object.defineProperty(exports, "listBansSchema", { enumerable: true, get: function () { return moderation_validations_1.listBansSchema; } });
|
|
30
|
+
Object.defineProperty(exports, "listPendingAppealsSchema", { enumerable: true, get: function () { return moderation_validations_1.listPendingAppealsSchema; } });
|
|
31
|
+
Object.defineProperty(exports, "listSuspensionsSchema", { enumerable: true, get: function () { return moderation_validations_1.listSuspensionsSchema; } });
|
|
32
|
+
Object.defineProperty(exports, "reviewAppealSchema", { enumerable: true, get: function () { return moderation_validations_1.reviewAppealSchema; } });
|
|
33
|
+
Object.defineProperty(exports, "revokeBanSchema", { enumerable: true, get: function () { return moderation_validations_1.revokeBanSchema; } });
|
|
34
|
+
Object.defineProperty(exports, "revokeSuspensionSchema", { enumerable: true, get: function () { return moderation_validations_1.revokeSuspensionSchema; } });
|
|
35
|
+
Object.defineProperty(exports, "extendSuspensionSchema", { enumerable: true, get: function () { return moderation_validations_1.extendSuspensionSchema; } });
|
|
36
|
+
Object.defineProperty(exports, "exportBansSchema", { enumerable: true, get: function () { return moderation_validations_1.exportBansSchema; } });
|
|
37
|
+
var appeals_validations_1 = require("./appeals.validations");
|
|
38
|
+
Object.defineProperty(exports, "submitBanAppealSchema", { enumerable: true, get: function () { return appeals_validations_1.submitBanAppealSchema; } });
|
|
39
|
+
Object.defineProperty(exports, "submitSuspensionAppealSchema", { enumerable: true, get: function () { return appeals_validations_1.submitSuspensionAppealSchema; } });
|
|
40
|
+
var bans_validations_1 = require("./bans.validations");
|
|
41
|
+
Object.defineProperty(exports, "getBanSchema", { enumerable: true, get: function () { return bans_validations_1.getBanSchema; } });
|
|
42
|
+
Object.defineProperty(exports, "getUserRestrictionsSchema", { enumerable: true, get: function () { return bans_validations_1.getUserRestrictionsSchema; } });
|
|
43
|
+
Object.defineProperty(exports, "createBanSchema", { enumerable: true, get: function () { return bans_validations_1.createBanSchema; } });
|
|
44
|
+
var suspensions_validations_1 = require("./suspensions.validations");
|
|
45
|
+
Object.defineProperty(exports, "getSuspensionSchema", { enumerable: true, get: function () { return suspensions_validations_1.getSuspensionSchema; } });
|
|
46
|
+
Object.defineProperty(exports, "getUserSuspensionsSchema", { enumerable: true, get: function () { return suspensions_validations_1.getUserSuspensionsSchema; } });
|
|
47
|
+
Object.defineProperty(exports, "createSuspensionSchema", { enumerable: true, get: function () { return suspensions_validations_1.createSuspensionSchema; } });
|
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const listBansSchema: z.ZodObject<{
|
|
3
|
+
query: z.ZodEffects<z.ZodObject<{
|
|
4
|
+
page: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodString>, number, string | undefined>, z.ZodNumber>;
|
|
5
|
+
limit: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodString>, number, string | undefined>, z.ZodNumber>;
|
|
6
|
+
} & {
|
|
7
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
8
|
+
status: z.ZodOptional<z.ZodEnum<["active", "revoked"]>>;
|
|
9
|
+
appealStatus: z.ZodOptional<z.ZodEnum<["pending", "approved", "rejected"]>>;
|
|
10
|
+
isPermanent: z.ZodOptional<z.ZodEnum<["true", "false"]>>;
|
|
11
|
+
fromDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
12
|
+
toDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
13
|
+
search: z.ZodOptional<z.ZodString>;
|
|
14
|
+
sortBy: z.ZodOptional<z.ZodEnum<["bannedAt", "createdAt", "reason"]>>;
|
|
15
|
+
sortOrder: z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
page: number;
|
|
18
|
+
limit: number;
|
|
19
|
+
fromDate?: string | undefined;
|
|
20
|
+
toDate?: string | undefined;
|
|
21
|
+
status?: "active" | "revoked" | undefined;
|
|
22
|
+
userId?: string | undefined;
|
|
23
|
+
appealStatus?: "pending" | "approved" | "rejected" | undefined;
|
|
24
|
+
isPermanent?: "true" | "false" | undefined;
|
|
25
|
+
search?: string | undefined;
|
|
26
|
+
sortBy?: "bannedAt" | "createdAt" | "reason" | undefined;
|
|
27
|
+
sortOrder?: "ASC" | "DESC" | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
fromDate?: string | undefined;
|
|
30
|
+
toDate?: string | undefined;
|
|
31
|
+
status?: "active" | "revoked" | undefined;
|
|
32
|
+
page?: string | undefined;
|
|
33
|
+
limit?: string | undefined;
|
|
34
|
+
userId?: string | undefined;
|
|
35
|
+
appealStatus?: "pending" | "approved" | "rejected" | undefined;
|
|
36
|
+
isPermanent?: "true" | "false" | undefined;
|
|
37
|
+
search?: string | undefined;
|
|
38
|
+
sortBy?: "bannedAt" | "createdAt" | "reason" | undefined;
|
|
39
|
+
sortOrder?: "ASC" | "DESC" | undefined;
|
|
40
|
+
}>, {
|
|
41
|
+
page: number;
|
|
42
|
+
limit: number;
|
|
43
|
+
fromDate?: string | undefined;
|
|
44
|
+
toDate?: string | undefined;
|
|
45
|
+
status?: "active" | "revoked" | undefined;
|
|
46
|
+
userId?: string | undefined;
|
|
47
|
+
appealStatus?: "pending" | "approved" | "rejected" | undefined;
|
|
48
|
+
isPermanent?: "true" | "false" | undefined;
|
|
49
|
+
search?: string | undefined;
|
|
50
|
+
sortBy?: "bannedAt" | "createdAt" | "reason" | undefined;
|
|
51
|
+
sortOrder?: "ASC" | "DESC" | undefined;
|
|
52
|
+
}, {
|
|
53
|
+
fromDate?: string | undefined;
|
|
54
|
+
toDate?: string | undefined;
|
|
55
|
+
status?: "active" | "revoked" | undefined;
|
|
56
|
+
page?: string | undefined;
|
|
57
|
+
limit?: string | undefined;
|
|
58
|
+
userId?: string | undefined;
|
|
59
|
+
appealStatus?: "pending" | "approved" | "rejected" | undefined;
|
|
60
|
+
isPermanent?: "true" | "false" | undefined;
|
|
61
|
+
search?: string | undefined;
|
|
62
|
+
sortBy?: "bannedAt" | "createdAt" | "reason" | undefined;
|
|
63
|
+
sortOrder?: "ASC" | "DESC" | undefined;
|
|
64
|
+
}>;
|
|
65
|
+
}, "strip", z.ZodTypeAny, {
|
|
66
|
+
query: {
|
|
67
|
+
page: number;
|
|
68
|
+
limit: number;
|
|
69
|
+
fromDate?: string | undefined;
|
|
70
|
+
toDate?: string | undefined;
|
|
71
|
+
status?: "active" | "revoked" | undefined;
|
|
72
|
+
userId?: string | undefined;
|
|
73
|
+
appealStatus?: "pending" | "approved" | "rejected" | undefined;
|
|
74
|
+
isPermanent?: "true" | "false" | undefined;
|
|
75
|
+
search?: string | undefined;
|
|
76
|
+
sortBy?: "bannedAt" | "createdAt" | "reason" | undefined;
|
|
77
|
+
sortOrder?: "ASC" | "DESC" | undefined;
|
|
78
|
+
};
|
|
79
|
+
}, {
|
|
80
|
+
query: {
|
|
81
|
+
fromDate?: string | undefined;
|
|
82
|
+
toDate?: string | undefined;
|
|
83
|
+
status?: "active" | "revoked" | undefined;
|
|
84
|
+
page?: string | undefined;
|
|
85
|
+
limit?: string | undefined;
|
|
86
|
+
userId?: string | undefined;
|
|
87
|
+
appealStatus?: "pending" | "approved" | "rejected" | undefined;
|
|
88
|
+
isPermanent?: "true" | "false" | undefined;
|
|
89
|
+
search?: string | undefined;
|
|
90
|
+
sortBy?: "bannedAt" | "createdAt" | "reason" | undefined;
|
|
91
|
+
sortOrder?: "ASC" | "DESC" | undefined;
|
|
92
|
+
};
|
|
93
|
+
}>;
|
|
94
|
+
export declare const listSuspensionsSchema: z.ZodObject<{
|
|
95
|
+
query: z.ZodEffects<z.ZodObject<{
|
|
96
|
+
page: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodString>, number, string | undefined>, z.ZodNumber>;
|
|
97
|
+
limit: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodString>, number, string | undefined>, z.ZodNumber>;
|
|
98
|
+
} & {
|
|
99
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
100
|
+
status: z.ZodOptional<z.ZodEnum<["active", "expired", "revoked"]>>;
|
|
101
|
+
appealStatus: z.ZodOptional<z.ZodEnum<["pending", "approved", "rejected"]>>;
|
|
102
|
+
fromDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
103
|
+
toDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
104
|
+
search: z.ZodOptional<z.ZodString>;
|
|
105
|
+
sortBy: z.ZodOptional<z.ZodEnum<["startedAt", "endsAt", "createdAt", "reason"]>>;
|
|
106
|
+
sortOrder: z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>;
|
|
107
|
+
}, "strip", z.ZodTypeAny, {
|
|
108
|
+
page: number;
|
|
109
|
+
limit: number;
|
|
110
|
+
fromDate?: string | undefined;
|
|
111
|
+
toDate?: string | undefined;
|
|
112
|
+
status?: "active" | "revoked" | "expired" | undefined;
|
|
113
|
+
userId?: string | undefined;
|
|
114
|
+
appealStatus?: "pending" | "approved" | "rejected" | undefined;
|
|
115
|
+
search?: string | undefined;
|
|
116
|
+
sortBy?: "createdAt" | "reason" | "startedAt" | "endsAt" | undefined;
|
|
117
|
+
sortOrder?: "ASC" | "DESC" | undefined;
|
|
118
|
+
}, {
|
|
119
|
+
fromDate?: string | undefined;
|
|
120
|
+
toDate?: string | undefined;
|
|
121
|
+
status?: "active" | "revoked" | "expired" | undefined;
|
|
122
|
+
page?: string | undefined;
|
|
123
|
+
limit?: string | undefined;
|
|
124
|
+
userId?: string | undefined;
|
|
125
|
+
appealStatus?: "pending" | "approved" | "rejected" | undefined;
|
|
126
|
+
search?: string | undefined;
|
|
127
|
+
sortBy?: "createdAt" | "reason" | "startedAt" | "endsAt" | undefined;
|
|
128
|
+
sortOrder?: "ASC" | "DESC" | undefined;
|
|
129
|
+
}>, {
|
|
130
|
+
page: number;
|
|
131
|
+
limit: number;
|
|
132
|
+
fromDate?: string | undefined;
|
|
133
|
+
toDate?: string | undefined;
|
|
134
|
+
status?: "active" | "revoked" | "expired" | undefined;
|
|
135
|
+
userId?: string | undefined;
|
|
136
|
+
appealStatus?: "pending" | "approved" | "rejected" | undefined;
|
|
137
|
+
search?: string | undefined;
|
|
138
|
+
sortBy?: "createdAt" | "reason" | "startedAt" | "endsAt" | undefined;
|
|
139
|
+
sortOrder?: "ASC" | "DESC" | undefined;
|
|
140
|
+
}, {
|
|
141
|
+
fromDate?: string | undefined;
|
|
142
|
+
toDate?: string | undefined;
|
|
143
|
+
status?: "active" | "revoked" | "expired" | undefined;
|
|
144
|
+
page?: string | undefined;
|
|
145
|
+
limit?: string | undefined;
|
|
146
|
+
userId?: string | undefined;
|
|
147
|
+
appealStatus?: "pending" | "approved" | "rejected" | undefined;
|
|
148
|
+
search?: string | undefined;
|
|
149
|
+
sortBy?: "createdAt" | "reason" | "startedAt" | "endsAt" | undefined;
|
|
150
|
+
sortOrder?: "ASC" | "DESC" | undefined;
|
|
151
|
+
}>;
|
|
152
|
+
}, "strip", z.ZodTypeAny, {
|
|
153
|
+
query: {
|
|
154
|
+
page: number;
|
|
155
|
+
limit: number;
|
|
156
|
+
fromDate?: string | undefined;
|
|
157
|
+
toDate?: string | undefined;
|
|
158
|
+
status?: "active" | "revoked" | "expired" | undefined;
|
|
159
|
+
userId?: string | undefined;
|
|
160
|
+
appealStatus?: "pending" | "approved" | "rejected" | undefined;
|
|
161
|
+
search?: string | undefined;
|
|
162
|
+
sortBy?: "createdAt" | "reason" | "startedAt" | "endsAt" | undefined;
|
|
163
|
+
sortOrder?: "ASC" | "DESC" | undefined;
|
|
164
|
+
};
|
|
165
|
+
}, {
|
|
166
|
+
query: {
|
|
167
|
+
fromDate?: string | undefined;
|
|
168
|
+
toDate?: string | undefined;
|
|
169
|
+
status?: "active" | "revoked" | "expired" | undefined;
|
|
170
|
+
page?: string | undefined;
|
|
171
|
+
limit?: string | undefined;
|
|
172
|
+
userId?: string | undefined;
|
|
173
|
+
appealStatus?: "pending" | "approved" | "rejected" | undefined;
|
|
174
|
+
search?: string | undefined;
|
|
175
|
+
sortBy?: "createdAt" | "reason" | "startedAt" | "endsAt" | undefined;
|
|
176
|
+
sortOrder?: "ASC" | "DESC" | undefined;
|
|
177
|
+
};
|
|
178
|
+
}>;
|
|
179
|
+
export declare const revokeBanSchema: z.ZodObject<{
|
|
180
|
+
params: z.ZodObject<{
|
|
181
|
+
banId: z.ZodString;
|
|
182
|
+
}, "strip", z.ZodTypeAny, {
|
|
183
|
+
banId: string;
|
|
184
|
+
}, {
|
|
185
|
+
banId: string;
|
|
186
|
+
}>;
|
|
187
|
+
body: z.ZodObject<{
|
|
188
|
+
revocationReason: z.ZodOptional<z.ZodString>;
|
|
189
|
+
}, "strict", z.ZodTypeAny, {
|
|
190
|
+
revocationReason?: string | undefined;
|
|
191
|
+
}, {
|
|
192
|
+
revocationReason?: string | undefined;
|
|
193
|
+
}>;
|
|
194
|
+
}, "strip", z.ZodTypeAny, {
|
|
195
|
+
params: {
|
|
196
|
+
banId: string;
|
|
197
|
+
};
|
|
198
|
+
body: {
|
|
199
|
+
revocationReason?: string | undefined;
|
|
200
|
+
};
|
|
201
|
+
}, {
|
|
202
|
+
params: {
|
|
203
|
+
banId: string;
|
|
204
|
+
};
|
|
205
|
+
body: {
|
|
206
|
+
revocationReason?: string | undefined;
|
|
207
|
+
};
|
|
208
|
+
}>;
|
|
209
|
+
export declare const revokeSuspensionSchema: z.ZodObject<{
|
|
210
|
+
params: z.ZodObject<{
|
|
211
|
+
suspensionId: z.ZodString;
|
|
212
|
+
}, "strip", z.ZodTypeAny, {
|
|
213
|
+
suspensionId: string;
|
|
214
|
+
}, {
|
|
215
|
+
suspensionId: string;
|
|
216
|
+
}>;
|
|
217
|
+
body: z.ZodObject<{
|
|
218
|
+
revocationReason: z.ZodOptional<z.ZodString>;
|
|
219
|
+
}, "strict", z.ZodTypeAny, {
|
|
220
|
+
revocationReason?: string | undefined;
|
|
221
|
+
}, {
|
|
222
|
+
revocationReason?: string | undefined;
|
|
223
|
+
}>;
|
|
224
|
+
}, "strip", z.ZodTypeAny, {
|
|
225
|
+
params: {
|
|
226
|
+
suspensionId: string;
|
|
227
|
+
};
|
|
228
|
+
body: {
|
|
229
|
+
revocationReason?: string | undefined;
|
|
230
|
+
};
|
|
231
|
+
}, {
|
|
232
|
+
params: {
|
|
233
|
+
suspensionId: string;
|
|
234
|
+
};
|
|
235
|
+
body: {
|
|
236
|
+
revocationReason?: string | undefined;
|
|
237
|
+
};
|
|
238
|
+
}>;
|
|
239
|
+
export declare const extendSuspensionSchema: z.ZodObject<{
|
|
240
|
+
params: z.ZodObject<{
|
|
241
|
+
suspensionId: z.ZodString;
|
|
242
|
+
}, "strip", z.ZodTypeAny, {
|
|
243
|
+
suspensionId: string;
|
|
244
|
+
}, {
|
|
245
|
+
suspensionId: string;
|
|
246
|
+
}>;
|
|
247
|
+
body: z.ZodEffects<z.ZodObject<{
|
|
248
|
+
newEndDate: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
249
|
+
extensionReason: z.ZodOptional<z.ZodString>;
|
|
250
|
+
}, "strict", z.ZodTypeAny, {
|
|
251
|
+
newEndDate: string;
|
|
252
|
+
extensionReason?: string | undefined;
|
|
253
|
+
}, {
|
|
254
|
+
newEndDate: string;
|
|
255
|
+
extensionReason?: string | undefined;
|
|
256
|
+
}>, {
|
|
257
|
+
newEndDate: string;
|
|
258
|
+
extensionReason?: string | undefined;
|
|
259
|
+
}, {
|
|
260
|
+
newEndDate: string;
|
|
261
|
+
extensionReason?: string | undefined;
|
|
262
|
+
}>;
|
|
263
|
+
}, "strip", z.ZodTypeAny, {
|
|
264
|
+
params: {
|
|
265
|
+
suspensionId: string;
|
|
266
|
+
};
|
|
267
|
+
body: {
|
|
268
|
+
newEndDate: string;
|
|
269
|
+
extensionReason?: string | undefined;
|
|
270
|
+
};
|
|
271
|
+
}, {
|
|
272
|
+
params: {
|
|
273
|
+
suspensionId: string;
|
|
274
|
+
};
|
|
275
|
+
body: {
|
|
276
|
+
newEndDate: string;
|
|
277
|
+
extensionReason?: string | undefined;
|
|
278
|
+
};
|
|
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
|
+
page: number;
|
|
290
|
+
limit: number;
|
|
291
|
+
type?: "ban" | "suspension" | undefined;
|
|
292
|
+
fromDate?: string | undefined;
|
|
293
|
+
toDate?: string | undefined;
|
|
294
|
+
}, {
|
|
295
|
+
type?: "ban" | "suspension" | undefined;
|
|
296
|
+
fromDate?: string | undefined;
|
|
297
|
+
toDate?: string | undefined;
|
|
298
|
+
page?: string | undefined;
|
|
299
|
+
limit?: string | undefined;
|
|
300
|
+
}>, {
|
|
301
|
+
page: number;
|
|
302
|
+
limit: number;
|
|
303
|
+
type?: "ban" | "suspension" | undefined;
|
|
304
|
+
fromDate?: string | undefined;
|
|
305
|
+
toDate?: string | undefined;
|
|
306
|
+
}, {
|
|
307
|
+
type?: "ban" | "suspension" | undefined;
|
|
308
|
+
fromDate?: string | undefined;
|
|
309
|
+
toDate?: string | undefined;
|
|
310
|
+
page?: string | undefined;
|
|
311
|
+
limit?: string | undefined;
|
|
312
|
+
}>;
|
|
313
|
+
}, "strip", z.ZodTypeAny, {
|
|
314
|
+
query: {
|
|
315
|
+
page: number;
|
|
316
|
+
limit: number;
|
|
317
|
+
type?: "ban" | "suspension" | undefined;
|
|
318
|
+
fromDate?: string | undefined;
|
|
319
|
+
toDate?: string | undefined;
|
|
320
|
+
};
|
|
321
|
+
}, {
|
|
322
|
+
query: {
|
|
323
|
+
type?: "ban" | "suspension" | undefined;
|
|
324
|
+
fromDate?: string | undefined;
|
|
325
|
+
toDate?: string | undefined;
|
|
326
|
+
page?: string | undefined;
|
|
327
|
+
limit?: string | undefined;
|
|
328
|
+
};
|
|
329
|
+
}>;
|
|
330
|
+
export declare const reviewAppealSchema: z.ZodObject<{
|
|
331
|
+
params: z.ZodObject<{
|
|
332
|
+
banId: z.ZodOptional<z.ZodString>;
|
|
333
|
+
suspensionId: z.ZodOptional<z.ZodString>;
|
|
334
|
+
}, "strip", z.ZodTypeAny, {
|
|
335
|
+
banId?: string | undefined;
|
|
336
|
+
suspensionId?: string | undefined;
|
|
337
|
+
}, {
|
|
338
|
+
banId?: string | undefined;
|
|
339
|
+
suspensionId?: string | undefined;
|
|
340
|
+
}>;
|
|
341
|
+
body: z.ZodObject<{
|
|
342
|
+
appealStatus: z.ZodEnum<["approved", "rejected"]>;
|
|
343
|
+
adminNotes: z.ZodOptional<z.ZodString>;
|
|
344
|
+
}, "strict", z.ZodTypeAny, {
|
|
345
|
+
appealStatus: "approved" | "rejected";
|
|
346
|
+
adminNotes?: string | undefined;
|
|
347
|
+
}, {
|
|
348
|
+
appealStatus: "approved" | "rejected";
|
|
349
|
+
adminNotes?: string | undefined;
|
|
350
|
+
}>;
|
|
351
|
+
}, "strip", z.ZodTypeAny, {
|
|
352
|
+
params: {
|
|
353
|
+
banId?: string | undefined;
|
|
354
|
+
suspensionId?: string | undefined;
|
|
355
|
+
};
|
|
356
|
+
body: {
|
|
357
|
+
appealStatus: "approved" | "rejected";
|
|
358
|
+
adminNotes?: string | undefined;
|
|
359
|
+
};
|
|
360
|
+
}, {
|
|
361
|
+
params: {
|
|
362
|
+
banId?: string | undefined;
|
|
363
|
+
suspensionId?: string | undefined;
|
|
364
|
+
};
|
|
365
|
+
body: {
|
|
366
|
+
appealStatus: "approved" | "rejected";
|
|
367
|
+
adminNotes?: string | undefined;
|
|
368
|
+
};
|
|
369
|
+
}>;
|
|
370
|
+
export declare const exportBansSchema: z.ZodObject<{
|
|
371
|
+
query: z.ZodEffects<z.ZodObject<{
|
|
372
|
+
fromDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
373
|
+
toDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
374
|
+
format: z.ZodDefault<z.ZodEnum<["csv"]>>;
|
|
375
|
+
}, "strip", z.ZodTypeAny, {
|
|
376
|
+
format: "csv";
|
|
377
|
+
fromDate?: string | undefined;
|
|
378
|
+
toDate?: string | undefined;
|
|
379
|
+
}, {
|
|
380
|
+
fromDate?: string | undefined;
|
|
381
|
+
toDate?: string | undefined;
|
|
382
|
+
format?: "csv" | undefined;
|
|
383
|
+
}>, {
|
|
384
|
+
format: "csv";
|
|
385
|
+
fromDate?: string | undefined;
|
|
386
|
+
toDate?: string | undefined;
|
|
387
|
+
}, {
|
|
388
|
+
fromDate?: string | undefined;
|
|
389
|
+
toDate?: string | undefined;
|
|
390
|
+
format?: "csv" | undefined;
|
|
391
|
+
}>;
|
|
392
|
+
}, "strip", z.ZodTypeAny, {
|
|
393
|
+
query: {
|
|
394
|
+
format: "csv";
|
|
395
|
+
fromDate?: string | undefined;
|
|
396
|
+
toDate?: string | undefined;
|
|
397
|
+
};
|
|
398
|
+
}, {
|
|
399
|
+
query: {
|
|
400
|
+
fromDate?: string | undefined;
|
|
401
|
+
toDate?: string | undefined;
|
|
402
|
+
format?: "csv" | undefined;
|
|
403
|
+
};
|
|
404
|
+
}>;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
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;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const dateRange_validations_1 = require("./dateRange.validations");
|
|
6
|
+
const uuidSchema = zod_1.z.string().uuid("Invalid UUID format");
|
|
7
|
+
// Base query schema with common pagination fields
|
|
8
|
+
const paginationSchema = zod_1.z.object({
|
|
9
|
+
page: zod_1.z
|
|
10
|
+
.string()
|
|
11
|
+
.optional()
|
|
12
|
+
.transform((val) => (val ? parseInt(val) : 1))
|
|
13
|
+
.pipe(zod_1.z.number().min(1)),
|
|
14
|
+
limit: zod_1.z
|
|
15
|
+
.string()
|
|
16
|
+
.optional()
|
|
17
|
+
.transform((val) => (val ? parseInt(val) : 20))
|
|
18
|
+
.pipe(zod_1.z.number().min(1).max(100)),
|
|
19
|
+
});
|
|
20
|
+
exports.listBansSchema = zod_1.z.object({
|
|
21
|
+
query: paginationSchema
|
|
22
|
+
.extend({
|
|
23
|
+
userId: zod_1.z.string().uuid("Invalid user ID").optional(),
|
|
24
|
+
status: zod_1.z.enum(["active", "revoked"]).optional(),
|
|
25
|
+
appealStatus: zod_1.z.enum(["pending", "approved", "rejected"]).optional(),
|
|
26
|
+
isPermanent: zod_1.z.enum(["true", "false"]).optional(),
|
|
27
|
+
fromDate: dateRange_validations_1.dateValidator.optional(),
|
|
28
|
+
toDate: dateRange_validations_1.dateValidator.optional(),
|
|
29
|
+
search: zod_1.z.string().optional(),
|
|
30
|
+
sortBy: zod_1.z.enum(["bannedAt", "createdAt", "reason"]).optional(),
|
|
31
|
+
sortOrder: zod_1.z.enum(["ASC", "DESC"]).optional(),
|
|
32
|
+
})
|
|
33
|
+
.transform((data) => {
|
|
34
|
+
// Normalize dates for DB queries
|
|
35
|
+
if (data.fromDate) {
|
|
36
|
+
data.fromDate = (0, dateRange_validations_1.normalizeDate)(data.fromDate);
|
|
37
|
+
}
|
|
38
|
+
if (data.toDate) {
|
|
39
|
+
data.toDate = (0, dateRange_validations_1.normalizeDate)(data.toDate);
|
|
40
|
+
}
|
|
41
|
+
return data;
|
|
42
|
+
}),
|
|
43
|
+
});
|
|
44
|
+
exports.listSuspensionsSchema = zod_1.z.object({
|
|
45
|
+
query: paginationSchema
|
|
46
|
+
.extend({
|
|
47
|
+
userId: zod_1.z.string().uuid("Invalid user ID").optional(),
|
|
48
|
+
status: zod_1.z.enum(["active", "expired", "revoked"]).optional(),
|
|
49
|
+
appealStatus: zod_1.z.enum(["pending", "approved", "rejected"]).optional(),
|
|
50
|
+
fromDate: dateRange_validations_1.dateValidator.optional(),
|
|
51
|
+
toDate: dateRange_validations_1.dateValidator.optional(),
|
|
52
|
+
search: zod_1.z.string().optional(),
|
|
53
|
+
sortBy: zod_1.z.enum(["startedAt", "endsAt", "createdAt", "reason"]).optional(),
|
|
54
|
+
sortOrder: zod_1.z.enum(["ASC", "DESC"]).optional(),
|
|
55
|
+
})
|
|
56
|
+
.transform((data) => {
|
|
57
|
+
// Normalize dates for DB queries
|
|
58
|
+
if (data.fromDate) {
|
|
59
|
+
data.fromDate = (0, dateRange_validations_1.normalizeDate)(data.fromDate);
|
|
60
|
+
}
|
|
61
|
+
if (data.toDate) {
|
|
62
|
+
data.toDate = (0, dateRange_validations_1.normalizeDate)(data.toDate);
|
|
63
|
+
}
|
|
64
|
+
return data;
|
|
65
|
+
}),
|
|
66
|
+
});
|
|
67
|
+
exports.revokeBanSchema = zod_1.z.object({
|
|
68
|
+
params: zod_1.z.object({ banId: uuidSchema }),
|
|
69
|
+
body: zod_1.z.object({ revocationReason: zod_1.z.string().max(500).optional() }).strict(),
|
|
70
|
+
});
|
|
71
|
+
exports.revokeSuspensionSchema = zod_1.z.object({
|
|
72
|
+
params: zod_1.z.object({ suspensionId: uuidSchema }),
|
|
73
|
+
body: zod_1.z.object({ revocationReason: zod_1.z.string().max(500).optional() }).strict(),
|
|
74
|
+
});
|
|
75
|
+
exports.extendSuspensionSchema = zod_1.z.object({
|
|
76
|
+
params: zod_1.z.object({ suspensionId: uuidSchema }),
|
|
77
|
+
body: zod_1.z
|
|
78
|
+
.object({
|
|
79
|
+
newEndDate: dateRange_validations_1.dateValidator.refine((date) => {
|
|
80
|
+
const normalizedDate = (0, dateRange_validations_1.normalizeDate)(date);
|
|
81
|
+
return new Date(normalizedDate) > new Date();
|
|
82
|
+
}, { message: "New end date must be in the future" }),
|
|
83
|
+
extensionReason: zod_1.z.string().max(500).optional(),
|
|
84
|
+
})
|
|
85
|
+
.strict()
|
|
86
|
+
.transform((data) => ({
|
|
87
|
+
...data,
|
|
88
|
+
newEndDate: (0, dateRange_validations_1.normalizeDate)(data.newEndDate), // Normalize for DB
|
|
89
|
+
})),
|
|
90
|
+
});
|
|
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
|
+
});
|
|
109
|
+
exports.reviewAppealSchema = zod_1.z.object({
|
|
110
|
+
params: zod_1.z.object({
|
|
111
|
+
banId: uuidSchema.optional(),
|
|
112
|
+
suspensionId: uuidSchema.optional(),
|
|
113
|
+
}),
|
|
114
|
+
body: zod_1.z
|
|
115
|
+
.object({
|
|
116
|
+
appealStatus: zod_1.z.enum(["approved", "rejected"]),
|
|
117
|
+
adminNotes: zod_1.z.string().max(1000).optional(),
|
|
118
|
+
})
|
|
119
|
+
.strict(),
|
|
120
|
+
});
|
|
121
|
+
exports.exportBansSchema = zod_1.z.object({
|
|
122
|
+
query: zod_1.z
|
|
123
|
+
.object({
|
|
124
|
+
fromDate: dateRange_validations_1.dateValidator.optional(),
|
|
125
|
+
toDate: dateRange_validations_1.dateValidator.optional(),
|
|
126
|
+
format: zod_1.z.enum(["csv"]).default("csv"),
|
|
127
|
+
})
|
|
128
|
+
.transform((data) => {
|
|
129
|
+
// Normalize dates for DB queries
|
|
130
|
+
if (data.fromDate) {
|
|
131
|
+
data.fromDate = (0, dateRange_validations_1.normalizeDate)(data.fromDate);
|
|
132
|
+
}
|
|
133
|
+
if (data.toDate) {
|
|
134
|
+
data.toDate = (0, dateRange_validations_1.normalizeDate)(data.toDate);
|
|
135
|
+
}
|
|
136
|
+
return data;
|
|
137
|
+
}),
|
|
138
|
+
});
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const getSuspensionSchema: z.ZodObject<{
|
|
3
|
+
params: z.ZodObject<{
|
|
4
|
+
suspensionId: z.ZodString;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
suspensionId: string;
|
|
7
|
+
}, {
|
|
8
|
+
suspensionId: string;
|
|
9
|
+
}>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
params: {
|
|
12
|
+
suspensionId: string;
|
|
13
|
+
};
|
|
14
|
+
}, {
|
|
15
|
+
params: {
|
|
16
|
+
suspensionId: string;
|
|
17
|
+
};
|
|
18
|
+
}>;
|
|
19
|
+
export declare const getUserSuspensionsSchema: z.ZodObject<{
|
|
20
|
+
params: z.ZodObject<{
|
|
21
|
+
userId: z.ZodString;
|
|
22
|
+
}, "strip", z.ZodTypeAny, {
|
|
23
|
+
userId: string;
|
|
24
|
+
}, {
|
|
25
|
+
userId: string;
|
|
26
|
+
}>;
|
|
27
|
+
query: z.ZodObject<{
|
|
28
|
+
includeResolved: z.ZodOptional<z.ZodEnum<["true", "false"]>>;
|
|
29
|
+
status: z.ZodOptional<z.ZodEnum<["active", "expired", "revoked"]>>;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
status?: "active" | "revoked" | "expired" | undefined;
|
|
32
|
+
includeResolved?: "true" | "false" | undefined;
|
|
33
|
+
}, {
|
|
34
|
+
status?: "active" | "revoked" | "expired" | undefined;
|
|
35
|
+
includeResolved?: "true" | "false" | undefined;
|
|
36
|
+
}>;
|
|
37
|
+
}, "strip", z.ZodTypeAny, {
|
|
38
|
+
params: {
|
|
39
|
+
userId: string;
|
|
40
|
+
};
|
|
41
|
+
query: {
|
|
42
|
+
status?: "active" | "revoked" | "expired" | undefined;
|
|
43
|
+
includeResolved?: "true" | "false" | undefined;
|
|
44
|
+
};
|
|
45
|
+
}, {
|
|
46
|
+
params: {
|
|
47
|
+
userId: string;
|
|
48
|
+
};
|
|
49
|
+
query: {
|
|
50
|
+
status?: "active" | "revoked" | "expired" | undefined;
|
|
51
|
+
includeResolved?: "true" | "false" | undefined;
|
|
52
|
+
};
|
|
53
|
+
}>;
|
|
54
|
+
export declare const createSuspensionSchema: z.ZodObject<{
|
|
55
|
+
params: z.ZodObject<{
|
|
56
|
+
userId: z.ZodString;
|
|
57
|
+
}, "strip", z.ZodTypeAny, {
|
|
58
|
+
userId: string;
|
|
59
|
+
}, {
|
|
60
|
+
userId: string;
|
|
61
|
+
}>;
|
|
62
|
+
body: z.ZodObject<{
|
|
63
|
+
reason: z.ZodString;
|
|
64
|
+
endsAt: z.ZodEffects<z.ZodString, string, string>;
|
|
65
|
+
}, "strict", z.ZodTypeAny, {
|
|
66
|
+
reason: string;
|
|
67
|
+
endsAt: string;
|
|
68
|
+
}, {
|
|
69
|
+
reason: string;
|
|
70
|
+
endsAt: string;
|
|
71
|
+
}>;
|
|
72
|
+
}, "strip", z.ZodTypeAny, {
|
|
73
|
+
params: {
|
|
74
|
+
userId: string;
|
|
75
|
+
};
|
|
76
|
+
body: {
|
|
77
|
+
reason: string;
|
|
78
|
+
endsAt: string;
|
|
79
|
+
};
|
|
80
|
+
}, {
|
|
81
|
+
params: {
|
|
82
|
+
userId: string;
|
|
83
|
+
};
|
|
84
|
+
body: {
|
|
85
|
+
reason: string;
|
|
86
|
+
endsAt: string;
|
|
87
|
+
};
|
|
88
|
+
}>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSuspensionSchema = exports.getUserSuspensionsSchema = exports.getSuspensionSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
// Base schemas
|
|
6
|
+
const uuidSchema = zod_1.z.string().uuid("Invalid UUID format");
|
|
7
|
+
exports.getSuspensionSchema = zod_1.z.object({
|
|
8
|
+
params: zod_1.z.object({
|
|
9
|
+
suspensionId: uuidSchema,
|
|
10
|
+
}),
|
|
11
|
+
});
|
|
12
|
+
exports.getUserSuspensionsSchema = zod_1.z.object({
|
|
13
|
+
params: zod_1.z.object({
|
|
14
|
+
userId: uuidSchema,
|
|
15
|
+
}),
|
|
16
|
+
query: zod_1.z.object({
|
|
17
|
+
includeResolved: zod_1.z.enum(["true", "false"]).optional(),
|
|
18
|
+
status: zod_1.z.enum(["active", "expired", "revoked"]).optional(),
|
|
19
|
+
}),
|
|
20
|
+
});
|
|
21
|
+
exports.createSuspensionSchema = zod_1.z.object({
|
|
22
|
+
params: zod_1.z.object({
|
|
23
|
+
userId: uuidSchema,
|
|
24
|
+
}),
|
|
25
|
+
body: zod_1.z
|
|
26
|
+
.object({
|
|
27
|
+
reason: zod_1.z
|
|
28
|
+
.string()
|
|
29
|
+
.min(5, "Reason must be at least 5 characters")
|
|
30
|
+
.max(1000, "Reason cannot exceed 1000 characters"),
|
|
31
|
+
endsAt: zod_1.z
|
|
32
|
+
.string()
|
|
33
|
+
.datetime("Invalid date format")
|
|
34
|
+
.refine((date) => new Date(date) > new Date(), {
|
|
35
|
+
message: "End date must be in the future",
|
|
36
|
+
}),
|
|
37
|
+
})
|
|
38
|
+
.strict(),
|
|
39
|
+
});
|