ResMan: active/cancelled tables, status field, docker setup
This commit is contained in:
+32
-3
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user