Ajout de la gestion des vidéos inachevées et mise à jour des fonctions de création et de mise à jour des vidéos dans le gestionnaire de base de données.

This commit is contained in:
2025-04-03 11:27:11 +02:00
parent 6077dfd716
commit 03ec179590
4 changed files with 88 additions and 142 deletions

View File

@@ -160,6 +160,26 @@ const video = {
const videoPath = `${projectPath}/videos/${orderId}.mp4`;
console.log("[FILE] get_video : " + videoPath);
return await handleFileOperation(getFile, videoPath);
},
delete_video: async function (videoId) {
const query = database_manager.video.get_video_by_id(videoId);
const videoPath = query.video_file;
console.log("[FILE] delete_video : " + videoPath);
return await handleFileOperation(deleteFile, videoPath);
},
delete_unfinished_videos: async function () {
const unfinishedVideos = await database_manager.video.get_unfinished_videos();
for (const video of unfinishedVideos) {
try {
await this.delete_video(video.id);
console.log(`Deleted unfinished video with id: ${video.id}`);
} catch (error) {
console.error(`Error deleting unfinished video with id: ${video.id}`, error);
}
}
}
}