diff options
Diffstat (limited to 'server/typings/models/video/video-redundancy.ts')
-rw-r--r-- | server/typings/models/video/video-redundancy.ts | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/server/typings/models/video/video-redundancy.ts b/server/typings/models/video/video-redundancy.ts new file mode 100644 index 000000000..f3846afd7 --- /dev/null +++ b/server/typings/models/video/video-redundancy.ts | |||
@@ -0,0 +1,38 @@ | |||
1 | import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy' | ||
2 | import { PickWith, PickWithOpt } from '@server/typings/utils' | ||
3 | import { MStreamingPlaylistVideo, MVideoFile, MVideoFileVideo, MVideoUrl } from '@server/typings/models' | ||
4 | import { VideoStreamingPlaylist } from '../../../../shared/models/videos/video-streaming-playlist.model' | ||
5 | import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist' | ||
6 | import { VideoFile } from '../../../../shared/models/videos' | ||
7 | import { VideoFileModel } from '@server/models/video/video-file' | ||
8 | |||
9 | type Use<K extends keyof VideoRedundancyModel, M> = PickWith<VideoRedundancyModel, K, M> | ||
10 | |||
11 | // ############################################################################ | ||
12 | |||
13 | export type MVideoRedundancy = Omit<VideoRedundancyModel, 'VideoFile' | 'VideoStreamingPlaylist' | 'Actor'> | ||
14 | |||
15 | export type MVideoRedundancyFileUrl = Pick<MVideoRedundancy, 'fileUrl'> | ||
16 | |||
17 | // ############################################################################ | ||
18 | |||
19 | export type MVideoRedundancyFile = MVideoRedundancy & | ||
20 | Use<'VideoFile', MVideoFile> | ||
21 | |||
22 | export type MVideoRedundancyFileVideo = MVideoRedundancy & | ||
23 | Use<'VideoFile', MVideoFileVideo> | ||
24 | |||
25 | export type MVideoRedundancyStreamingPlaylistVideo = MVideoRedundancy & | ||
26 | Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo> | ||
27 | |||
28 | export type MVideoRedundancyVideo = MVideoRedundancy & | ||
29 | Use<'VideoFile', MVideoFileVideo> & | ||
30 | Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo> | ||
31 | |||
32 | // ############################################################################ | ||
33 | |||
34 | // Format for API or AP object | ||
35 | |||
36 | export type MVideoRedundancyAP = MVideoRedundancy & | ||
37 | PickWithOpt<VideoRedundancyModel, 'VideoFile', MVideoFile & PickWith<VideoFileModel, 'Video', MVideoUrl>> & | ||
38 | PickWithOpt<VideoRedundancyModel, 'VideoStreamingPlaylist', PickWith<VideoStreamingPlaylistModel, 'Video', MVideoUrl>> | ||