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