🚧 Add admin api and ui for timetable management

This commit is contained in:
2023-06-20 23:10:52 +02:00
parent 0e2cc70a6b
commit 0ae553cca8
10 changed files with 307 additions and 5 deletions

View File

@ -17,6 +17,8 @@ import auth from "./api/auth.js";
import { Parser } from "./parser/index.js";
import { BolleClient } from "./parser/bolle.js";
import { parseSubstitutionPlan } from "./parser/untis.js";
import { registerAdmin } from "./api/admin.js";
import { checkAdmin } from "./api/permission.js";
// Check that credentials are supplied
if (
@ -69,6 +71,11 @@ app.get("/api/substitutions", getSubstitutions);
app.get("/api/history", getHistory);
app.get("/api/classes", getClasses);
app.post("/api/token", auth.token);
// Register Admin endpoints
app.use("/api/admin", checkAdmin);
registerAdmin(app);
// Respond with 400 for non-existent endpoints
app.get("/api/*", (_req, res) => {
res.sendStatus(400);