add get all users/groups routes

This commit is contained in:
alu committed 2024-07-03 23:46:00 +00:00
1 parent 7f48f49445
commit 800033c6f8
4 files changed
+52

No files matched your search

+2
View File
@@ -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:
+16
View File
@@ -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())
});
+16
View File
@@ -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())
});