delete /item
This commit is contained in:
		@@ -219,6 +219,18 @@ async function deleteGroup(group_id, sl_id) {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//Delete Item
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					async function deleteItem(item_id, group_id, sl_id) {
 | 
				
			||||||
 | 
					    try {
 | 
				
			||||||
 | 
					        nonQuery('DELETE FROM "Item" WHERE item_id = $1 AND group_id = $2 AND sl_id = $3;', [item_id, group_id, sl_id]);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    catch(error) {
 | 
				
			||||||
 | 
					        console.error(error);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -327,5 +339,5 @@ function generateInviteLink() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
module.exports = {
 | 
					module.exports = {
 | 
				
			||||||
    getShoppinglistsAdmin, getShoppinglistsShared, newShoppinglist, displayShoppinglist, deleteShoppinglist, addGroup,
 | 
					    getShoppinglistsAdmin, getShoppinglistsShared, newShoppinglist, displayShoppinglist, deleteShoppinglist, addGroup,
 | 
				
			||||||
    addItem, verifyInvite, createInvite, editShoppinglist, editGroup, editItem, deleteGroup
 | 
					    addItem, verifyInvite, createInvite, editShoppinglist, editGroup, editItem, deleteGroup, deleteItem
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -253,6 +253,16 @@ router.delete("/group", async(req, res) => {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					router.delete("/item", async(req, res) => {
 | 
				
			||||||
 | 
					  try {
 | 
				
			||||||
 | 
					    res.status(200).send(await postgres.deleteItem(req.body.item_id, req.body.group.id, req.body.sl_id));
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  catch(err) {
 | 
				
			||||||
 | 
					    res.status(400).send(await err);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Invite System
 | 
					// Invite System
 | 
				
			||||||
 | 
					
 | 
				
			||||||
router.post("/invite", async (req, res) => {
 | 
					router.post("/invite", async (req, res) => {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user