@remnawave/backend-contract 0.0.35 → 0.0.38
Sign up to get free protection for your applications and to get access to all the features.
- package/api/controllers/users.ts +1 -0
- package/api/routes.ts +1 -0
- package/build/api/controllers/users.js +1 -0
- package/build/api/routes.js +1 -0
- package/build/commands/users/get-all-users-v2.command.js +41 -0
- package/build/commands/users/index.js +1 -0
- package/commands/users/get-all-users-v2.command.ts +51 -0
- package/commands/users/index.ts +1 -0
- package/package.json +1 -1
package/api/controllers/users.ts
CHANGED
package/api/routes.ts
CHANGED
@@ -56,6 +56,7 @@ export const REST_API = {
|
|
56
56
|
DELETE_USER: (uuid: string) =>
|
57
57
|
`${ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.DELETE_USER}/${uuid}`,
|
58
58
|
UPDATE: `${ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.UPDATE}`,
|
59
|
+
GET_ALL_V2: `${ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.GET_ALL_V2}`,
|
59
60
|
},
|
60
61
|
SUBSCRIPTION: {
|
61
62
|
GET: (shortUuid: string) =>
|
package/build/api/routes.js
CHANGED
@@ -77,6 +77,7 @@ exports.REST_API = {
|
|
77
77
|
ENABLE_USER: (uuid) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.ENABLE_USER}/${uuid}`,
|
78
78
|
DELETE_USER: (uuid) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.DELETE_USER}/${uuid}`,
|
79
79
|
UPDATE: `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.UPDATE}`,
|
80
|
+
GET_ALL_V2: `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.GET_ALL_V2}`,
|
80
81
|
},
|
81
82
|
SUBSCRIPTION: {
|
82
83
|
GET: (shortUuid) => `${exports.ROOT}/${CONTROLLERS.SUBSCRIPTION_CONTROLLER}/${CONTROLLERS.SUBSCRIPTION_ROUTES.GET}/${shortUuid}`,
|
@@ -0,0 +1,41 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.GetAllUsersV2Command = void 0;
|
4
|
+
const zod_1 = require("zod");
|
5
|
+
const api_1 = require("../../api");
|
6
|
+
const users_schema_1 = require("../../models/users.schema");
|
7
|
+
var GetAllUsersV2Command;
|
8
|
+
(function (GetAllUsersV2Command) {
|
9
|
+
GetAllUsersV2Command.url = api_1.REST_API.USERS.GET_ALL_V2;
|
10
|
+
GetAllUsersV2Command.RequestQuerySchema = zod_1.z.object({
|
11
|
+
start: zod_1.z.coerce.number().optional(),
|
12
|
+
size: zod_1.z.coerce.number().optional(),
|
13
|
+
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
|
+
})))
|
20
|
+
.optional(),
|
21
|
+
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()))
|
25
|
+
.optional(),
|
26
|
+
globalFilterMode: zod_1.z.string().optional(),
|
27
|
+
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() })))
|
31
|
+
.optional(),
|
32
|
+
});
|
33
|
+
GetAllUsersV2Command.ResponseSchema = zod_1.z.object({
|
34
|
+
response: zod_1.z.object({
|
35
|
+
users: zod_1.z.array(users_schema_1.UsersSchema.extend({
|
36
|
+
totalUsedBytes: zod_1.z.string(),
|
37
|
+
})),
|
38
|
+
total: zod_1.z.number(),
|
39
|
+
}),
|
40
|
+
});
|
41
|
+
})(GetAllUsersV2Command || (exports.GetAllUsersV2Command = GetAllUsersV2Command = {}));
|
@@ -18,6 +18,7 @@ __exportStar(require("./create-user.command"), exports);
|
|
18
18
|
__exportStar(require("./delete-user.command"), exports);
|
19
19
|
__exportStar(require("./disable-user.command.ts"), exports);
|
20
20
|
__exportStar(require("./enable-user.command"), exports);
|
21
|
+
__exportStar(require("./get-all-users-v2.command"), exports);
|
21
22
|
__exportStar(require("./get-all-users.command"), exports);
|
22
23
|
__exportStar(require("./get-user-by-short-uuid.command"), exports);
|
23
24
|
__exportStar(require("./get-user-by-subscription-uuid.command"), exports);
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import { z } from 'zod';
|
2
|
+
import { REST_API } from '../../api';
|
3
|
+
import { UsersSchema } from '../../models/users.schema';
|
4
|
+
|
5
|
+
export namespace GetAllUsersV2Command {
|
6
|
+
export const url = REST_API.USERS.GET_ALL_V2;
|
7
|
+
|
8
|
+
export const RequestQuerySchema = z.object({
|
9
|
+
start: z.coerce.number().optional(),
|
10
|
+
size: z.coerce.number().optional(),
|
11
|
+
filters: z
|
12
|
+
.string()
|
13
|
+
.transform((str) => JSON.parse(str))
|
14
|
+
.pipe(
|
15
|
+
z.array(
|
16
|
+
z.object({
|
17
|
+
id: z.string(),
|
18
|
+
value: z.string(),
|
19
|
+
}),
|
20
|
+
),
|
21
|
+
)
|
22
|
+
.optional(),
|
23
|
+
filterModes: z
|
24
|
+
.string()
|
25
|
+
.transform((str) => JSON.parse(str))
|
26
|
+
.pipe(z.record(z.string(), z.string()))
|
27
|
+
.optional(),
|
28
|
+
globalFilterMode: z.string().optional(),
|
29
|
+
sorting: z
|
30
|
+
.string()
|
31
|
+
.transform((str) => JSON.parse(str))
|
32
|
+
.pipe(z.array(z.object({ id: z.string(), desc: z.boolean() })))
|
33
|
+
.optional(),
|
34
|
+
});
|
35
|
+
|
36
|
+
export type RequestQuery = z.infer<typeof RequestQuerySchema>;
|
37
|
+
|
38
|
+
export const ResponseSchema = z.object({
|
39
|
+
response: z.object({
|
40
|
+
users: z.array(
|
41
|
+
UsersSchema.extend({
|
42
|
+
totalUsedBytes: z.string(),
|
43
|
+
}),
|
44
|
+
),
|
45
|
+
|
46
|
+
total: z.number(),
|
47
|
+
}),
|
48
|
+
});
|
49
|
+
|
50
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
51
|
+
}
|
package/commands/users/index.ts
CHANGED
@@ -2,6 +2,7 @@ export * from './create-user.command';
|
|
2
2
|
export * from './delete-user.command';
|
3
3
|
export * from './disable-user.command.ts';
|
4
4
|
export * from './enable-user.command';
|
5
|
+
export * from './get-all-users-v2.command';
|
5
6
|
export * from './get-all-users.command';
|
6
7
|
export * from './get-user-by-short-uuid.command';
|
7
8
|
export * from './get-user-by-subscription-uuid.command';
|