From 0283eaac2a8e73006c66df3cf5bb9012e37450e5 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 20 Aug 2019 13:52:49 +0200 Subject: Cleanup model types --- server/helpers/video.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'server/helpers/video.ts') diff --git a/server/helpers/video.ts b/server/helpers/video.ts index 26a72ac5c..d066e2b1f 100644 --- a/server/helpers/video.ts +++ b/server/helpers/video.ts @@ -1,6 +1,12 @@ import { VideoModel } from '../models/video/video' import * as Bluebird from 'bluebird' -import { MVideoAccountAllFiles, MVideoFullLight, MVideoThumbnail, MVideoWithRights, MVideoIdThumbnail } from '@server/typings/models' +import { + MVideoAccountLightBlacklistAllFiles, + MVideoFullLight, + MVideoIdThumbnail, + MVideoThumbnail, + MVideoWithRights +} from '@server/typings/models' import { Response } from 'express' type VideoFetchType = 'all' | 'only-video' | 'only-video-with-rights' | 'id' | 'none' @@ -30,10 +36,10 @@ function fetchVideo ( type VideoFetchByUrlType = 'all' | 'only-video' -function fetchVideoByUrl (url: string, fetchType: 'all'): Bluebird +function fetchVideoByUrl (url: string, fetchType: 'all'): Bluebird function fetchVideoByUrl (url: string, fetchType: 'only-video'): Bluebird -function fetchVideoByUrl (url: string, fetchType: VideoFetchByUrlType): Bluebird | Bluebird -function fetchVideoByUrl (url: string, fetchType: VideoFetchByUrlType): Bluebird | Bluebird { +function fetchVideoByUrl (url: string, fetchType: VideoFetchByUrlType): Bluebird +function fetchVideoByUrl (url: string, fetchType: VideoFetchByUrlType): Bluebird { if (fetchType === 'all') return VideoModel.loadByUrlAndPopulateAccount(url) if (fetchType === 'only-video') return VideoModel.loadByUrl(url) @@ -43,10 +49,15 @@ function getVideo (res: Response) { return res.locals.videoAll || res.locals.onlyVideo || res.locals.onlyVideoWithRights || res.locals.videoId } +function getVideoWithAttributes (res: Response) { + return res.locals.videoAll || res.locals.onlyVideo || res.locals.onlyVideoWithRights +} + export { VideoFetchType, VideoFetchByUrlType, fetchVideo, getVideo, + getVideoWithAttributes, fetchVideoByUrl } -- cgit v1.2.3