Refactor la récupération des projets pour utiliser une requête SQL et corrige le format du chemin de sortie vidéo
This commit is contained in:
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -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`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user