From 5ae05a9e680cbb04657786ef62ddf01ea52e8bfd Mon Sep 17 00:00:00 2001 From: antanst <> Date: Thu, 9 Oct 2025 11:39:30 +0300 Subject: [PATCH] Linting. --- backend/routes/projects.js | 31 +++++++++++++++++++------------ backend/routes/tasks.js | 22 ++++++++++++++++++---- backend/routes/telegram.js | 5 +---- 3 files changed, 38 insertions(+), 20 deletions(-) diff --git a/backend/routes/projects.js b/backend/routes/projects.js index f8ca3f2..c9143d9 100644 --- a/backend/routes/projects.js +++ b/backend/routes/projects.js @@ -123,20 +123,27 @@ async function updateProjectTags(project, tagsData, userId) { } // POST /api/upload/project-image -router.post('/upload/project-image', requireAuth, upload.single('image'), (req, res) => { - try { - if (!req.file) { - return res.status(400).json({ error: 'No image file provided' }); - } +router.post( + '/upload/project-image', + requireAuth, + upload.single('image'), + (req, res) => { + try { + if (!req.file) { + return res + .status(400) + .json({ error: 'No image file provided' }); + } - // Return the relative URL that can be accessed from the frontend - const imageUrl = `/api/uploads/projects/${req.file.filename}`; - res.json({ imageUrl }); - } catch (error) { - logError('Error uploading image:', error); - res.status(500).json({ error: 'Failed to upload image' }); + // Return the relative URL that can be accessed from the frontend + const imageUrl = `/api/uploads/projects/${req.file.filename}`; + res.json({ imageUrl }); + } catch (error) { + logError('Error uploading image:', error); + res.status(500).json({ error: 'Failed to upload image' }); + } } -}); +); // GET /api/projects router.get('/projects', async (req, res) => { diff --git a/backend/routes/tasks.js b/backend/routes/tasks.js index 8f05757..45bb560 100644 --- a/backend/routes/tasks.js +++ b/backend/routes/tasks.js @@ -2610,13 +2610,27 @@ router.delete( // Whitelist of known valid table names to prevent SQL injection const validTableNames = [ - 'tasks', 'projects', 'notes', 'users', 'tags', 'areas', - 'permissions', 'actions', 'task_events', 'inbox_items', - 'tasks_tags', 'notes_tags', 'projects_tags', 'Sessions' + 'tasks', + 'projects', + 'notes', + 'users', + 'tags', + 'areas', + 'permissions', + 'actions', + 'task_events', + 'inbox_items', + 'tasks_tags', + 'notes_tags', + 'projects_tags', + 'Sessions', ]; for (const table of allTables) { - if (table.name !== 'tasks' && validTableNames.includes(table.name)) { + if ( + table.name !== 'tasks' && + validTableNames.includes(table.name) + ) { try { const fks = await sequelize.query( `PRAGMA foreign_key_list(${table.name})`, diff --git a/backend/routes/telegram.js b/backend/routes/telegram.js index 70870c1..f16a859 100644 --- a/backend/routes/telegram.js +++ b/backend/routes/telegram.js @@ -198,10 +198,7 @@ async function sendWelcomeMessage(token, chatId) { resolve(false); } } catch (error) { - logError( - 'Error parsing welcome message response:', - error - ); + logError('Error parsing welcome message response:', error); resolve(false); } });