Invite Link
Einladungslink erstellen und über diesen zu shoppinglist eingeladen werden
This commit is contained in:
		@@ -109,7 +109,7 @@ router.post("/shoppinglist", async function(req, res, next) {
 | 
			
		||||
 | 
			
		||||
router.get("/shoppinglist_json/:sl_id", async (req, res) => {
 | 
			
		||||
  try {
 | 
			
		||||
    res.status(200).send(await postgres.displayShoppinglist(req.params.sl_id));
 | 
			
		||||
    res.status(200).send(await postgres.displayShoppinglist(req.params.sl_id, req.session.passport.user.profile.id));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  catch(err) {
 | 
			
		||||
@@ -146,20 +146,45 @@ router.post("/group", async (req, res) => {
 | 
			
		||||
 | 
			
		||||
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));
 | 
			
		||||
   res.status(200).send(await postgres.addItem(req.body.group_id, req.body.sl_id, req.body.name, req.body.count));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  catch (err) {
 | 
			
		||||
    res.status(400).send(err);
 | 
			
		||||
    res.status(400).send(await err);
 | 
			
		||||
  }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
router.get("/test1", (req, res) => {
 | 
			
		||||
  res.render("index1");
 | 
			
		||||
    res.render("index1");
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
router.get("/userinfo_json", (req, res) => {
 | 
			
		||||
  res.send(req.session.passport.user);
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
// Invite System
 | 
			
		||||
 | 
			
		||||
router.post("/invite", async (req, res) => {
 | 
			
		||||
  try {
 | 
			
		||||
    res.status(200).send(await postgres.createInvite(req.body.sl_id));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  catch(err) {
 | 
			
		||||
    res.status(400).send(await err);
 | 
			
		||||
  }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
router.get("/invite/:link", async (req, res) => {
 | 
			
		||||
  try {
 | 
			
		||||
    await postgres.verifyInvite(req.params.link, req.session.passport.user.profile.id);
 | 
			
		||||
    res.redirect("/test1");
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  catch(err) {
 | 
			
		||||
    res.redirect("/test1");
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
module.exports = router;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user