add: added constraints do the db and removed useless db deletions

This commit is contained in:
Lukian 2025-04-28 11:12:07 +02:00
parent bd29608010
commit 05dd75fa74
3 changed files with 121 additions and 5 deletions

View file

@ -100,8 +100,6 @@ router.post('/:name/delete', async (req, res) => {
return res.status(401).send({ error: 'Unauthorized' });
}
await deleteChannelMentions(connection, channel[0].id);
await deleteChannelMessages(connection, channel[0].id);
await deleteChannel(connection, channel[0].id);
connection.end();
@ -206,7 +204,6 @@ router.post('/:name/messages/delete', checkAuth, async (req, res) => {
}
await deleteMessage(connection, message_id);
await deleMentions(connection, message_id);
connection.end();
req.sockets.emit({

View file

@ -84,8 +84,6 @@ router.post('/:username/delete', checkAuth, async (req, res) => {
fs.unlinkSync(path.join(__dirname, `../data/pfps/${userToDelete[0].pfp}`));
}
await deleteUserMentions(connection, userToDelete[0].id);
await deleteUserMessages(connection, userToDelete[0].id);
await deleteUser(connection, userToDelete[0].id);
connection.end();