Баллы +1 за загрузку, убраны из лайков. Админ-панель (admin/admin123)

This commit is contained in:
2026-05-29 12:13:42 +03:00
parent f8f220469c
commit 12701ffbc2
19 changed files with 250 additions and 62 deletions

View File

@@ -99,7 +99,7 @@ router.post('/', authMiddleware, upload.single('image'), (req: AuthRequest, res:
[req.userId, image_url, caption]
);
execute('UPDATE users SET points = points + 10 WHERE id = ?', [req.userId]);
execute('UPDATE users SET points = points + 1 WHERE id = ?', [req.userId]);
const cat = queryOne(
`SELECT c.id, c.image_url, c.caption, c.created_at, c.user_id,
@@ -120,7 +120,7 @@ router.delete('/:id', authMiddleware, (req: AuthRequest, res: Response) => {
res.status(404).json({ error: 'Cat not found' });
return;
}
if (cat.user_id !== req.userId) {
if (cat.user_id !== req.userId && !req.isAdmin) {
res.status(403).json({ error: 'Not your cat' });
return;
}