Not sure why I did this...

This commit is contained in:
Atridad Lahiji 2023-08-14 21:29:18 -06:00 committed by atridadl
parent e61a7b183a
commit 84b48cadd4
No known key found for this signature in database

View file

@ -8,16 +8,14 @@ export const onUserDeletedHandler = async (
userId: string, userId: string,
res: NextApiResponse res: NextApiResponse
) => { ) => {
const deletedRoom = await db.delete(rooms).where(eq(rooms.userId, userId)); try {
await db.delete(rooms).where(eq(rooms.userId, userId));
if (deletedRoom.rowsAffected > 0) {
await db.delete(logs).where(eq(logs.userId, userId)); await db.delete(logs).where(eq(logs.userId, userId));
await db.delete(votes).where(eq(votes.userId, userId)); await db.delete(votes).where(eq(votes.userId, userId));
// res.status(200).json({ result: "USER DELETED" });
res.status(200).json({ result: "USER DELETED" }); res.status(200).json({ result: "USER DELETED" });
} else { } catch (error) {
res.status(404).json({ error: "USER WITH THIS ID NOT FOUND" }); res.status(500).json({ error: error });
} }
}; };