@remnawave/backend-contract 0.0.38 → 0.0.39
Sign up to get free protection for your applications and to get access to all the features.
@@ -7,27 +7,27 @@ const users_schema_1 = require("../../models/users.schema");
|
|
7
7
|
var GetAllUsersV2Command;
|
8
8
|
(function (GetAllUsersV2Command) {
|
9
9
|
GetAllUsersV2Command.url = api_1.REST_API.USERS.GET_ALL_V2;
|
10
|
+
const FilterSchema = zod_1.z.object({
|
11
|
+
id: zod_1.z.string(),
|
12
|
+
value: zod_1.z.unknown(),
|
13
|
+
});
|
14
|
+
const SortingSchema = zod_1.z.object({
|
15
|
+
id: zod_1.z.string(),
|
16
|
+
desc: zod_1.z.boolean(),
|
17
|
+
});
|
18
|
+
// Основная схема для запроса
|
10
19
|
GetAllUsersV2Command.RequestQuerySchema = zod_1.z.object({
|
11
20
|
start: zod_1.z.coerce.number().optional(),
|
12
21
|
size: zod_1.z.coerce.number().optional(),
|
13
22
|
filters: zod_1.z
|
14
|
-
.string()
|
15
|
-
.transform((str) => JSON.parse(str))
|
16
|
-
.pipe(zod_1.z.array(zod_1.z.object({
|
17
|
-
id: zod_1.z.string(),
|
18
|
-
value: zod_1.z.string(),
|
19
|
-
})))
|
23
|
+
.preprocess((str) => (typeof str === 'string' ? JSON.parse(str) : str), zod_1.z.array(FilterSchema))
|
20
24
|
.optional(),
|
21
25
|
filterModes: zod_1.z
|
22
|
-
.string()
|
23
|
-
.transform((str) => JSON.parse(str))
|
24
|
-
.pipe(zod_1.z.record(zod_1.z.string(), zod_1.z.string()))
|
26
|
+
.preprocess((str) => (typeof str === 'string' ? JSON.parse(str) : str), zod_1.z.record(zod_1.z.string(), zod_1.z.string()))
|
25
27
|
.optional(),
|
26
28
|
globalFilterMode: zod_1.z.string().optional(),
|
27
29
|
sorting: zod_1.z
|
28
|
-
.string()
|
29
|
-
.transform((str) => JSON.parse(str))
|
30
|
-
.pipe(zod_1.z.array(zod_1.z.object({ id: zod_1.z.string(), desc: zod_1.z.boolean() })))
|
30
|
+
.preprocess((str) => (typeof str === 'string' ? JSON.parse(str) : str), zod_1.z.array(SortingSchema))
|
31
31
|
.optional(),
|
32
32
|
});
|
33
33
|
GetAllUsersV2Command.ResponseSchema = zod_1.z.object({
|
@@ -5,31 +5,40 @@ import { UsersSchema } from '../../models/users.schema';
|
|
5
5
|
export namespace GetAllUsersV2Command {
|
6
6
|
export const url = REST_API.USERS.GET_ALL_V2;
|
7
7
|
|
8
|
+
const FilterSchema = z.object({
|
9
|
+
id: z.string(),
|
10
|
+
value: z.unknown(),
|
11
|
+
});
|
12
|
+
|
13
|
+
const SortingSchema = z.object({
|
14
|
+
id: z.string(),
|
15
|
+
desc: z.boolean(),
|
16
|
+
});
|
17
|
+
|
18
|
+
// Основная схема для запроса
|
8
19
|
export const RequestQuerySchema = z.object({
|
9
20
|
start: z.coerce.number().optional(),
|
10
21
|
size: z.coerce.number().optional(),
|
11
22
|
filters: z
|
12
|
-
.
|
13
|
-
|
14
|
-
|
15
|
-
z.array(
|
16
|
-
z.object({
|
17
|
-
id: z.string(),
|
18
|
-
value: z.string(),
|
19
|
-
}),
|
20
|
-
),
|
23
|
+
.preprocess(
|
24
|
+
(str) => (typeof str === 'string' ? JSON.parse(str) : str),
|
25
|
+
z.array(FilterSchema),
|
21
26
|
)
|
22
27
|
.optional(),
|
28
|
+
|
23
29
|
filterModes: z
|
24
|
-
.
|
25
|
-
|
26
|
-
|
30
|
+
.preprocess(
|
31
|
+
(str) => (typeof str === 'string' ? JSON.parse(str) : str),
|
32
|
+
z.record(z.string(), z.string()),
|
33
|
+
)
|
27
34
|
.optional(),
|
28
35
|
globalFilterMode: z.string().optional(),
|
36
|
+
|
29
37
|
sorting: z
|
30
|
-
.
|
31
|
-
|
32
|
-
|
38
|
+
.preprocess(
|
39
|
+
(str) => (typeof str === 'string' ? JSON.parse(str) : str),
|
40
|
+
z.array(SortingSchema),
|
41
|
+
)
|
33
42
|
.optional(),
|
34
43
|
});
|
35
44
|
|