@remnawave/backend-contract 0.0.36 → 0.0.39
Sign up to get free protection for your applications and to get access to all the features.
@@ -6,21 +6,29 @@ const api_1 = require("../../api");
|
|
6
6
|
const users_schema_1 = require("../../models/users.schema");
|
7
7
|
var GetAllUsersV2Command;
|
8
8
|
(function (GetAllUsersV2Command) {
|
9
|
-
GetAllUsersV2Command.url = api_1.REST_API.USERS.
|
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
|
-
start: zod_1.z.number().optional(),
|
12
|
-
size: zod_1.z.number().optional(),
|
20
|
+
start: zod_1.z.coerce.number().optional(),
|
21
|
+
size: zod_1.z.coerce.number().optional(),
|
13
22
|
filters: zod_1.z
|
14
|
-
.
|
15
|
-
id: zod_1.z.string(),
|
16
|
-
value: zod_1.z.string(),
|
17
|
-
}))
|
23
|
+
.preprocess((str) => (typeof str === 'string' ? JSON.parse(str) : str), zod_1.z.array(FilterSchema))
|
18
24
|
.optional(),
|
19
25
|
filterModes: zod_1.z
|
20
|
-
.record(zod_1.z.string(), zod_1.z.
|
26
|
+
.preprocess((str) => (typeof str === 'string' ? JSON.parse(str) : str), zod_1.z.record(zod_1.z.string(), zod_1.z.string()))
|
21
27
|
.optional(),
|
22
28
|
globalFilterMode: zod_1.z.string().optional(),
|
23
|
-
sorting: zod_1.z
|
29
|
+
sorting: zod_1.z
|
30
|
+
.preprocess((str) => (typeof str === 'string' ? JSON.parse(str) : str), zod_1.z.array(SortingSchema))
|
31
|
+
.optional(),
|
24
32
|
});
|
25
33
|
GetAllUsersV2Command.ResponseSchema = zod_1.z.object({
|
26
34
|
response: zod_1.z.object({
|
@@ -3,24 +3,43 @@ import { REST_API } from '../../api';
|
|
3
3
|
import { UsersSchema } from '../../models/users.schema';
|
4
4
|
|
5
5
|
export namespace GetAllUsersV2Command {
|
6
|
-
export const url = REST_API.USERS.
|
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
|
-
start: z.number().optional(),
|
10
|
-
size: z.number().optional(),
|
20
|
+
start: z.coerce.number().optional(),
|
21
|
+
size: z.coerce.number().optional(),
|
11
22
|
filters: z
|
12
|
-
.
|
13
|
-
|
14
|
-
|
15
|
-
value: z.string(),
|
16
|
-
}),
|
23
|
+
.preprocess(
|
24
|
+
(str) => (typeof str === 'string' ? JSON.parse(str) : str),
|
25
|
+
z.array(FilterSchema),
|
17
26
|
)
|
18
27
|
.optional(),
|
28
|
+
|
19
29
|
filterModes: z
|
20
|
-
.
|
30
|
+
.preprocess(
|
31
|
+
(str) => (typeof str === 'string' ? JSON.parse(str) : str),
|
32
|
+
z.record(z.string(), z.string()),
|
33
|
+
)
|
21
34
|
.optional(),
|
22
35
|
globalFilterMode: z.string().optional(),
|
23
|
-
|
36
|
+
|
37
|
+
sorting: z
|
38
|
+
.preprocess(
|
39
|
+
(str) => (typeof str === 'string' ? JSON.parse(str) : str),
|
40
|
+
z.array(SortingSchema),
|
41
|
+
)
|
42
|
+
.optional(),
|
24
43
|
});
|
25
44
|
|
26
45
|
export type RequestQuery = z.infer<typeof RequestQuerySchema>;
|