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;
|
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) {
|
async function getPathList(IdList, projectId) {
|
||||||
console.log(IdList);
|
console.log(IdList);
|
||||||
const pathList = [];
|
const pathList = [];
|
||||||
for (const id of IdList) {
|
for (const orderId of IdList) {
|
||||||
const path = await getPathFromIds(projectId, id);
|
console.log(orderId);
|
||||||
|
const path = await getPathFromIds(projectId, orderId);
|
||||||
console.log(path);
|
console.log(path);
|
||||||
pathList.push(path);
|
pathList.push(path);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ function getSmileImage() {
|
|||||||
return path.join(__dirname, '../sample/smile.png');
|
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
|
// //test de lancement d'une création de vidéo sur le projet 1
|
||||||
// // videoManager.createVideo(1).then(res => {
|
// // videoManager.createVideo(1).then(res => {
|
||||||
// // console.log('3 - Video created:', res);
|
// // console.log('3 - Video created:', res);
|
||||||
@@ -48,4 +52,5 @@ videoManager.createVideoWithList(1, pathList).then(res => {
|
|||||||
console.error('Error:', err);
|
console.error('Error:', err);
|
||||||
});
|
});
|
||||||
|
|
||||||
exports.getSmileImage = getSmileImage;
|
exports.getSmileImage = getSmileImage;
|
||||||
|
exports.getCatVideo = getCatVideo;
|
||||||
Reference in New Issue
Block a user