aboutsummaryrefslogblamecommitdiffhomepage
path: root/server/middlewares/validators/shared/video-imports.ts
blob: 69fda4b324a468d320cb0270f916d203a487a893 (plain) (tree)
1
2
3
                             
                                                                    
                                               


















                                                                         
import express from 'express'
import { VideoImportModel } from '@server/models/video/video-import'
import { HttpStatusCode } from '@shared/models'

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
}