chore: lint

This commit is contained in:
karishmas6
2024-10-03 04:42:24 +05:30
parent d8348386f3
commit ec8e152b43

View File

@@ -146,21 +146,20 @@ router.get('/api-key', requireSignIn, async (req: AuthenticatedRequest, res) =>
router.delete('/delete-api-key', requireSignIn, async (req, res) => {
try {
const user = await User.findByPk(req.user.id, { raw: true });
if (!user) {
return res.status(404).json({ message: 'User not found' });
}
if (!user.api_key) {
return res.status(404).json({ message: 'API Key not found' });
}
await User.update({ api_key: null }, { where: { id: req.user.id } });
return res.status(200).json({ message: 'API Key deleted successfully' });
const user = await User.findByPk(req.user.id, { raw: true });
if (!user) {
return res.status(404).json({ message: 'User not found' });
}
if (!user.api_key) {
return res.status(404).json({ message: 'API Key not found' });
}
await User.update({ api_key: null }, { where: { id: req.user.id } });
return res.status(200).json({ message: 'API Key deleted successfully' });
} catch (error: any) {
return res.status(500).json({ message: 'Error deleting API key', error: error.message });
return res.status(500).json({ message: 'Error deleting API key', error: error.message });
}
});
});