From 8565a00893d0600d4f4df441d941ec42fc9eb483 Mon Sep 17 00:00:00 2001 From: Kerboul Date: Tue, 11 Feb 2025 11:09:28 +0100 Subject: [PATCH] =?UTF-8?q?Refactor=20la=20r=C3=A9cup=C3=A9ration=20des=20?= =?UTF-8?q?projets=20pour=20utiliser=20une=20requ=C3=AAte=20SQL=20et=20cor?= =?UTF-8?q?rige=20le=20format=20du=20chemin=20de=20sortie=20vid=C3=A9o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routes/api.js | 10 +++++----- utils/video.js | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/routes/api.js b/routes/api.js index 7327215..f6cd998 100644 --- a/routes/api.js +++ b/routes/api.js @@ -94,13 +94,13 @@ router.get('/projects/:id', async (req, res) => { return res.status(400).json({ error: 'Invalid project ID' }); } try { - const project = await projectModel.getProjectById(db, projectId); - if (!project) { - return res.status(404).json({ error: 'Projet non trouvé' }); + const project = await db.query('SELECT * FROM public.projects WHERE id = $1', [projectId]); + if (project.rows.length === 0) { + return res.status(404).json({ error: 'Project not found' }); } - res.json(project); + res.json(project.rows[0]); } catch (error) { - serverError.sendError('Erreur lors de la récupération du projet:', res, error); + serverError.sendError('Error getting project:', res, error); } }); diff --git a/utils/video.js b/utils/video.js index ee81361..168aaea 100644 --- a/utils/video.js +++ b/utils/video.js @@ -5,7 +5,7 @@ const serverError = require('../utils/serverError'); async function createVideo(projectId) { const imageDir = `/storage/${projectId}`; - const outputVideo = `/storage/${projectId}/videos/output_video.mp4`; + const outputVideo = `/storage/videos/output_${projectId}_video.mp4`; const frameRate = 24; const tempFile = `/storage/${projectId}/temp_file.txt`;