c6a1c5b66723229b5c514213c4558b078d936323
[oweals/peertube.git] / server / typings / models / video / video-import.ts
1 import { VideoImportModel } from '@server/models/video/video-import'
2 import { PickWith, PickWithOpt } from '@server/typings/utils'
3 import { MUser, MVideo, MVideoAccountLight, MVideoFormattable, MVideoTag, MVideoThumbnail, MVideoWithFile } from '@server/typings/models'
4
5 type Use<K extends keyof VideoImportModel, M> = PickWith<VideoImportModel, K, M>
6
7 // ############################################################################
8
9 export type MVideoImport = Omit<VideoImportModel, 'User' | 'Video'>
10
11 export type MVideoImportVideo = MVideoImport &
12   Use<'Video', MVideo>
13
14 // ############################################################################
15
16 type VideoAssociation = MVideoTag & MVideoAccountLight & MVideoThumbnail
17
18 export type MVideoImportDefault = MVideoImport &
19   Use<'User', MUser> &
20   Use<'Video', VideoAssociation>
21
22 export type MVideoImportDefaultFiles = MVideoImport &
23   Use<'User', MUser> &
24   Use<'Video', VideoAssociation & MVideoWithFile>
25
26 // ############################################################################
27
28 // Format for API or AP object
29
30 export type MVideoImportFormattable = MVideoImport &
31   PickWithOpt<VideoImportModel, 'Video', MVideoFormattable & MVideoTag>