PeerTube/server/middlewares/validators/shared/video-imports.ts

23 lines
533 B
TypeScript
Raw Normal View History

2021-08-27 14:32:44 +02:00
import express from 'express'
import { VideoImportModel } from '@server/models/video/video-import'
2021-07-16 10:42:24 +02:00
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
}