add get all users/groups routes
This commit is contained in:
1 parent
7f48f49445
commit
800033c6f8
4 files changed
+52
No files matched your search
@@ -3,6 +3,8 @@ export const router = Router({ mergeParams: true }); ;
|
||||
|
||||
const checkAuth = global.utils.checkAuth;
|
||||
|
||||
global.utils.recursiveImportRoutes(router, "/access", "access", import.meta.url);
|
||||
|
||||
/**
|
||||
* GET - check authentication
|
||||
* responses:
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { Router } from "express";
|
||||
export const router = Router({ mergeParams: true });
|
||||
|
||||
/**
|
||||
* GET - get all groups
|
||||
* responses:
|
||||
* - 200: {auth:true, groups: Array}
|
||||
* - 201: {auth: false}
|
||||
*/
|
||||
router.get("/", async (req, res) => {
|
||||
const auth = await checkAuth(req.cookies, res);
|
||||
if (!auth) {
|
||||
return;
|
||||
}
|
||||
res.status(200).send(global.userManager.getAllGroups())
|
||||
});
|
||||
@@ -0,0 +1,16 @@
|
||||
import { Router } from "express";
|
||||
export const router = Router({ mergeParams: true });
|
||||
|
||||
/**
|
||||
* GET - get all users
|
||||
* responses:
|
||||
* - 200: {auth:true, users: Array}
|
||||
* - 201: {auth: false}
|
||||
*/
|
||||
router.get("/", async (req, res) => {
|
||||
const auth = await checkAuth(req.cookies, res);
|
||||
if (!auth) {
|
||||
return;
|
||||
}
|
||||
res.status(200).send(global.userManager.getAllUsers())
|
||||
});
|
||||
Reference in new issue
Block a user