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.body %>
+ <% if (session.userName === 'klaas' && feature.done == false) { %> + + <% } %>