Ajouter le project_id à la requête de récupération des vidéos et mettre à jour la fonction getPathList pour l'utiliser

This commit is contained in:
2025-02-12 10:59:54 +01:00
parent bc2159f5f9
commit 8b0de65272
2 changed files with 9 additions and 4 deletions

View File

@@ -300,7 +300,7 @@ router.get('/videos/file/:video_id', (req, res) => {
*/
router.post('/videos/render/:video_id', (req, res) => {
const videoId = req.params.video_id;
const query = 'SELECT measurement_ids FROM public.videos WHERE id = $1';
const query = 'SELECT measurement_ids, project_id FROM public.videos WHERE id = $1';
db.query(query, [videoId], (err, results) => {
if (err) {
return serverError.sendError('Error getting video:', res, err);
@@ -309,7 +309,10 @@ router.post('/videos/render/:video_id', (req, res) => {
return res.status(404).json({ error: 'Video not found' });
}
const measurementIds = results.rows[0].measurement_ids;
measureManager.getPathList(measurementIds).then(pathList => {
const project_id = results.rows[0].project_id;
console.log('Measurement IDs:', measurementIds);
console.log('Project ID:', project_id);
measureManager.getPathList(measurementIds, project_id).then(pathList => {
console.log('Path list:', pathList);
res.json({ message: 'Render process started' });
}).catch(err => {

View File

@@ -91,10 +91,12 @@ async function getPathFromIds(projectId, orderId) {
return res.rows[0].path;
}
async function getPathList(IdList) {
async function getPathList(IdList, projectId) {
console.log(IdList);
const pathList = [];
for (const id of IdList) {
const path = await getPathFromIds(id);
const path = await getPathFromIds(projectId, id);
console.log(path);
pathList.push(path);
}
return pathList;