]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/types/models/video/video-redundancy.ts
Merge branch 'master' into release/3.3.0
[github/Chocobozzz/PeerTube.git] / server / types / models / video / video-redundancy.ts
1 import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy'
2 import { PickWith, PickWithOpt } from '@shared/core-utils'
3 import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist'
4 import { VideoFileModel } from '@server/models/video/video-file'
5 import { MVideoFile, MVideoFileVideo } from './video-file'
6 import { MStreamingPlaylistVideo } from './video-streaming-playlist'
7 import { MVideoUrl } from './video'
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 =
20 MVideoRedundancy &
21 Use<'VideoFile', MVideoFile>
22
23 export type MVideoRedundancyFileVideo =
24 MVideoRedundancy &
25 Use<'VideoFile', MVideoFileVideo>
26
27 export type MVideoRedundancyStreamingPlaylistVideo =
28 MVideoRedundancy &
29 Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo>
30
31 export type MVideoRedundancyVideo =
32 MVideoRedundancy &
33 Use<'VideoFile', MVideoFileVideo> &
34 Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo>
35
36 // ############################################################################
37
38 // Format for API or AP object
39
40 export type MVideoRedundancyAP =
41 MVideoRedundancy &
42 PickWithOpt<VideoRedundancyModel, 'VideoFile', MVideoFile & PickWith<VideoFileModel, 'Video', MVideoUrl>> &
43 PickWithOpt<VideoRedundancyModel, 'VideoStreamingPlaylist', PickWith<VideoStreamingPlaylistModel, 'Video', MVideoUrl>>