-async function isVideoExist (id: string, res: Response) {
- let video: VideoModel
-
- if (validator.isInt(id)) {
- video = await VideoModel.loadAndPopulateAccountAndServerAndTags(+id)
- } else { // UUID
- video = await VideoModel.loadByUUIDAndPopulateAccountAndServerAndTags(id)
- }
-
- if (!video) {
- res.status(404)
- .json({ error: 'Video not found' })
- .end()
-
- return false
- }
-
- res.locals.video = video
- return true
+function isVideoFileSizeValid (value: string) {
+ return exists(value) && validator.isInt(value + '', VIDEOS_CONSTRAINTS_FIELDS.FILE_SIZE)