add groups, add items

This commit is contained in:
Lukas Nowy
2018-11-28 21:12:30 +01:00
parent 4421f6b307
commit 5eac871dd0
3 changed files with 78 additions and 75 deletions

View File

@ -130,6 +130,31 @@ router.delete("/shoppinglist", async (req, res) => {
}
});
//Group erstellen
router.post("/group", async (req, res) => {
try {
res.status(200).send(await postgres.addGroup(req.body.sl_id, req.body.name, req.body.color));
}
catch(err) {
res.status(400).send(await err);
}
});
//Item erstellen
router.post("/item", async (req, res) => {
try {
res.status(200).send(postgres.addItem(req.body.group_id, req.body.sl_id, req.body.name, req.body.count));
}
catch (err) {
res.status(400).send(err);
}
});
router.get("/test1", (req, res) => {
res.render("index1");
});