aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/shared/video-imports.ts
blob: 0f984bc172b89ca6c4d93faffc31fcc100cd18b1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import * as express from 'express'
import { VideoImportModel } from '@server/models/video/video-import'
import { HttpStatusCode } from '@shared/core-utils'

async function doesVideoImportExist (id: number, res: express.Response) {
  const videoImport = await VideoImportModel.loadAndPopulateVideo(id)

  if (!videoImport) {
    res.fail({
      status: HttpStatusCode.NOT_FOUND_404,
      message: 'Video import not found'
    })
    return false
  }

  res.locals.videoImport = videoImport
  return true
}

export {
  doesVideoImportExist
}