Features erledigt markieren
This commit is contained in:
parent
1ea63c6743
commit
adf955cbc7
15
app.js
15
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(
|
||||
|
|
|
@ -56,6 +56,12 @@
|
|||
<div>
|
||||
<strong><u> <%= feature.title %> </strong><%= date.getDate() %>.<%= date.getMonth() + 1 %>.<%= date.getFullYear() %> - <%= date.getHours() %>:<%= date.getMinutes() %> - ( <%= feature.type === 1 ? 'Feature' : feature.type === 2 ? 'Bug' : 'Design' %>)</u> <%= feature.done ? '(erledigt)' : '' %></br>
|
||||
<p> <%= feature.body %> </p>
|
||||
<% if (session.userName === 'klaas' && feature.done == false) { %>
|
||||
<form method="post" action="/featureDone">
|
||||
<input type="hidden" name="id" value="<%= feature.id %>">
|
||||
<button type="submit" class="btn btn-success">Erledigt</button>
|
||||
</form>
|
||||
<% } %>
|
||||
</div>
|
||||
<% }) %>
|
||||
|
||||
|
|
Loading…
Reference in New Issue