Linting.
This commit is contained in:
parent
f4214c40da
commit
5ae05a9e68
3 changed files with 38 additions and 20 deletions
|
|
@ -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) => {
|
||||
|
|
|
|||
|
|
@ -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})`,
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue