]>
Commit | Line | Data |
---|---|---|
453e83ea | 1 | import { VideoModel } from '../../../models/video/video' |
67ed6552 | 2 | import { PickWith, PickWithOpt } from '@shared/core-utils' |
1ca9f7c3 C |
3 | import { |
4 | MChannelAccountDefault, | |
5 | MChannelAccountLight, | |
6 | MChannelAccountSummaryFormattable, | |
7 | MChannelActor, | |
8 | MChannelFormattable, | |
9 | MChannelUserId | |
10 | } from './video-channels' | |
453e83ea | 11 | import { MTag } from './tag' |
ca6d3622 | 12 | import { MVideoCaptionLanguage, MVideoCaptionLanguageUrl } from './video-caption' |
b764380a C |
13 | import { |
14 | MStreamingPlaylistFiles, | |
15 | MStreamingPlaylistRedundancies, | |
16 | MStreamingPlaylistRedundanciesAll, | |
17 | MStreamingPlaylistRedundanciesOpt | |
18 | } from './video-streaming-playlist' | |
19 | import { MVideoFile, MVideoFileRedundanciesAll, MVideoFileRedundanciesOpt } from './video-file' | |
453e83ea | 20 | import { MThumbnail } from './thumbnail' |
1ca9f7c3 | 21 | import { MVideoBlacklist, MVideoBlacklistLight, MVideoBlacklistUnfederated } from './video-blacklist' |
453e83ea C |
22 | import { MScheduleVideoUpdate } from './schedule-video-update' |
23 | import { MUserVideoHistoryTime } from '../user/user-video-history' | |
af4ae64f | 24 | import { MVideoLive } from './video-live' |
453e83ea | 25 | |
0283eaac C |
26 | type Use<K extends keyof VideoModel, M> = PickWith<VideoModel, K, M> |
27 | ||
28 | // ############################################################################ | |
29 | ||
a1587156 C |
30 | export type MVideo = |
31 | Omit<VideoModel, 'VideoChannel' | 'Tags' | 'Thumbnails' | 'VideoPlaylistElements' | 'VideoAbuses' | | |
453e83ea | 32 | 'VideoFiles' | 'VideoStreamingPlaylists' | 'VideoShares' | 'AccountVideoRates' | 'VideoComments' | 'VideoViews' | 'UserVideoHistories' | |
af4ae64f | 33 | 'ScheduleVideoUpdate' | 'VideoBlacklist' | 'VideoImport' | 'VideoCaptions' | 'VideoLive'> |
453e83ea | 34 | |
0283eaac C |
35 | // ############################################################################ |
36 | ||
453e83ea C |
37 | export type MVideoId = Pick<MVideo, 'id'> |
38 | export type MVideoUrl = Pick<MVideo, 'url'> | |
39 | export type MVideoUUID = Pick<MVideo, 'uuid'> | |
40 | ||
943e5193 | 41 | export type MVideoImmutable = Pick<MVideo, 'id' | 'url' | 'uuid' | 'remote' | 'isOwned'> |
453e83ea C |
42 | export type MVideoIdUrl = MVideoId & MVideoUrl |
43 | export type MVideoFeed = Pick<MVideo, 'name' | 'uuid'> | |
44 | ||
0283eaac C |
45 | // ############################################################################ |
46 | ||
47 | // Video raw associations: schedules, video files, tags, thumbnails, captions, streaming playlists | |
48 | ||
49 | // "With" to not confuse with the VideoFile model | |
a1587156 C |
50 | export type MVideoWithFile = |
51 | MVideo & | |
d7a25329 C |
52 | Use<'VideoFiles', MVideoFile[]> & |
53 | Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> | |
453e83ea | 54 | |
a1587156 C |
55 | export type MVideoThumbnail = |
56 | MVideo & | |
0283eaac C |
57 | Use<'Thumbnails', MThumbnail[]> |
58 | ||
a1587156 C |
59 | export type MVideoIdThumbnail = |
60 | MVideoId & | |
0283eaac C |
61 | Use<'Thumbnails', MThumbnail[]> |
62 | ||
a1587156 C |
63 | export type MVideoWithFileThumbnail = |
64 | MVideo & | |
0283eaac C |
65 | Use<'VideoFiles', MVideoFile[]> & |
66 | Use<'Thumbnails', MThumbnail[]> | |
453e83ea | 67 | |
a1587156 C |
68 | export type MVideoThumbnailBlacklist = |
69 | MVideo & | |
d636ab58 C |
70 | Use<'Thumbnails', MThumbnail[]> & |
71 | Use<'VideoBlacklist', MVideoBlacklistLight> | |
72 | ||
a1587156 C |
73 | export type MVideoTag = |
74 | MVideo & | |
0283eaac | 75 | Use<'Tags', MTag[]> |
453e83ea | 76 | |
a1587156 C |
77 | export type MVideoWithSchedule = |
78 | MVideo & | |
453e83ea C |
79 | PickWithOpt<VideoModel, 'ScheduleVideoUpdate', MScheduleVideoUpdate> |
80 | ||
a1587156 C |
81 | export type MVideoWithCaptions = |
82 | MVideo & | |
0283eaac | 83 | Use<'VideoCaptions', MVideoCaptionLanguage[]> |
453e83ea | 84 | |
a1587156 C |
85 | export type MVideoWithStreamingPlaylist = |
86 | MVideo & | |
d7a25329 | 87 | Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> |
453e83ea | 88 | |
0283eaac C |
89 | // ############################################################################ |
90 | ||
91 | // Associations with not all their attributes | |
92 | ||
a1587156 C |
93 | export type MVideoUserHistory = |
94 | MVideo & | |
0283eaac | 95 | Use<'UserVideoHistories', MUserVideoHistoryTime[]> |
453e83ea | 96 | |
a1587156 C |
97 | export type MVideoWithBlacklistLight = |
98 | MVideo & | |
0283eaac | 99 | Use<'VideoBlacklist', MVideoBlacklistLight> |
453e83ea | 100 | |
a1587156 C |
101 | export type MVideoAccountLight = |
102 | MVideo & | |
0283eaac | 103 | Use<'VideoChannel', MChannelAccountLight> |
453e83ea | 104 | |
a1587156 C |
105 | export type MVideoWithRights = |
106 | MVideo & | |
0283eaac C |
107 | Use<'VideoBlacklist', MVideoBlacklistLight> & |
108 | Use<'Thumbnails', MThumbnail[]> & | |
109 | Use<'VideoChannel', MChannelUserId> | |
453e83ea | 110 | |
0283eaac | 111 | // ############################################################################ |
453e83ea | 112 | |
0283eaac | 113 | // All files with some additional associations |
453e83ea | 114 | |
a1587156 C |
115 | export type MVideoWithAllFiles = |
116 | MVideo & | |
0283eaac C |
117 | Use<'VideoFiles', MVideoFile[]> & |
118 | Use<'Thumbnails', MThumbnail[]> & | |
d7a25329 | 119 | Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> |
453e83ea | 120 | |
a1587156 C |
121 | export type MVideoAccountLightBlacklistAllFiles = |
122 | MVideo & | |
0283eaac C |
123 | Use<'VideoFiles', MVideoFile[]> & |
124 | Use<'Thumbnails', MThumbnail[]> & | |
d7a25329 | 125 | Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> & |
0283eaac C |
126 | Use<'VideoChannel', MChannelAccountLight> & |
127 | Use<'VideoBlacklist', MVideoBlacklistLight> | |
453e83ea | 128 | |
0283eaac C |
129 | // ############################################################################ |
130 | ||
131 | // With account | |
453e83ea | 132 | |
a1587156 C |
133 | export type MVideoAccountDefault = |
134 | MVideo & | |
0283eaac | 135 | Use<'VideoChannel', MChannelAccountDefault> |
453e83ea | 136 | |
a1587156 C |
137 | export type MVideoThumbnailAccountDefault = |
138 | MVideo & | |
0283eaac C |
139 | Use<'Thumbnails', MThumbnail[]> & |
140 | Use<'VideoChannel', MChannelAccountDefault> | |
453e83ea | 141 | |
a1587156 C |
142 | export type MVideoWithChannelActor = |
143 | MVideo & | |
0283eaac C |
144 | Use<'VideoChannel', MChannelActor> |
145 | ||
a1587156 C |
146 | export type MVideoFullLight = |
147 | MVideo & | |
0283eaac C |
148 | Use<'Thumbnails', MThumbnail[]> & |
149 | Use<'VideoBlacklist', MVideoBlacklistLight> & | |
150 | Use<'Tags', MTag[]> & | |
151 | Use<'VideoChannel', MChannelAccountLight> & | |
152 | Use<'UserVideoHistories', MUserVideoHistoryTime[]> & | |
153 | Use<'VideoFiles', MVideoFile[]> & | |
154 | Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> & | |
af4ae64f C |
155 | Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> & |
156 | Use<'VideoLive', MVideoLive> | |
0283eaac C |
157 | |
158 | // ############################################################################ | |
159 | ||
160 | // API | |
453e83ea | 161 | |
a1587156 C |
162 | export type MVideoAP = |
163 | MVideo & | |
0283eaac C |
164 | Use<'Tags', MTag[]> & |
165 | Use<'VideoChannel', MChannelAccountLight> & | |
d7a25329 | 166 | Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> & |
ca6d3622 | 167 | Use<'VideoCaptions', MVideoCaptionLanguageUrl[]> & |
0283eaac | 168 | Use<'VideoBlacklist', MVideoBlacklistUnfederated> & |
d7a25329 | 169 | Use<'VideoFiles', MVideoFileRedundanciesOpt[]> & |
af4ae64f C |
170 | Use<'Thumbnails', MThumbnail[]> & |
171 | Use<'VideoLive', MVideoLive> | |
453e83ea C |
172 | |
173 | export type MVideoAPWithoutCaption = Omit<MVideoAP, 'VideoCaptions'> | |
174 | ||
a1587156 C |
175 | export type MVideoDetails = |
176 | MVideo & | |
0283eaac C |
177 | Use<'VideoBlacklist', MVideoBlacklistLight> & |
178 | Use<'Tags', MTag[]> & | |
179 | Use<'VideoChannel', MChannelAccountLight> & | |
180 | Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> & | |
181 | Use<'Thumbnails', MThumbnail[]> & | |
182 | Use<'UserVideoHistories', MUserVideoHistoryTime[]> & | |
183 | Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundancies[]> & | |
184 | Use<'VideoFiles', MVideoFileRedundanciesOpt[]> | |
185 | ||
a1587156 C |
186 | export type MVideoForUser = |
187 | MVideo & | |
0283eaac C |
188 | Use<'VideoChannel', MChannelAccountDefault> & |
189 | Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> & | |
190 | Use<'VideoBlacklist', MVideoBlacklistLight> & | |
191 | Use<'Thumbnails', MThumbnail[]> | |
1ca9f7c3 | 192 | |
a1587156 C |
193 | export type MVideoForRedundancyAPI = |
194 | MVideo & | |
b764380a C |
195 | Use<'VideoFiles', MVideoFileRedundanciesAll[]> & |
196 | Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesAll[]> | |
197 | ||
1ca9f7c3 C |
198 | // ############################################################################ |
199 | ||
200 | // Format for API or AP object | |
201 | ||
a1587156 C |
202 | export type MVideoFormattable = |
203 | MVideo & | |
1ca9f7c3 C |
204 | PickWithOpt<VideoModel, 'UserVideoHistories', MUserVideoHistoryTime[]> & |
205 | Use<'VideoChannel', MChannelAccountSummaryFormattable> & | |
206 | PickWithOpt<VideoModel, 'ScheduleVideoUpdate', Pick<MScheduleVideoUpdate, 'updateAt' | 'privacy'>> & | |
207 | PickWithOpt<VideoModel, 'VideoBlacklist', Pick<MVideoBlacklist, 'reason'>> | |
208 | ||
a1587156 C |
209 | export type MVideoFormattableDetails = |
210 | MVideoFormattable & | |
1ca9f7c3 C |
211 | Use<'VideoChannel', MChannelFormattable> & |
212 | Use<'Tags', MTag[]> & | |
b5fecbf4 | 213 | Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesOpt[]> & |
1ca9f7c3 | 214 | Use<'VideoFiles', MVideoFileRedundanciesOpt[]> |