diff options
author | Chocobozzz <me@florianbigard.com> | 2020-06-18 10:45:25 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-06-18 10:46:27 +0200 |
commit | 26d6bf6533023326fa017812cf31bbe20c752d36 (patch) | |
tree | 9c4e3ecdc344420190f17d429bdf05d78fae7a8c /server/types/models/video/video-redundancy.ts | |
parent | d6d951ddc0c492f3261065b5dcb4df0534d252fc (diff) | |
download | PeerTube-26d6bf6533023326fa017812cf31bbe20c752d36.tar.gz PeerTube-26d6bf6533023326fa017812cf31bbe20c752d36.tar.zst PeerTube-26d6bf6533023326fa017812cf31bbe20c752d36.zip |
Split types and typings
Diffstat (limited to 'server/types/models/video/video-redundancy.ts')
-rw-r--r-- | server/types/models/video/video-redundancy.ts | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/server/types/models/video/video-redundancy.ts b/server/types/models/video/video-redundancy.ts new file mode 100644 index 000000000..7c7d52035 --- /dev/null +++ b/server/types/models/video/video-redundancy.ts | |||
@@ -0,0 +1,43 @@ | |||
1 | import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy' | ||
2 | import { PickWith, PickWithOpt } from '@server/types/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>> | ||