@remnawave/backend-contract 0.0.15 → 0.0.17
Sign up to get free protection for your applications and to get access to all the features.
- package/api/controllers/hosts.ts +5 -4
- package/api/routes.ts +1 -0
- package/build/api/controllers/hosts.js +5 -4
- package/build/api/routes.js +1 -0
- package/build/commands/hosts/get-all.command.js +13 -0
- package/build/commands/hosts/index.js +2 -0
- package/build/commands/hosts/reorder.command.js +21 -0
- package/build/constants/errors/errors.js +10 -0
- package/commands/hosts/get-all.command.ts +13 -0
- package/commands/hosts/index.ts +2 -0
- package/commands/hosts/reorder.command.ts +25 -0
- package/constants/errors/errors.ts +10 -0
- package/package.json +1 -1
package/api/controllers/hosts.ts
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
export const HOSTS_CONTROLLER = 'hosts' as const;
|
2
2
|
|
3
3
|
export const HOSTS_ROUTES = {
|
4
|
-
CREATE: '',
|
5
|
-
DELETE: '
|
6
|
-
GET_ALL: '',
|
7
|
-
UPDATE: '',
|
4
|
+
CREATE: 'create',
|
5
|
+
DELETE: 'delete',
|
6
|
+
GET_ALL: 'all',
|
7
|
+
UPDATE: 'update',
|
8
8
|
UPDATE_MANY: 'many',
|
9
|
+
REORDER: 'reorder',
|
9
10
|
} as const;
|
package/api/routes.ts
CHANGED
@@ -68,6 +68,7 @@ export const REST_API = {
|
|
68
68
|
GET_ALL: `${ROOT}/${CONTROLLERS.HOSTS_CONTROLLER}/${CONTROLLERS.HOSTS_ROUTES.GET_ALL}`,
|
69
69
|
UPDATE: `${ROOT}/${CONTROLLERS.HOSTS_CONTROLLER}/${CONTROLLERS.HOSTS_ROUTES.UPDATE}`,
|
70
70
|
UPDATE_MANY: `${ROOT}/${CONTROLLERS.HOSTS_CONTROLLER}/${CONTROLLERS.HOSTS_ROUTES.UPDATE_MANY}`,
|
71
|
+
REORDER: `${ROOT}/${CONTROLLERS.HOSTS_CONTROLLER}/${CONTROLLERS.HOSTS_ROUTES.REORDER}`,
|
71
72
|
DELETE: (uuid: string) =>
|
72
73
|
`${ROOT}/${CONTROLLERS.HOSTS_CONTROLLER}/${CONTROLLERS.HOSTS_ROUTES.DELETE}/${uuid}`,
|
73
74
|
},
|
@@ -3,9 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HOSTS_ROUTES = exports.HOSTS_CONTROLLER = void 0;
|
4
4
|
exports.HOSTS_CONTROLLER = 'hosts';
|
5
5
|
exports.HOSTS_ROUTES = {
|
6
|
-
CREATE: '',
|
7
|
-
DELETE: '
|
8
|
-
GET_ALL: '',
|
9
|
-
UPDATE: '',
|
6
|
+
CREATE: 'create',
|
7
|
+
DELETE: 'delete',
|
8
|
+
GET_ALL: 'all',
|
9
|
+
UPDATE: 'update',
|
10
10
|
UPDATE_MANY: 'many',
|
11
|
+
REORDER: 'reorder',
|
11
12
|
};
|
package/build/api/routes.js
CHANGED
@@ -87,6 +87,7 @@ exports.REST_API = {
|
|
87
87
|
GET_ALL: `${exports.ROOT}/${CONTROLLERS.HOSTS_CONTROLLER}/${CONTROLLERS.HOSTS_ROUTES.GET_ALL}`,
|
88
88
|
UPDATE: `${exports.ROOT}/${CONTROLLERS.HOSTS_CONTROLLER}/${CONTROLLERS.HOSTS_ROUTES.UPDATE}`,
|
89
89
|
UPDATE_MANY: `${exports.ROOT}/${CONTROLLERS.HOSTS_CONTROLLER}/${CONTROLLERS.HOSTS_ROUTES.UPDATE_MANY}`,
|
90
|
+
REORDER: `${exports.ROOT}/${CONTROLLERS.HOSTS_CONTROLLER}/${CONTROLLERS.HOSTS_ROUTES.REORDER}`,
|
90
91
|
DELETE: (uuid) => `${exports.ROOT}/${CONTROLLERS.HOSTS_CONTROLLER}/${CONTROLLERS.HOSTS_ROUTES.DELETE}/${uuid}`,
|
91
92
|
},
|
92
93
|
SYSTEM: {
|
@@ -0,0 +1,13 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.GetAllHostsCommand = void 0;
|
4
|
+
const zod_1 = require("zod");
|
5
|
+
const api_1 = require("../../api");
|
6
|
+
const models_1 = require("../../models");
|
7
|
+
var GetAllHostsCommand;
|
8
|
+
(function (GetAllHostsCommand) {
|
9
|
+
GetAllHostsCommand.url = api_1.REST_API.HOSTS.GET_ALL;
|
10
|
+
GetAllHostsCommand.ResponseSchema = zod_1.z.object({
|
11
|
+
response: zod_1.z.array(models_1.HostsSchema),
|
12
|
+
});
|
13
|
+
})(GetAllHostsCommand || (exports.GetAllHostsCommand = GetAllHostsCommand = {}));
|
@@ -16,3 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
17
|
__exportStar(require("./create.command"), exports);
|
18
18
|
__exportStar(require("./delete.command"), exports);
|
19
|
+
__exportStar(require("./get-all.command"), exports);
|
20
|
+
__exportStar(require("./reorder.command"), exports);
|
@@ -0,0 +1,21 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.ReorderHostCommand = void 0;
|
4
|
+
const zod_1 = require("zod");
|
5
|
+
const api_1 = require("../../api");
|
6
|
+
const models_1 = require("../../models");
|
7
|
+
var ReorderHostCommand;
|
8
|
+
(function (ReorderHostCommand) {
|
9
|
+
ReorderHostCommand.url = api_1.REST_API.HOSTS.REORDER;
|
10
|
+
ReorderHostCommand.RequestSchema = zod_1.z.object({
|
11
|
+
hosts: zod_1.z.array(models_1.HostsSchema.pick({
|
12
|
+
viewPosition: true,
|
13
|
+
uuid: true,
|
14
|
+
})),
|
15
|
+
});
|
16
|
+
ReorderHostCommand.ResponseSchema = zod_1.z.object({
|
17
|
+
response: zod_1.z.object({
|
18
|
+
isUpdated: zod_1.z.boolean(),
|
19
|
+
}),
|
20
|
+
});
|
21
|
+
})(ReorderHostCommand || (exports.ReorderHostCommand = ReorderHostCommand = {}));
|
@@ -243,4 +243,14 @@ exports.ERRORS = {
|
|
243
243
|
message: 'Update user with inbounds error',
|
244
244
|
httpCode: 500,
|
245
245
|
},
|
246
|
+
GET_ALL_HOSTS_ERROR: {
|
247
|
+
code: 'A050',
|
248
|
+
message: 'Get all hosts error',
|
249
|
+
httpCode: 500,
|
250
|
+
},
|
251
|
+
REORDER_HOSTS_ERROR: {
|
252
|
+
code: 'A051',
|
253
|
+
message: 'Reorder hosts error',
|
254
|
+
httpCode: 500,
|
255
|
+
},
|
246
256
|
};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { z } from 'zod';
|
2
|
+
import { REST_API } from '../../api';
|
3
|
+
import { HostsSchema } from '../../models';
|
4
|
+
|
5
|
+
export namespace GetAllHostsCommand {
|
6
|
+
export const url = REST_API.HOSTS.GET_ALL;
|
7
|
+
|
8
|
+
export const ResponseSchema = z.object({
|
9
|
+
response: z.array(HostsSchema),
|
10
|
+
});
|
11
|
+
|
12
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
13
|
+
}
|
package/commands/hosts/index.ts
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
import { z } from 'zod';
|
2
|
+
import { REST_API } from '../../api';
|
3
|
+
import { HostsSchema } from '../../models';
|
4
|
+
|
5
|
+
export namespace ReorderHostCommand {
|
6
|
+
export const url = REST_API.HOSTS.REORDER;
|
7
|
+
|
8
|
+
export const RequestSchema = z.object({
|
9
|
+
hosts: z.array(
|
10
|
+
HostsSchema.pick({
|
11
|
+
viewPosition: true,
|
12
|
+
uuid: true,
|
13
|
+
}),
|
14
|
+
),
|
15
|
+
});
|
16
|
+
export type Request = z.infer<typeof RequestSchema>;
|
17
|
+
|
18
|
+
export const ResponseSchema = z.object({
|
19
|
+
response: z.object({
|
20
|
+
isUpdated: z.boolean(),
|
21
|
+
}),
|
22
|
+
});
|
23
|
+
|
24
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
25
|
+
}
|
@@ -240,4 +240,14 @@ export const ERRORS = {
|
|
240
240
|
message: 'Update user with inbounds error',
|
241
241
|
httpCode: 500,
|
242
242
|
},
|
243
|
+
GET_ALL_HOSTS_ERROR: {
|
244
|
+
code: 'A050',
|
245
|
+
message: 'Get all hosts error',
|
246
|
+
httpCode: 500,
|
247
|
+
},
|
248
|
+
REORDER_HOSTS_ERROR: {
|
249
|
+
code: 'A051',
|
250
|
+
message: 'Reorder hosts error',
|
251
|
+
httpCode: 500,
|
252
|
+
},
|
243
253
|
} as const;
|