Modifier la fonction getPathList pour utiliser orderId au lieu de id lors de la récupération des chemins

This commit is contained in:
2025-02-12 11:05:25 +01:00
parent 8b0de65272
commit eb63c84443
4 changed files with 36 additions and 3 deletions

View File

@@ -322,4 +322,31 @@ router.post('/videos/render/:video_id', (req, res) => {
});
});
/**
* @swagger
* /cat:
* get:
* summary: Retrieve a cat video
* responses:
* 200:
* description: A cat video
* content:
* video/mp4:
* schema:
* type: string
* format: binary
* 404:
* description: Video not found
*/
router.get('/cat', (req, res) => {
const videoPath = dbTester.getCatVideo();
fs.access(videoPath, fs.constants.F_OK, (err) => {
if (err) {
console.error('Video not found:', err);
return res.status(404).json({ error: 'Video not found' });
}
res.sendFile(videoPath);
});
});
module.exports = router;

BIN
sample/cat.mp4 Normal file

Binary file not shown.

View File

@@ -94,8 +94,9 @@ async function getPathFromIds(projectId, orderId) {
async function getPathList(IdList, projectId) {
console.log(IdList);
const pathList = [];
for (const id of IdList) {
const path = await getPathFromIds(projectId, id);
for (const orderId of IdList) {
console.log(orderId);
const path = await getPathFromIds(projectId, orderId);
console.log(path);
pathList.push(path);
}

View File

@@ -18,6 +18,10 @@ function getSmileImage() {
return path.join(__dirname, '../sample/smile.png');
}
function getCatVideo() {
return path.join(__dirname, '../sample/cat.mp4');
}
// //test de lancement d'une création de vidéo sur le projet 1
// // videoManager.createVideo(1).then(res => {
// // console.log('3 - Video created:', res);
@@ -48,4 +52,5 @@ videoManager.createVideoWithList(1, pathList).then(res => {
console.error('Error:', err);
});
exports.getSmileImage = getSmileImage;
exports.getSmileImage = getSmileImage;
exports.getCatVideo = getCatVideo;