@remnawave/backend-contract 0.0.35 → 0.0.36

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,6 +6,7 @@ export const USERS_ROUTES = {
6
6
  GET_BY_SHORT_UUID: 'short-uuid',
7
7
  GET_BY_SUBSCRIPTION_UUID: 'sub-uuid',
8
8
  GET_ALL: '',
9
+ GET_ALL_V2: 'v2',
9
10
  REVOKE_SUBSCRIPTION: 'revoke',
10
11
  DISABLE_USER: 'disable',
11
12
  ENABLE_USER: 'enable',
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) =>
@@ -8,6 +8,7 @@ exports.USERS_ROUTES = {
8
8
  GET_BY_SHORT_UUID: 'short-uuid',
9
9
  GET_BY_SUBSCRIPTION_UUID: 'sub-uuid',
10
10
  GET_ALL: '',
11
+ GET_ALL_V2: 'v2',
11
12
  REVOKE_SUBSCRIPTION: 'revoke',
12
13
  DISABLE_USER: 'disable',
13
14
  ENABLE_USER: 'enable',
@@ -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,33 @@
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;
10
+ GetAllUsersV2Command.RequestQuerySchema = zod_1.z.object({
11
+ start: zod_1.z.number().optional(),
12
+ size: zod_1.z.number().optional(),
13
+ filters: zod_1.z
14
+ .array(zod_1.z.object({
15
+ id: zod_1.z.string(),
16
+ value: zod_1.z.string(),
17
+ }))
18
+ .optional(),
19
+ filterModes: zod_1.z
20
+ .record(zod_1.z.string(), zod_1.z.enum(['contains', 'startsWith', 'endsWith']))
21
+ .optional(),
22
+ globalFilterMode: zod_1.z.string().optional(),
23
+ sorting: zod_1.z.array(zod_1.z.object({ id: zod_1.z.string(), desc: zod_1.z.boolean() })).optional(),
24
+ });
25
+ GetAllUsersV2Command.ResponseSchema = zod_1.z.object({
26
+ response: zod_1.z.object({
27
+ users: zod_1.z.array(users_schema_1.UsersSchema.extend({
28
+ totalUsedBytes: zod_1.z.string(),
29
+ })),
30
+ total: zod_1.z.number(),
31
+ }),
32
+ });
33
+ })(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,41 @@
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;
7
+
8
+ export const RequestQuerySchema = z.object({
9
+ start: z.number().optional(),
10
+ size: z.number().optional(),
11
+ filters: z
12
+ .array(
13
+ z.object({
14
+ id: z.string(),
15
+ value: z.string(),
16
+ }),
17
+ )
18
+ .optional(),
19
+ filterModes: z
20
+ .record(z.string(), z.enum(['contains', 'startsWith', 'endsWith']))
21
+ .optional(),
22
+ globalFilterMode: z.string().optional(),
23
+ sorting: z.array(z.object({ id: z.string(), desc: z.boolean() })).optional(),
24
+ });
25
+
26
+ export type RequestQuery = z.infer<typeof RequestQuerySchema>;
27
+
28
+ export const ResponseSchema = z.object({
29
+ response: z.object({
30
+ users: z.array(
31
+ UsersSchema.extend({
32
+ totalUsedBytes: z.string(),
33
+ }),
34
+ ),
35
+
36
+ total: z.number(),
37
+ }),
38
+ });
39
+
40
+ export type Response = z.infer<typeof ResponseSchema>;
41
+ }
@@ -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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnawave/backend-contract",
3
- "version": "0.0.35",
3
+ "version": "0.0.36",
4
4
  "description": "A contract library for Remnawave",
5
5
  "main": "index.js",
6
6
  "scripts": {