einkaufslisten übersicht, detailansicht

This commit is contained in:
Lukas Nowy
2018-11-19 17:18:04 +01:00
parent 7cfcc507ad
commit d5060d96f0
7 changed files with 120 additions and 28 deletions

View File

@ -63,7 +63,7 @@ router.get("/myshoppinglists", async function(req, res, next) {
try {
//Get user id: req.session.passport.user.profile.id
res.status(200).send(await postgres.getShoppinglistsAdmin("testuser"));
res.status(200).send(await postgres.getShoppinglistsAdmin("testuser1"));
}
catch(err) {
@ -77,7 +77,7 @@ router.get("/myshoppinglists", async function(req, res, next) {
router.get("/sharedshoppinglists", async function(req, res, next) {
try {
//Get user id: req.session.passport.user.profile.id
res.status(200).send(await postgres.getShoppinglistsShared("testuser"));
res.status(200).send(await postgres.getShoppinglistsShared("testuser1"));
}
catch(err) {
@ -90,7 +90,19 @@ router.get("/sharedshoppinglists", async function(req, res, next) {
router.post("/shoppinglist", async function(req, res, next) {
try {
res.status(200).send(await postgres.newShoppinglist(req.body.name, req.body.description, "testuser"));
res.status(200).send(await postgres.newShoppinglist(req.body.name, req.body.description, "testuser1"));
}
catch(err) {
res.status(400).send(await err);
}
});
//GET Shoppinglist detail
router.get("/shoppinglist/:sl_id", async (req, res) => {
try {
res.status(200).send(await postgres.displayShoppinglist(req.params.sl_id));
}
catch(err) {
@ -99,7 +111,7 @@ router.post("/shoppinglist", async function(req, res, next) {
});
router.get("/test1", (req, res) => {
res.send(req.user);
res.render("index1");
});
module.exports = router;