From 264e7e3ba9fc1f9c882228a77afa070d66142604 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 5 Mar 2026 17:19:22 +0100 Subject: [PATCH] ResMan: active/cancelled tables, status field, docker setup --- backend/public/index.html | 538 ++++++++++++++++++++++---------------- backend/server.js | 35 ++- 2 files changed, 347 insertions(+), 226 deletions(-) diff --git a/backend/public/index.html b/backend/public/index.html index fcd49b9..ca47a03 100644 --- a/backend/public/index.html +++ b/backend/public/index.html @@ -1,171 +1,204 @@ - - ResMan - + +ResMan + + +
-

Resource Manager

- +

Resource Manager

+ + + +

Aktive Ressourcen

+ + + + + + + + + + + + + + + +
NameProduktProviderCPURAMDiskStatusAktionen
+ + +

Gekündigte Ressourcen

+ + + + + + + + + + + + + + + +
NameProduktProviderCPURAMDiskStatusAktionen
- - - - - - - - - - - - - - -
NameProduktProviderCPURAMDiskStatusAktionen
+ + + + + diff --git a/backend/server.js b/backend/server.js index c9c57e9..b91e916 100644 --- a/backend/server.js +++ b/backend/server.js @@ -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;