MVideoFullLight,
MVideoId,
MVideoImmutable,
- MVideoThumbnail,
- MVideoWithRights
+ MVideoThumbnail
} from '@server/types/models'
-import { Hooks } from '../plugins/hooks'
type VideoLoadType = 'for-api' | 'all' | 'only-video' | 'id' | 'none' | 'only-immutable-attributes'
userId?: number
): Promise<MVideoFullLight | MVideoThumbnail | MVideoId | MVideoImmutable> {
- if (fetchType === 'for-api') {
- return Hooks.wrapPromiseFun(
- VideoModel.loadForGetAPI,
- { id, userId },
- 'filter:api.video.get.result'
- )
- }
+ if (fetchType === 'for-api') return VideoModel.loadForGetAPI({ id, userId })
- if (fetchType === 'all') return VideoModel.loadAndPopulateAccountAndServerAndTags(id, undefined, userId)
+ if (fetchType === 'all') return VideoModel.loadFull(id, undefined, userId)
if (fetchType === 'only-immutable-attributes') return VideoModel.loadImmutableAttributes(id)