From adf955cbc7d412d1bfcb0706fa910d912f780595 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Klaas=20B=C3=B6rgmann?= Date: Thu, 9 Jan 2025 21:43:31 +0100 Subject: [PATCH] Features erledigt markieren --- app.js | 15 +++++++++++++++ views/feature.ejs | 6 ++++++ 2 files changed, 21 insertions(+) diff --git a/app.js b/app.js index ff9c582..0b462ff 100644 --- a/app.js +++ b/app.js @@ -1196,6 +1196,21 @@ app.get("/feature", requireAuth, async (req, res) => { } }); +app.post("/featuredone", requireAdmin, async (req, res) => { + const { id } = req.body; + try { + const featureResult = await pool.query( + "UPDATE features set done = true WHERE id = $1", + [id] + ); + res.redirect("/feature"); + } catch (error) { + console.error("Error:", error); + req.session.message = ["Error", error, "error"]; + res.render("feature", { features, session: req.session }); + } +}); + app.post("/feature", requireAdmin, async (req, res) => { const { title, body, type, urgency, user } = req.body; const userResult = await pool.query( diff --git a/views/feature.ejs b/views/feature.ejs index 6be47d0..a0036c1 100644 --- a/views/feature.ejs +++ b/views/feature.ejs @@ -56,6 +56,12 @@
<%= feature.title %> <%= date.getDate() %>.<%= date.getMonth() + 1 %>.<%= date.getFullYear() %> - <%= date.getHours() %>:<%= date.getMinutes() %> - ( <%= feature.type === 1 ? 'Feature' : feature.type === 2 ? 'Bug' : 'Design' %>) <%= feature.done ? '(erledigt)' : '' %>

<%= feature.body %>

+ <% if (session.userName === 'klaas' && feature.done == false) { %> +
+ + +
+ <% } %>
<% }) %>