ResMan: active/cancelled tables, status field, docker setup

This commit is contained in:
root
2026-03-05 17:19:22 +01:00
parent 766894bd74
commit 264e7e3ba9
2 changed files with 347 additions and 226 deletions
+32 -3
View File
@@ -12,12 +12,41 @@ const path = require("path");
/* Static Files */
app.use("/resman", express.static(path.join(__dirname, "public")));
/* LIST */
app.get(`${BASE_PATH}/resources`, async (req, res) => {
const [rows] = await pool.query("SELECT * FROM resources");
/* Resourcen laden */
app.get("/resman/api/resources", async (req, res) => {
const [rows] = await pool.query(
"SELECT * FROM resources WHERE status != 'gekündigt'"
);
res.json(rows);
});
/* LIST Aktive resourcen*/
app.get("/resman/api/resources/active", async (req, res) => {
const [rows] = await pool.query(
"SELECT * FROM resources WHERE status != 'gekündigt'"
);
res.json(rows);
});
/* LIST Gekündigte resourcen*/
app.get("/resman/api/resources/cancelled", async (req, res) => {
const [rows] = await pool.query(
"SELECT * FROM resources WHERE status = 'gekündigt'"
);
console.log("Cancelled resources:", rows);
res.json(rows);
});
/* INSERT */
app.post(`${BASE_PATH}/resources`, async (req, res) => {
const data = req.body;