video.routes.ts61 lines, 1.4 KB
| 1 | import { Router } from "express"; |
| 2 | import { VideoController } from "../controllers/video.controller"; |
| 3 | import { authenticate } from "../middleware/auth.middleware"; |
| 4 | import { validateRequest } from "../middleware/validate-request"; |
| 5 | import { |
| 6 | getVideoInfoValidation, |
| 7 | downloadAudioValidation, |
| 8 | transcribeVideoValidation, |
| 9 | getTranscriptionStatusValidation, |
| 10 | getVideoByIdValidation, |
| 11 | cancelJobValidation, |
| 12 | } from "../validations/video.validation"; |
| 13 | |
| 14 | const router = Router(); |
| 15 | |
| 16 | router.post( |
| 17 | "/info", |
| 18 | authenticate, |
| 19 | getVideoInfoValidation, |
| 20 | validateRequest, |
| 21 | VideoController.getVideoInfo |
| 22 | ); |
| 23 | router.post( |
| 24 | "/download", |
| 25 | authenticate, |
| 26 | downloadAudioValidation, |
| 27 | validateRequest, |
| 28 | VideoController.downloadAudio |
| 29 | ); |
| 30 | router.post( |
| 31 | "/transcribe", |
| 32 | authenticate, |
| 33 | transcribeVideoValidation, |
| 34 | validateRequest, |
| 35 | VideoController.transcribeVideo |
| 36 | ); |
| 37 | router.get( |
| 38 | "/transcription/:jobId", |
| 39 | authenticate, |
| 40 | getTranscriptionStatusValidation, |
| 41 | validateRequest, |
| 42 | VideoController.getTranscriptionStatus |
| 43 | ); |
| 44 | router.get("/jobs", authenticate, VideoController.getAllJobs); |
| 45 | router.get( |
| 46 | "/:id", |
| 47 | authenticate, |
| 48 | getVideoByIdValidation, |
| 49 | validateRequest, |
| 50 | VideoController.getVideoById |
| 51 | ); |
| 52 | router.get("/", authenticate, VideoController.getUserVideos); |
| 53 | router.post( |
| 54 | "/jobs/:jobId/cancel", |
| 55 | authenticate, |
| 56 | cancelJobValidation, |
| 57 | validateRequest, |
| 58 | VideoController.cancelJob |
| 59 | ); |
| 60 | |
| 61 | export default router; |