]>
Commit | Line | Data |
---|---|---|
1d43c3a6 C |
1 | |
2 | /** | |
3 | * | |
17bb4538 | 4 | * Class to build video attributes/join names we want to fetch from the database |
1d43c3a6 C |
5 | * |
6 | */ | |
17bb4538 | 7 | export class VideoTables { |
d9bf974f C |
8 | |
9 | constructor (readonly mode: 'get' | 'list') { | |
10 | ||
11 | } | |
12 | ||
71d4af1e C |
13 | getChannelAttributesForUser () { |
14 | return [ 'id', 'accountId' ] | |
15 | } | |
16 | ||
d9bf974f C |
17 | getChannelAttributes () { |
18 | let attributeKeys = [ | |
19 | 'id', | |
20 | 'name', | |
21 | 'description', | |
22 | 'actorId' | |
23 | ] | |
24 | ||
25 | if (this.mode === 'get') { | |
26 | attributeKeys = attributeKeys.concat([ | |
27 | 'support', | |
28 | 'createdAt', | |
29 | 'updatedAt' | |
30 | ]) | |
31 | } | |
32 | ||
33 | return attributeKeys | |
34 | } | |
35 | ||
71d4af1e C |
36 | getUserAccountAttributes () { |
37 | return [ 'id', 'userId' ] | |
38 | } | |
39 | ||
d9bf974f C |
40 | getAccountAttributes () { |
41 | let attributeKeys = [ 'id', 'name', 'actorId' ] | |
42 | ||
43 | if (this.mode === 'get') { | |
44 | attributeKeys = attributeKeys.concat([ | |
45 | 'description', | |
b8afe6f0 | 46 | 'userId', |
d9bf974f C |
47 | 'createdAt', |
48 | 'updatedAt' | |
49 | ]) | |
50 | } | |
51 | ||
52 | return attributeKeys | |
53 | } | |
54 | ||
55 | getThumbnailAttributes () { | |
56 | let attributeKeys = [ 'id', 'type', 'filename' ] | |
57 | ||
58 | if (this.mode === 'get') { | |
59 | attributeKeys = attributeKeys.concat([ | |
60 | 'height', | |
61 | 'width', | |
62 | 'fileUrl', | |
63 | 'automaticallyGenerated', | |
64 | 'videoId', | |
65 | 'videoPlaylistId', | |
66 | 'createdAt', | |
67 | 'updatedAt' | |
68 | ]) | |
69 | } | |
70 | ||
71 | return attributeKeys | |
72 | } | |
73 | ||
74 | getFileAttributes () { | |
75 | return [ | |
76 | 'id', | |
77 | 'createdAt', | |
78 | 'updatedAt', | |
79 | 'resolution', | |
80 | 'size', | |
81 | 'extname', | |
82 | 'filename', | |
83 | 'fileUrl', | |
84 | 'torrentFilename', | |
85 | 'torrentUrl', | |
86 | 'infoHash', | |
87 | 'fps', | |
88 | 'metadataUrl', | |
89 | 'videoStreamingPlaylistId', | |
90 | 'videoId' | |
91 | ] | |
92 | } | |
93 | ||
94 | getStreamingPlaylistAttributes () { | |
764b1a14 | 95 | let playlistKeys = [ 'id', 'playlistUrl', 'playlistFilename', 'type' ] |
d9bf974f C |
96 | |
97 | if (this.mode === 'get') { | |
98 | playlistKeys = playlistKeys.concat([ | |
99 | 'p2pMediaLoaderInfohashes', | |
100 | 'p2pMediaLoaderPeerVersion', | |
764b1a14 | 101 | 'segmentsSha256Filename', |
d9bf974f C |
102 | 'segmentsSha256Url', |
103 | 'videoId', | |
104 | 'createdAt', | |
105 | 'updatedAt' | |
106 | ]) | |
107 | } | |
108 | ||
109 | return playlistKeys | |
110 | } | |
111 | ||
112 | getUserHistoryAttributes () { | |
113 | return [ 'id', 'currentTime' ] | |
114 | } | |
115 | ||
116 | getPlaylistAttributes () { | |
117 | return [ | |
118 | 'createdAt', | |
119 | 'updatedAt', | |
120 | 'url', | |
121 | 'position', | |
122 | 'startTimestamp', | |
123 | 'stopTimestamp', | |
124 | 'videoPlaylistId' | |
125 | ] | |
126 | } | |
127 | ||
128 | getTagAttributes () { | |
129 | return [ 'id', 'name' ] | |
130 | } | |
131 | ||
132 | getVideoTagAttributes () { | |
133 | return [ 'videoId', 'tagId', 'createdAt', 'updatedAt' ] | |
134 | } | |
135 | ||
136 | getBlacklistedAttributes () { | |
137 | return [ 'id', 'reason', 'unfederated' ] | |
138 | } | |
139 | ||
140 | getScheduleUpdateAttributes () { | |
141 | return [ | |
142 | 'id', | |
143 | 'updateAt', | |
144 | 'privacy', | |
145 | 'videoId', | |
146 | 'createdAt', | |
147 | 'updatedAt' | |
148 | ] | |
149 | } | |
150 | ||
151 | getLiveAttributes () { | |
152 | return [ | |
153 | 'id', | |
154 | 'streamKey', | |
155 | 'saveReplay', | |
156 | 'permanentLive', | |
157 | 'videoId', | |
158 | 'createdAt', | |
159 | 'updatedAt' | |
160 | ] | |
161 | } | |
162 | ||
163 | getTrackerAttributes () { | |
164 | return [ 'id', 'url' ] | |
165 | } | |
166 | ||
167 | getVideoTrackerAttributes () { | |
168 | return [ | |
169 | 'videoId', | |
170 | 'trackerId', | |
171 | 'createdAt', | |
172 | 'updatedAt' | |
173 | ] | |
174 | } | |
175 | ||
176 | getRedundancyAttributes () { | |
177 | return [ 'id', 'fileUrl' ] | |
178 | } | |
179 | ||
180 | getActorAttributes () { | |
181 | let attributeKeys = [ | |
182 | 'id', | |
183 | 'preferredUsername', | |
184 | 'url', | |
185 | 'serverId', | |
186 | 'avatarId' | |
187 | ] | |
188 | ||
189 | if (this.mode === 'get') { | |
190 | attributeKeys = attributeKeys.concat([ | |
191 | 'type', | |
192 | 'followersCount', | |
193 | 'followingCount', | |
194 | 'inboxUrl', | |
195 | 'outboxUrl', | |
196 | 'sharedInboxUrl', | |
197 | 'followersUrl', | |
198 | 'followingUrl', | |
199 | 'remoteCreatedAt', | |
200 | 'createdAt', | |
201 | 'updatedAt' | |
202 | ]) | |
203 | } | |
204 | ||
205 | return attributeKeys | |
206 | } | |
207 | ||
208 | getAvatarAttributes () { | |
209 | let attributeKeys = [ | |
210 | 'id', | |
211 | 'filename', | |
17bb4538 | 212 | 'type', |
d9bf974f C |
213 | 'fileUrl', |
214 | 'onDisk', | |
215 | 'createdAt', | |
216 | 'updatedAt' | |
217 | ] | |
218 | ||
219 | if (this.mode === 'get') { | |
220 | attributeKeys = attributeKeys.concat([ | |
221 | 'height', | |
222 | 'width', | |
223 | 'type' | |
224 | ]) | |
225 | } | |
226 | ||
227 | return attributeKeys | |
228 | } | |
229 | ||
230 | getServerAttributes () { | |
231 | return [ 'id', 'host' ] | |
232 | } | |
233 | ||
234 | getVideoAttributes () { | |
235 | return [ | |
236 | 'id', | |
237 | 'uuid', | |
238 | 'name', | |
239 | 'category', | |
240 | 'licence', | |
241 | 'language', | |
242 | 'privacy', | |
243 | 'nsfw', | |
244 | 'description', | |
245 | 'support', | |
246 | 'duration', | |
247 | 'views', | |
248 | 'likes', | |
249 | 'dislikes', | |
250 | 'remote', | |
251 | 'isLive', | |
252 | 'url', | |
253 | 'commentsEnabled', | |
254 | 'downloadEnabled', | |
255 | 'waitTranscoding', | |
256 | 'state', | |
257 | 'publishedAt', | |
258 | 'originallyPublishedAt', | |
259 | 'channelId', | |
260 | 'createdAt', | |
261 | 'updatedAt' | |
262 | ] | |
263 | } | |
264 | } |