Modifier la fonction getPathList pour utiliser orderId au lieu de id lors de la récupération des chemins
This commit is contained in:
@@ -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
BIN
sample/cat.mp4
Normal file
Binary file not shown.
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
@@ -49,3 +53,4 @@ videoManager.createVideoWithList(1, pathList).then(res => {
|
||||
});
|
||||
|
||||
exports.getSmileImage = getSmileImage;
|
||||
exports.getCatVideo = getCatVideo;
|
||||
Reference in New Issue
Block a user