1 import express from 'express'
2 import { HttpStatusCode } from '@shared/models'
3 import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared'
5 const tags = [ 'runner' ]
7 export const runnerJobGetVideoTranscodingFileValidator = [
8 isValidVideoIdParam('videoId'),
10 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
11 if (areValidationErrors(req, res)) return
13 if (!await doesVideoExist(req.params.videoId, res, 'all')) return
15 const runnerJob = res.locals.runnerJob
17 if (runnerJob.privatePayload.videoUUID !== res.locals.videoAll.uuid) {
19 status: HttpStatusCode.FORBIDDEN_403,
20 message: 'Job is not associated to this video',
21 tags: [ ...tags, res.locals.videoAll.uuid ]