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