diff options
author | Chocobozzz <me@florianbigard.com> | 2019-08-20 13:52:49 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-08-20 14:53:42 +0200 |
commit | 0283eaac2a8e73006c66df3cf5bb9012e37450e5 (patch) | |
tree | 1fb73aeef57f984a77f47828ade23c6365ce8eb0 | |
parent | 96ca24f00e5ae5471dee9ee596489fe50af2b46f (diff) | |
download | PeerTube-0283eaac2a8e73006c66df3cf5bb9012e37450e5.tar.gz PeerTube-0283eaac2a8e73006c66df3cf5bb9012e37450e5.tar.zst PeerTube-0283eaac2a8e73006c66df3cf5bb9012e37450e5.zip |
Cleanup model types
50 files changed, 668 insertions, 321 deletions
diff --git a/server/controllers/api/search.ts b/server/controllers/api/search.ts index 7fef7c173..349650aca 100644 --- a/server/controllers/api/search.ts +++ b/server/controllers/api/search.ts | |||
@@ -19,7 +19,7 @@ import { getOrCreateActorAndServerAndModel, getOrCreateVideoAndAccountAndChannel | |||
19 | import { logger } from '../../helpers/logger' | 19 | import { logger } from '../../helpers/logger' |
20 | import { VideoChannelModel } from '../../models/video/video-channel' | 20 | import { VideoChannelModel } from '../../models/video/video-channel' |
21 | import { loadActorUrlOrGetFromWebfinger } from '../../helpers/webfinger' | 21 | import { loadActorUrlOrGetFromWebfinger } from '../../helpers/webfinger' |
22 | import { MChannelAccountDefault, MVideoAccountAllFiles } from '../../typings/models' | 22 | import { MChannelAccountDefault, MVideoAccountLightBlacklistAllFiles } from '../../typings/models' |
23 | 23 | ||
24 | const searchRouter = express.Router() | 24 | const searchRouter = express.Router() |
25 | 25 | ||
@@ -138,7 +138,7 @@ async function searchVideosDB (query: VideosSearchQuery, res: express.Response) | |||
138 | } | 138 | } |
139 | 139 | ||
140 | async function searchVideoURI (url: string, res: express.Response) { | 140 | async function searchVideoURI (url: string, res: express.Response) { |
141 | let video: MVideoAccountAllFiles | 141 | let video: MVideoAccountLightBlacklistAllFiles |
142 | 142 | ||
143 | // Check if we can fetch a remote video with the URL | 143 | // Check if we can fetch a remote video with the URL |
144 | if (isUserAbleToSearchRemoteURI(res)) { | 144 | if (isUserAbleToSearchRemoteURI(res)) { |
diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts index a058b37ef..e7adcc35a 100644 --- a/server/controllers/api/videos/import.ts +++ b/server/controllers/api/videos/import.ts | |||
@@ -25,7 +25,7 @@ import { sequelizeTypescript } from '../../../initializers/database' | |||
25 | import { createVideoMiniatureFromExisting } from '../../../lib/thumbnail' | 25 | import { createVideoMiniatureFromExisting } from '../../../lib/thumbnail' |
26 | import { ThumbnailType } from '../../../../shared/models/videos/thumbnail.type' | 26 | import { ThumbnailType } from '../../../../shared/models/videos/thumbnail.type' |
27 | import { | 27 | import { |
28 | MChannelActorAccountDefault, | 28 | MChannelAccountDefault, |
29 | MThumbnail, | 29 | MThumbnail, |
30 | MUser, | 30 | MUser, |
31 | MVideoTag, | 31 | MVideoTag, |
@@ -234,7 +234,7 @@ function insertIntoDB (parameters: { | |||
234 | video: MVideoThumbnailAccountDefault, | 234 | video: MVideoThumbnailAccountDefault, |
235 | thumbnailModel: MThumbnail, | 235 | thumbnailModel: MThumbnail, |
236 | previewModel: MThumbnail, | 236 | previewModel: MThumbnail, |
237 | videoChannel: MChannelActorAccountDefault, | 237 | videoChannel: MChannelAccountDefault, |
238 | tags: string[], | 238 | tags: string[], |
239 | videoImportAttributes: Partial<MVideoImport>, | 239 | videoImportAttributes: Partial<MVideoImport>, |
240 | user: MUser | 240 | user: MUser |
diff --git a/server/helpers/middlewares/video-channels.ts b/server/helpers/middlewares/video-channels.ts index 17b7692c5..1595ecd94 100644 --- a/server/helpers/middlewares/video-channels.ts +++ b/server/helpers/middlewares/video-channels.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { VideoChannelModel } from '../../models/video/video-channel' | 2 | import { VideoChannelModel } from '../../models/video/video-channel' |
3 | import { MChannelActorAccountDefault } from '../../typings/models' | 3 | import { MChannelAccountDefault } from '@server/typings/models' |
4 | 4 | ||
5 | async function doesLocalVideoChannelNameExist (name: string, res: express.Response) { | 5 | async function doesLocalVideoChannelNameExist (name: string, res: express.Response) { |
6 | const videoChannel = await VideoChannelModel.loadLocalByNameAndPopulateAccount(name) | 6 | const videoChannel = await VideoChannelModel.loadLocalByNameAndPopulateAccount(name) |
@@ -28,7 +28,7 @@ export { | |||
28 | doesVideoChannelNameWithHostExist | 28 | doesVideoChannelNameWithHostExist |
29 | } | 29 | } |
30 | 30 | ||
31 | function processVideoChannelExist (videoChannel: MChannelActorAccountDefault, res: express.Response) { | 31 | function processVideoChannelExist (videoChannel: MChannelAccountDefault, res: express.Response) { |
32 | if (!videoChannel) { | 32 | if (!videoChannel) { |
33 | res.status(404) | 33 | res.status(404) |
34 | .json({ error: 'Video channel not found' }) | 34 | .json({ error: 'Video channel not found' }) |
diff --git a/server/helpers/middlewares/videos.ts b/server/helpers/middlewares/videos.ts index 964f0c91a..74f529804 100644 --- a/server/helpers/middlewares/videos.ts +++ b/server/helpers/middlewares/videos.ts | |||
@@ -2,7 +2,7 @@ import { Response } from 'express' | |||
2 | import { fetchVideo, VideoFetchType } from '../video' | 2 | import { fetchVideo, VideoFetchType } from '../video' |
3 | import { UserRight } from '../../../shared/models/users' | 3 | import { UserRight } from '../../../shared/models/users' |
4 | import { VideoChannelModel } from '../../models/video/video-channel' | 4 | import { VideoChannelModel } from '../../models/video/video-channel' |
5 | import { MUser, MUserAccountId, MVideoAccountLight, MVideoFullLight, MVideoWithRights } from '@server/typings/models' | 5 | import { MUser, MUserAccountId, MVideoAccountLight, MVideoFullLight, MVideoThumbnail, MVideoWithRights } from '@server/typings/models' |
6 | 6 | ||
7 | async function doesVideoExist (id: number | string, res: Response, fetchType: VideoFetchType = 'all') { | 7 | async function doesVideoExist (id: number | string, res: Response, fetchType: VideoFetchType = 'all') { |
8 | const userId = res.locals.oauth ? res.locals.oauth.token.User.id : undefined | 8 | const userId = res.locals.oauth ? res.locals.oauth.token.User.id : undefined |
@@ -27,7 +27,7 @@ async function doesVideoExist (id: number | string, res: Response, fetchType: Vi | |||
27 | break | 27 | break |
28 | 28 | ||
29 | case 'only-video': | 29 | case 'only-video': |
30 | res.locals.onlyVideo = video | 30 | res.locals.onlyVideo = video as MVideoThumbnail |
31 | break | 31 | break |
32 | 32 | ||
33 | case 'only-video-with-rights': | 33 | case 'only-video-with-rights': |
diff --git a/server/helpers/video.ts b/server/helpers/video.ts index 26a72ac5c..d066e2b1f 100644 --- a/server/helpers/video.ts +++ b/server/helpers/video.ts | |||
@@ -1,6 +1,12 @@ | |||
1 | import { VideoModel } from '../models/video/video' | 1 | import { VideoModel } from '../models/video/video' |
2 | import * as Bluebird from 'bluebird' | 2 | import * as Bluebird from 'bluebird' |
3 | import { MVideoAccountAllFiles, MVideoFullLight, MVideoThumbnail, MVideoWithRights, MVideoIdThumbnail } from '@server/typings/models' | 3 | import { |
4 | MVideoAccountLightBlacklistAllFiles, | ||
5 | MVideoFullLight, | ||
6 | MVideoIdThumbnail, | ||
7 | MVideoThumbnail, | ||
8 | MVideoWithRights | ||
9 | } from '@server/typings/models' | ||
4 | import { Response } from 'express' | 10 | import { Response } from 'express' |
5 | 11 | ||
6 | type VideoFetchType = 'all' | 'only-video' | 'only-video-with-rights' | 'id' | 'none' | 12 | type VideoFetchType = 'all' | 'only-video' | 'only-video-with-rights' | 'id' | 'none' |
@@ -30,10 +36,10 @@ function fetchVideo ( | |||
30 | 36 | ||
31 | type VideoFetchByUrlType = 'all' | 'only-video' | 37 | type VideoFetchByUrlType = 'all' | 'only-video' |
32 | 38 | ||
33 | function fetchVideoByUrl (url: string, fetchType: 'all'): Bluebird<MVideoAccountAllFiles> | 39 | function fetchVideoByUrl (url: string, fetchType: 'all'): Bluebird<MVideoAccountLightBlacklistAllFiles> |
34 | function fetchVideoByUrl (url: string, fetchType: 'only-video'): Bluebird<MVideoThumbnail> | 40 | function fetchVideoByUrl (url: string, fetchType: 'only-video'): Bluebird<MVideoThumbnail> |
35 | function fetchVideoByUrl (url: string, fetchType: VideoFetchByUrlType): Bluebird<MVideoAccountAllFiles> | Bluebird<MVideoThumbnail> | 41 | function fetchVideoByUrl (url: string, fetchType: VideoFetchByUrlType): Bluebird<MVideoAccountLightBlacklistAllFiles | MVideoThumbnail> |
36 | function fetchVideoByUrl (url: string, fetchType: VideoFetchByUrlType): Bluebird<MVideoAccountAllFiles> | Bluebird<MVideoThumbnail> { | 42 | function fetchVideoByUrl (url: string, fetchType: VideoFetchByUrlType): Bluebird<MVideoAccountLightBlacklistAllFiles | MVideoThumbnail> { |
37 | if (fetchType === 'all') return VideoModel.loadByUrlAndPopulateAccount(url) | 43 | if (fetchType === 'all') return VideoModel.loadByUrlAndPopulateAccount(url) |
38 | 44 | ||
39 | if (fetchType === 'only-video') return VideoModel.loadByUrl(url) | 45 | if (fetchType === 'only-video') return VideoModel.loadByUrl(url) |
@@ -43,10 +49,15 @@ function getVideo (res: Response) { | |||
43 | return res.locals.videoAll || res.locals.onlyVideo || res.locals.onlyVideoWithRights || res.locals.videoId | 49 | return res.locals.videoAll || res.locals.onlyVideo || res.locals.onlyVideoWithRights || res.locals.videoId |
44 | } | 50 | } |
45 | 51 | ||
52 | function getVideoWithAttributes (res: Response) { | ||
53 | return res.locals.videoAll || res.locals.onlyVideo || res.locals.onlyVideoWithRights | ||
54 | } | ||
55 | |||
46 | export { | 56 | export { |
47 | VideoFetchType, | 57 | VideoFetchType, |
48 | VideoFetchByUrlType, | 58 | VideoFetchByUrlType, |
49 | fetchVideo, | 59 | fetchVideo, |
50 | getVideo, | 60 | getVideo, |
61 | getVideoWithAttributes, | ||
51 | fetchVideoByUrl | 62 | fetchVideoByUrl |
52 | } | 63 | } |
diff --git a/server/lib/activitypub/actor.ts b/server/lib/activitypub/actor.ts index 7862b0f00..5201bdeef 100644 --- a/server/lib/activitypub/actor.ts +++ b/server/lib/activitypub/actor.ts | |||
@@ -24,15 +24,17 @@ import { ActorFetchByUrlType, fetchActorByUrl } from '../../helpers/actor' | |||
24 | import { sequelizeTypescript } from '../../initializers/database' | 24 | import { sequelizeTypescript } from '../../initializers/database' |
25 | import { | 25 | import { |
26 | MAccount, | 26 | MAccount, |
27 | MAccountDefault, | ||
27 | MActor, | 28 | MActor, |
28 | MActorAccountChannelId, | 29 | MActorAccountChannelId, |
30 | MActorAccountChannelIdActor, | ||
29 | MActorAccountId, | 31 | MActorAccountId, |
30 | MActorDefault, | 32 | MActorDefault, |
31 | MActorFull, | 33 | MActorFull, |
34 | MActorFullActor, | ||
32 | MActorId, | 35 | MActorId, |
33 | MActorAccountChannelIdActor, | ||
34 | MChannel, | 36 | MChannel, |
35 | MActorFullActor, MAccountActorDefault, MChannelActorDefault, MChannelActorAccountDefault | 37 | MChannelAccountDefault |
36 | } from '../../typings/models' | 38 | } from '../../typings/models' |
37 | 39 | ||
38 | // Set account keys, this could be long so process after the account creation and do not block the client | 40 | // Set account keys, this could be long so process after the account creation and do not block the client |
@@ -374,12 +376,11 @@ function saveActorAndServerAndModelIfNotExist ( | |||
374 | }) | 376 | }) |
375 | 377 | ||
376 | if (actorCreated.type === 'Person' || actorCreated.type === 'Application') { | 378 | if (actorCreated.type === 'Person' || actorCreated.type === 'Application') { |
377 | actorCreated.Account = await saveAccount(actorCreated, result, t) as MAccountActorDefault | 379 | actorCreated.Account = await saveAccount(actorCreated, result, t) as MAccountDefault |
378 | actorCreated.Account.Actor = actorCreated | 380 | actorCreated.Account.Actor = actorCreated |
379 | } else if (actorCreated.type === 'Group') { // Video channel | 381 | } else if (actorCreated.type === 'Group') { // Video channel |
380 | actorCreated.VideoChannel = await saveVideoChannel(actorCreated, result, ownerActor, t) as MChannelActorAccountDefault | 382 | const channel = await saveVideoChannel(actorCreated, result, ownerActor, t) |
381 | actorCreated.VideoChannel.Actor = actorCreated | 383 | actorCreated.VideoChannel = Object.assign(channel, { Actor: actorCreated, Account: ownerActor.Account }) |
382 | actorCreated.VideoChannel.Account = ownerActor.Account | ||
383 | } | 384 | } |
384 | 385 | ||
385 | actorCreated.Server = server | 386 | actorCreated.Server = server |
diff --git a/server/lib/activitypub/process/process-announce.ts b/server/lib/activitypub/process/process-announce.ts index 91a9ad72c..7e22125d5 100644 --- a/server/lib/activitypub/process/process-announce.ts +++ b/server/lib/activitypub/process/process-announce.ts | |||
@@ -7,7 +7,7 @@ import { getOrCreateVideoAndAccountAndChannel } from '../videos' | |||
7 | import { Notifier } from '../../notifier' | 7 | import { Notifier } from '../../notifier' |
8 | import { logger } from '../../../helpers/logger' | 8 | import { logger } from '../../../helpers/logger' |
9 | import { APProcessorOptions } from '../../../typings/activitypub-processor.model' | 9 | import { APProcessorOptions } from '../../../typings/activitypub-processor.model' |
10 | import { MActorSignature, MVideoAccountAllFiles } from '../../../typings/models' | 10 | import { MActorSignature, MVideoAccountLightBlacklistAllFiles } from '../../../typings/models' |
11 | 11 | ||
12 | async function processAnnounceActivity (options: APProcessorOptions<ActivityAnnounce>) { | 12 | async function processAnnounceActivity (options: APProcessorOptions<ActivityAnnounce>) { |
13 | const { activity, byActor: actorAnnouncer } = options | 13 | const { activity, byActor: actorAnnouncer } = options |
@@ -28,7 +28,7 @@ export { | |||
28 | async function processVideoShare (actorAnnouncer: MActorSignature, activity: ActivityAnnounce, notify: boolean) { | 28 | async function processVideoShare (actorAnnouncer: MActorSignature, activity: ActivityAnnounce, notify: boolean) { |
29 | const objectUri = typeof activity.object === 'string' ? activity.object : activity.object.id | 29 | const objectUri = typeof activity.object === 'string' ? activity.object : activity.object.id |
30 | 30 | ||
31 | let video: MVideoAccountAllFiles | 31 | let video: MVideoAccountLightBlacklistAllFiles |
32 | let videoCreated: boolean | 32 | let videoCreated: boolean |
33 | 33 | ||
34 | try { | 34 | try { |
diff --git a/server/lib/activitypub/process/process-create.ts b/server/lib/activitypub/process/process-create.ts index c45f09f52..bee853721 100644 --- a/server/lib/activitypub/process/process-create.ts +++ b/server/lib/activitypub/process/process-create.ts | |||
@@ -11,7 +11,7 @@ import { Notifier } from '../../notifier' | |||
11 | import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object' | 11 | import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object' |
12 | import { createOrUpdateVideoPlaylist } from '../playlist' | 12 | import { createOrUpdateVideoPlaylist } from '../playlist' |
13 | import { APProcessorOptions } from '../../../typings/activitypub-processor.model' | 13 | import { APProcessorOptions } from '../../../typings/activitypub-processor.model' |
14 | import { MActorSignature, MCommentOwnerVideo, MVideoAccountAllFiles } from '../../../typings/models' | 14 | import { MActorSignature, MCommentOwnerVideo, MVideoAccountLightBlacklistAllFiles } from '../../../typings/models' |
15 | 15 | ||
16 | async function processCreateActivity (options: APProcessorOptions<ActivityCreate>) { | 16 | async function processCreateActivity (options: APProcessorOptions<ActivityCreate>) { |
17 | const { activity, byActor } = options | 17 | const { activity, byActor } = options |
@@ -81,7 +81,7 @@ async function processCreateVideoComment (activity: ActivityCreate, byActor: MAc | |||
81 | 81 | ||
82 | if (!byAccount) throw new Error('Cannot create video comment with the non account actor ' + byActor.url) | 82 | if (!byAccount) throw new Error('Cannot create video comment with the non account actor ' + byActor.url) |
83 | 83 | ||
84 | let video: MVideoAccountAllFiles | 84 | let video: MVideoAccountLightBlacklistAllFiles |
85 | let created: boolean | 85 | let created: boolean |
86 | let comment: MCommentOwnerVideo | 86 | let comment: MCommentOwnerVideo |
87 | try { | 87 | try { |
diff --git a/server/lib/activitypub/video-comments.ts b/server/lib/activitypub/video-comments.ts index 375ac0aad..3e8306fa4 100644 --- a/server/lib/activitypub/video-comments.ts +++ b/server/lib/activitypub/video-comments.ts | |||
@@ -7,7 +7,7 @@ import { getOrCreateActorAndServerAndModel } from './actor' | |||
7 | import { getOrCreateVideoAndAccountAndChannel } from './videos' | 7 | import { getOrCreateVideoAndAccountAndChannel } from './videos' |
8 | import * as Bluebird from 'bluebird' | 8 | import * as Bluebird from 'bluebird' |
9 | import { checkUrlsSameHost } from '../../helpers/activitypub' | 9 | import { checkUrlsSameHost } from '../../helpers/activitypub' |
10 | import { MCommentOwner, MCommentOwnerVideo, MVideoAccountAllFiles } from '../../typings/models/video' | 10 | import { MCommentOwner, MCommentOwnerVideo, MVideoAccountLightBlacklistAllFiles } from '../../typings/models/video' |
11 | 11 | ||
12 | type ResolveThreadParams = { | 12 | type ResolveThreadParams = { |
13 | url: string, | 13 | url: string, |
@@ -15,7 +15,7 @@ type ResolveThreadParams = { | |||
15 | isVideo?: boolean, | 15 | isVideo?: boolean, |
16 | commentCreated?: boolean | 16 | commentCreated?: boolean |
17 | } | 17 | } |
18 | type ResolveThreadResult = Promise<{ video: MVideoAccountAllFiles, comment: MCommentOwnerVideo, commentCreated: boolean }> | 18 | type ResolveThreadResult = Promise<{ video: MVideoAccountLightBlacklistAllFiles, comment: MCommentOwnerVideo, commentCreated: boolean }> |
19 | 19 | ||
20 | async function addVideoComments (commentUrls: string[]) { | 20 | async function addVideoComments (commentUrls: string[]) { |
21 | return Bluebird.map(commentUrls, commentUrl => { | 21 | return Bluebird.map(commentUrls, commentUrl => { |
diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts index 035994da8..970a953fc 100644 --- a/server/lib/activitypub/videos.ts +++ b/server/lib/activitypub/videos.ts | |||
@@ -58,7 +58,7 @@ import { | |||
58 | MChannelDefault, | 58 | MChannelDefault, |
59 | MChannelId, | 59 | MChannelId, |
60 | MVideo, | 60 | MVideo, |
61 | MVideoAccountAllFiles, | 61 | MVideoAccountLightBlacklistAllFiles, |
62 | MVideoAccountLight, | 62 | MVideoAccountLight, |
63 | MVideoAP, | 63 | MVideoAP, |
64 | MVideoAPWithoutCaption, | 64 | MVideoAPWithoutCaption, |
@@ -213,19 +213,19 @@ function getOrCreateVideoAndAccountAndChannel (options: { | |||
213 | syncParam?: SyncParam, | 213 | syncParam?: SyncParam, |
214 | fetchType?: 'all', | 214 | fetchType?: 'all', |
215 | allowRefresh?: boolean | 215 | allowRefresh?: boolean |
216 | }): Promise<{ video: MVideoAccountAllFiles, created: boolean, autoBlacklisted?: boolean }> | 216 | }): Promise<{ video: MVideoAccountLightBlacklistAllFiles, created: boolean, autoBlacklisted?: boolean }> |
217 | function getOrCreateVideoAndAccountAndChannel (options: { | 217 | function getOrCreateVideoAndAccountAndChannel (options: { |
218 | videoObject: { id: string } | string, | 218 | videoObject: { id: string } | string, |
219 | syncParam?: SyncParam, | 219 | syncParam?: SyncParam, |
220 | fetchType?: VideoFetchByUrlType, | 220 | fetchType?: VideoFetchByUrlType, |
221 | allowRefresh?: boolean | 221 | allowRefresh?: boolean |
222 | }): Promise<{ video: MVideoAccountAllFiles | MVideoThumbnail, created: boolean, autoBlacklisted?: boolean }> | 222 | }): Promise<{ video: MVideoAccountLightBlacklistAllFiles | MVideoThumbnail, created: boolean, autoBlacklisted?: boolean }> |
223 | async function getOrCreateVideoAndAccountAndChannel (options: { | 223 | async function getOrCreateVideoAndAccountAndChannel (options: { |
224 | videoObject: { id: string } | string, | 224 | videoObject: { id: string } | string, |
225 | syncParam?: SyncParam, | 225 | syncParam?: SyncParam, |
226 | fetchType?: VideoFetchByUrlType, | 226 | fetchType?: VideoFetchByUrlType, |
227 | allowRefresh?: boolean // true by default | 227 | allowRefresh?: boolean // true by default |
228 | }): Promise<{ video: MVideoAccountAllFiles | MVideoThumbnail, created: boolean, autoBlacklisted?: boolean }> { | 228 | }): Promise<{ video: MVideoAccountLightBlacklistAllFiles | MVideoThumbnail, created: boolean, autoBlacklisted?: boolean }> { |
229 | // Default params | 229 | // Default params |
230 | const syncParam = options.syncParam || { likes: true, dislikes: true, shares: true, comments: true, thumbnail: true, refreshVideo: false } | 230 | const syncParam = options.syncParam || { likes: true, dislikes: true, shares: true, comments: true, thumbnail: true, refreshVideo: false } |
231 | const fetchType = options.fetchType || 'all' | 231 | const fetchType = options.fetchType || 'all' |
@@ -263,7 +263,7 @@ async function getOrCreateVideoAndAccountAndChannel (options: { | |||
263 | } | 263 | } |
264 | 264 | ||
265 | async function updateVideoFromAP (options: { | 265 | async function updateVideoFromAP (options: { |
266 | video: MVideoAccountAllFiles, | 266 | video: MVideoAccountLightBlacklistAllFiles, |
267 | videoObject: VideoTorrentObject, | 267 | videoObject: VideoTorrentObject, |
268 | account: MAccountActor, | 268 | account: MAccountActor, |
269 | channel: MChannelDefault, | 269 | channel: MChannelDefault, |
@@ -420,7 +420,7 @@ async function refreshVideoIfNeeded (options: { | |||
420 | 420 | ||
421 | // We need more attributes if the argument video was fetched with not enough joints | 421 | // We need more attributes if the argument video was fetched with not enough joints |
422 | const video = options.fetchedType === 'all' | 422 | const video = options.fetchedType === 'all' |
423 | ? options.video as MVideoAccountAllFiles | 423 | ? options.video as MVideoAccountLightBlacklistAllFiles |
424 | : await VideoModel.loadByUrlAndPopulateAccount(options.video.url) | 424 | : await VideoModel.loadByUrlAndPopulateAccount(options.video.url) |
425 | 425 | ||
426 | try { | 426 | try { |
diff --git a/server/lib/avatar.ts b/server/lib/avatar.ts index 9005b3e22..ad4cdd3ab 100644 --- a/server/lib/avatar.ts +++ b/server/lib/avatar.ts | |||
@@ -11,11 +11,11 @@ import { sequelizeTypescript } from '../initializers/database' | |||
11 | import * as LRUCache from 'lru-cache' | 11 | import * as LRUCache from 'lru-cache' |
12 | import { queue } from 'async' | 12 | import { queue } from 'async' |
13 | import { downloadImage } from '../helpers/requests' | 13 | import { downloadImage } from '../helpers/requests' |
14 | import { MAccountActorDefault, MChannelActorDefault } from '../typings/models' | 14 | import { MAccountDefault, MChannelDefault } from '../typings/models' |
15 | 15 | ||
16 | async function updateActorAvatarFile ( | 16 | async function updateActorAvatarFile ( |
17 | avatarPhysicalFile: Express.Multer.File, | 17 | avatarPhysicalFile: Express.Multer.File, |
18 | accountOrChannel: MAccountActorDefault | MChannelActorDefault | 18 | accountOrChannel: MAccountDefault | MChannelDefault |
19 | ) { | 19 | ) { |
20 | const extension = extname(avatarPhysicalFile.filename) | 20 | const extension = extname(avatarPhysicalFile.filename) |
21 | const avatarName = uuidv4() + extension | 21 | const avatarName = uuidv4() + extension |
diff --git a/server/lib/emailer.ts b/server/lib/emailer.ts index fe57a3e4c..a888b7a72 100644 --- a/server/lib/emailer.ts +++ b/server/lib/emailer.ts | |||
@@ -2,14 +2,12 @@ import { createTransport, Transporter } from 'nodemailer' | |||
2 | import { isTestInstance } from '../helpers/core-utils' | 2 | import { isTestInstance } from '../helpers/core-utils' |
3 | import { bunyanLogger, logger } from '../helpers/logger' | 3 | import { bunyanLogger, logger } from '../helpers/logger' |
4 | import { CONFIG } from '../initializers/config' | 4 | import { CONFIG } from '../initializers/config' |
5 | import { UserModel } from '../models/account/user' | ||
6 | import { JobQueue } from './job-queue' | 5 | import { JobQueue } from './job-queue' |
7 | import { EmailPayload } from './job-queue/handlers/email' | 6 | import { EmailPayload } from './job-queue/handlers/email' |
8 | import { readFileSync } from 'fs-extra' | 7 | import { readFileSync } from 'fs-extra' |
9 | import { VideoBlacklistModel } from '../models/video/video-blacklist' | ||
10 | import { WEBSERVER } from '../initializers/constants' | 8 | import { WEBSERVER } from '../initializers/constants' |
11 | import { MCommentOwnerVideo, MVideo, MVideoAbuseVideo, MVideoAccountLight, MVideoBlacklistVideo } from '../typings/models/video' | 9 | import { MCommentOwnerVideo, MVideo, MVideoAbuseVideo, MVideoAccountLight, MVideoBlacklistVideo } from '../typings/models/video' |
12 | import { MActorFollowActors, MActorFollowFull, MUser } from '../typings/models' | 10 | import { MActorFollowActors, MActorFollowFollowingFullFollowerAccount, MUser } from '../typings/models' |
13 | import { MVideoImport, MVideoImportVideo } from '@server/typings/models/video/video-import' | 11 | import { MVideoImport, MVideoImportVideo } from '@server/typings/models/video/video-import' |
14 | 12 | ||
15 | type SendEmailOptions = { | 13 | type SendEmailOptions = { |
@@ -109,7 +107,7 @@ class Emailer { | |||
109 | return JobQueue.Instance.createJob({ type: 'email', payload: emailPayload }) | 107 | return JobQueue.Instance.createJob({ type: 'email', payload: emailPayload }) |
110 | } | 108 | } |
111 | 109 | ||
112 | addNewFollowNotification (to: string[], actorFollow: MActorFollowFull, followType: 'account' | 'channel') { | 110 | addNewFollowNotification (to: string[], actorFollow: MActorFollowFollowingFullFollowerAccount, followType: 'account' | 'channel') { |
113 | const followerName = actorFollow.ActorFollower.Account.getDisplayName() | 111 | const followerName = actorFollow.ActorFollower.Account.getDisplayName() |
114 | const followingName = (actorFollow.ActorFollowing.VideoChannel || actorFollow.ActorFollowing.Account).getDisplayName() | 112 | const followingName = (actorFollow.ActorFollowing.VideoChannel || actorFollow.ActorFollowing.Account).getDisplayName() |
115 | 113 | ||
diff --git a/server/lib/job-queue/handlers/activitypub-follow.ts b/server/lib/job-queue/handlers/activitypub-follow.ts index 741b1ffde..5cb55cad6 100644 --- a/server/lib/job-queue/handlers/activitypub-follow.ts +++ b/server/lib/job-queue/handlers/activitypub-follow.ts | |||
@@ -10,7 +10,7 @@ import { ActorFollowModel } from '../../../models/activitypub/actor-follow' | |||
10 | import { ActorModel } from '../../../models/activitypub/actor' | 10 | import { ActorModel } from '../../../models/activitypub/actor' |
11 | import { Notifier } from '../../notifier' | 11 | import { Notifier } from '../../notifier' |
12 | import { sequelizeTypescript } from '../../../initializers/database' | 12 | import { sequelizeTypescript } from '../../../initializers/database' |
13 | import { MActorFollowFull, MActorFull } from '../../../typings/models' | 13 | import { MAccount, MActor, MActorFollowActors, MActorFollowFull, MActorFull } from '../../../typings/models' |
14 | 14 | ||
15 | export type ActivitypubFollowPayload = { | 15 | export type ActivitypubFollowPayload = { |
16 | followerActorId: number | 16 | followerActorId: number |
@@ -45,7 +45,7 @@ export { | |||
45 | 45 | ||
46 | // --------------------------------------------------------------------------- | 46 | // --------------------------------------------------------------------------- |
47 | 47 | ||
48 | async function follow (fromActor: MActorFull, targetActor: MActorFull) { | 48 | async function follow (fromActor: MActor, targetActor: MActorFull) { |
49 | if (fromActor.id === targetActor.id) { | 49 | if (fromActor.id === targetActor.id) { |
50 | throw new Error('Follower is the same than target actor.') | 50 | throw new Error('Follower is the same than target actor.') |
51 | } | 51 | } |
@@ -54,7 +54,7 @@ async function follow (fromActor: MActorFull, targetActor: MActorFull) { | |||
54 | const state = !fromActor.serverId && !targetActor.serverId ? 'accepted' : 'pending' | 54 | const state = !fromActor.serverId && !targetActor.serverId ? 'accepted' : 'pending' |
55 | 55 | ||
56 | const actorFollow = await sequelizeTypescript.transaction(async t => { | 56 | const actorFollow = await sequelizeTypescript.transaction(async t => { |
57 | const [ actorFollow ] = await ActorFollowModel.findOrCreate<MActorFollowFull>({ | 57 | const [ actorFollow ] = await ActorFollowModel.findOrCreate<MActorFollowActors>({ |
58 | where: { | 58 | where: { |
59 | actorId: fromActor.id, | 59 | actorId: fromActor.id, |
60 | targetActorId: targetActor.id | 60 | targetActorId: targetActor.id |
@@ -75,5 +75,14 @@ async function follow (fromActor: MActorFull, targetActor: MActorFull) { | |||
75 | return actorFollow | 75 | return actorFollow |
76 | }) | 76 | }) |
77 | 77 | ||
78 | if (actorFollow.state === 'accepted') Notifier.Instance.notifyOfNewUserFollow(actorFollow) | 78 | if (actorFollow.state === 'accepted') { |
79 | const followerFull = Object.assign(fromActor, { Account: await actorFollow.ActorFollower.$get('Account') as MAccount }) | ||
80 | |||
81 | const actorFollowFull = Object.assign(actorFollow, { | ||
82 | ActorFollowing: targetActor, | ||
83 | ActorFollower: followerFull | ||
84 | }) | ||
85 | |||
86 | Notifier.Instance.notifyOfNewUserFollow(actorFollowFull) | ||
87 | } | ||
79 | } | 88 | } |
diff --git a/server/lib/job-queue/handlers/video-import.ts b/server/lib/job-queue/handlers/video-import.ts index f9dda79f8..ff8c93328 100644 --- a/server/lib/job-queue/handlers/video-import.ts +++ b/server/lib/job-queue/handlers/video-import.ts | |||
@@ -111,13 +111,11 @@ type ProcessFileOptions = { | |||
111 | generateThumbnail: boolean | 111 | generateThumbnail: boolean |
112 | generatePreview: boolean | 112 | generatePreview: boolean |
113 | } | 113 | } |
114 | async function processFile (downloader: () => Promise<string>, videoImportArg: MVideoImportDefault, options: ProcessFileOptions) { | 114 | async function processFile (downloader: () => Promise<string>, videoImport: MVideoImportDefault, options: ProcessFileOptions) { |
115 | let tempVideoPath: string | 115 | let tempVideoPath: string |
116 | let videoDestFile: string | 116 | let videoDestFile: string |
117 | let videoFile: VideoFileModel | 117 | let videoFile: VideoFileModel |
118 | 118 | ||
119 | const videoImport = videoImportArg as MVideoImportDefaultFiles | ||
120 | |||
121 | try { | 119 | try { |
122 | // Download video from youtubeDL | 120 | // Download video from youtubeDL |
123 | tempVideoPath = await downloader() | 121 | tempVideoPath = await downloader() |
@@ -142,35 +140,37 @@ async function processFile (downloader: () => Promise<string>, videoImportArg: M | |||
142 | videoId: videoImport.videoId | 140 | videoId: videoImport.videoId |
143 | } | 141 | } |
144 | videoFile = new VideoFileModel(videoFileData) | 142 | videoFile = new VideoFileModel(videoFileData) |
143 | |||
144 | const videoWithFiles = Object.assign(videoImport.Video, { VideoFiles: [ videoFile ] }) | ||
145 | // To clean files if the import fails | 145 | // To clean files if the import fails |
146 | videoImport.Video.VideoFiles = [ videoFile ] | 146 | const videoImportWithFiles: MVideoImportDefaultFiles = Object.assign(videoImport, { Video: videoWithFiles }) |
147 | 147 | ||
148 | // Move file | 148 | // Move file |
149 | videoDestFile = join(CONFIG.STORAGE.VIDEOS_DIR, videoImport.Video.getVideoFilename(videoFile)) | 149 | videoDestFile = join(CONFIG.STORAGE.VIDEOS_DIR, videoImportWithFiles.Video.getVideoFilename(videoFile)) |
150 | await move(tempVideoPath, videoDestFile) | 150 | await move(tempVideoPath, videoDestFile) |
151 | tempVideoPath = null // This path is not used anymore | 151 | tempVideoPath = null // This path is not used anymore |
152 | 152 | ||
153 | // Process thumbnail | 153 | // Process thumbnail |
154 | let thumbnailModel: MThumbnail | 154 | let thumbnailModel: MThumbnail |
155 | if (options.downloadThumbnail && options.thumbnailUrl) { | 155 | if (options.downloadThumbnail && options.thumbnailUrl) { |
156 | thumbnailModel = await createVideoMiniatureFromUrl(options.thumbnailUrl, videoImport.Video, ThumbnailType.MINIATURE) | 156 | thumbnailModel = await createVideoMiniatureFromUrl(options.thumbnailUrl, videoImportWithFiles.Video, ThumbnailType.MINIATURE) |
157 | } else if (options.generateThumbnail || options.downloadThumbnail) { | 157 | } else if (options.generateThumbnail || options.downloadThumbnail) { |
158 | thumbnailModel = await generateVideoMiniature(videoImport.Video, videoFile, ThumbnailType.MINIATURE) | 158 | thumbnailModel = await generateVideoMiniature(videoImportWithFiles.Video, videoFile, ThumbnailType.MINIATURE) |
159 | } | 159 | } |
160 | 160 | ||
161 | // Process preview | 161 | // Process preview |
162 | let previewModel: MThumbnail | 162 | let previewModel: MThumbnail |
163 | if (options.downloadPreview && options.thumbnailUrl) { | 163 | if (options.downloadPreview && options.thumbnailUrl) { |
164 | previewModel = await createVideoMiniatureFromUrl(options.thumbnailUrl, videoImport.Video, ThumbnailType.PREVIEW) | 164 | previewModel = await createVideoMiniatureFromUrl(options.thumbnailUrl, videoImportWithFiles.Video, ThumbnailType.PREVIEW) |
165 | } else if (options.generatePreview || options.downloadPreview) { | 165 | } else if (options.generatePreview || options.downloadPreview) { |
166 | previewModel = await generateVideoMiniature(videoImport.Video, videoFile, ThumbnailType.PREVIEW) | 166 | previewModel = await generateVideoMiniature(videoImportWithFiles.Video, videoFile, ThumbnailType.PREVIEW) |
167 | } | 167 | } |
168 | 168 | ||
169 | // Create torrent | 169 | // Create torrent |
170 | await videoImport.Video.createTorrentAndSetInfoHash(videoFile) | 170 | await videoImportWithFiles.Video.createTorrentAndSetInfoHash(videoFile) |
171 | 171 | ||
172 | const { videoImportUpdated, video } = await sequelizeTypescript.transaction(async t => { | 172 | const { videoImportUpdated, video } = await sequelizeTypescript.transaction(async t => { |
173 | const videoImportToUpdate = videoImport as MVideoImportVideo | 173 | const videoImportToUpdate = videoImportWithFiles as MVideoImportVideo |
174 | 174 | ||
175 | // Refresh video | 175 | // Refresh video |
176 | const video = await VideoModel.load(videoImportToUpdate.videoId, t) | 176 | const video = await VideoModel.load(videoImportToUpdate.videoId, t) |
diff --git a/server/lib/notifier.ts b/server/lib/notifier.ts index f01101b8e..23f76a21a 100644 --- a/server/lib/notifier.ts +++ b/server/lib/notifier.ts | |||
@@ -21,7 +21,7 @@ import { | |||
21 | MVideoFullLight | 21 | MVideoFullLight |
22 | } from '../typings/models/video' | 22 | } from '../typings/models/video' |
23 | import { MUser, MUserAccount, MUserWithNotificationSetting, UserNotificationModelForApi } from '@server/typings/models/user' | 23 | import { MUser, MUserAccount, MUserWithNotificationSetting, UserNotificationModelForApi } from '@server/typings/models/user' |
24 | import { MActorFollowActors, MActorFollowFull } from '../typings/models' | 24 | import { MActorFollowActors, MActorFollowFull, MActorFollowFollowingFullFollowerAccount } from '../typings/models' |
25 | import { ActorFollowModel } from '../models/activitypub/actor-follow' | 25 | import { ActorFollowModel } from '../models/activitypub/actor-follow' |
26 | import { MVideoImportVideo } from '@server/typings/models/video/video-import' | 26 | import { MVideoImportVideo } from '@server/typings/models/video/video-import' |
27 | import { AccountModel } from '@server/models/account/account' | 27 | import { AccountModel } from '@server/models/account/account' |
@@ -102,7 +102,7 @@ class Notifier { | |||
102 | .catch(err => logger.error('Cannot notify moderators of new user registration (%s).', user.username, { err })) | 102 | .catch(err => logger.error('Cannot notify moderators of new user registration (%s).', user.username, { err })) |
103 | } | 103 | } |
104 | 104 | ||
105 | notifyOfNewUserFollow (actorFollow: MActorFollowFull): void { | 105 | notifyOfNewUserFollow (actorFollow: MActorFollowFollowingFullFollowerAccount): void { |
106 | this.notifyUserOfNewActorFollow(actorFollow) | 106 | this.notifyUserOfNewActorFollow(actorFollow) |
107 | .catch(err => { | 107 | .catch(err => { |
108 | logger.error( | 108 | logger.error( |
@@ -231,7 +231,7 @@ class Notifier { | |||
231 | return this.notify({ users, settingGetter, notificationCreator, emailSender }) | 231 | return this.notify({ users, settingGetter, notificationCreator, emailSender }) |
232 | } | 232 | } |
233 | 233 | ||
234 | private async notifyUserOfNewActorFollow (actorFollow: MActorFollowFull) { | 234 | private async notifyUserOfNewActorFollow (actorFollow: MActorFollowFollowingFullFollowerAccount) { |
235 | if (actorFollow.ActorFollowing.isOwned() === false) return | 235 | if (actorFollow.ActorFollowing.isOwned() === false) return |
236 | 236 | ||
237 | // Account follows one of our account? | 237 | // Account follows one of our account? |
diff --git a/server/lib/schedulers/videos-redundancy-scheduler.ts b/server/lib/schedulers/videos-redundancy-scheduler.ts index de8fc075b..d9018e606 100644 --- a/server/lib/schedulers/videos-redundancy-scheduler.ts +++ b/server/lib/schedulers/videos-redundancy-scheduler.ts | |||
@@ -32,7 +32,9 @@ type CandidateToDuplicate = { | |||
32 | streamingPlaylists: MStreamingPlaylist[] | 32 | streamingPlaylists: MStreamingPlaylist[] |
33 | } | 33 | } |
34 | 34 | ||
35 | function isMVideoRedundancyFileVideo (o: MVideoRedundancyVideo): o is MVideoRedundancyFileVideo { | 35 | function isMVideoRedundancyFileVideo ( |
36 | o: MVideoRedundancyFileVideo | MVideoRedundancyStreamingPlaylistVideo | ||
37 | ): o is MVideoRedundancyFileVideo { | ||
36 | return !!(o as MVideoRedundancyFileVideo).VideoFile | 38 | return !!(o as MVideoRedundancyFileVideo).VideoFile |
37 | } | 39 | } |
38 | 40 | ||
diff --git a/server/middlewares/validators/videos/video-channels.ts b/server/middlewares/validators/videos/video-channels.ts index a0df03f7e..d21274527 100644 --- a/server/middlewares/validators/videos/video-channels.ts +++ b/server/middlewares/validators/videos/video-channels.ts | |||
@@ -13,8 +13,7 @@ import { isActorPreferredUsernameValid } from '../../../helpers/custom-validator | |||
13 | import { ActorModel } from '../../../models/activitypub/actor' | 13 | import { ActorModel } from '../../../models/activitypub/actor' |
14 | import { isBooleanValid } from '../../../helpers/custom-validators/misc' | 14 | import { isBooleanValid } from '../../../helpers/custom-validators/misc' |
15 | import { doesLocalVideoChannelNameExist, doesVideoChannelNameWithHostExist } from '../../../helpers/middlewares' | 15 | import { doesLocalVideoChannelNameExist, doesVideoChannelNameWithHostExist } from '../../../helpers/middlewares' |
16 | import { MChannelActorAccountDefault } from '../../../typings/models/video' | 16 | import { MChannelAccountDefault, MUser } from '@server/typings/models' |
17 | import { MUser } from '@server/typings/models' | ||
18 | 17 | ||
19 | const videoChannelsAddValidator = [ | 18 | const videoChannelsAddValidator = [ |
20 | body('name').custom(isActorPreferredUsernameValid).withMessage('Should have a valid channel name'), | 19 | body('name').custom(isActorPreferredUsernameValid).withMessage('Should have a valid channel name'), |
@@ -132,7 +131,7 @@ export { | |||
132 | 131 | ||
133 | // --------------------------------------------------------------------------- | 132 | // --------------------------------------------------------------------------- |
134 | 133 | ||
135 | function checkUserCanDeleteVideoChannel (user: MUser, videoChannel: MChannelActorAccountDefault, res: express.Response) { | 134 | function checkUserCanDeleteVideoChannel (user: MUser, videoChannel: MChannelAccountDefault, res: express.Response) { |
136 | if (videoChannel.Actor.isOwned() === false) { | 135 | if (videoChannel.Actor.isOwned() === false) { |
137 | res.status(403) | 136 | res.status(403) |
138 | .json({ error: 'Cannot remove video channel of another server.' }) | 137 | .json({ error: 'Cannot remove video channel of another server.' }) |
diff --git a/server/middlewares/validators/videos/videos.ts b/server/middlewares/validators/videos/videos.ts index a194d14b3..1449903b7 100644 --- a/server/middlewares/validators/videos/videos.ts +++ b/server/middlewares/validators/videos/videos.ts | |||
@@ -44,7 +44,7 @@ import { isLocalVideoAccepted } from '../../../lib/moderation' | |||
44 | import { Hooks } from '../../../lib/plugins/hooks' | 44 | import { Hooks } from '../../../lib/plugins/hooks' |
45 | import { checkUserCanManageVideo, doesVideoChannelOfAccountExist, doesVideoExist } from '../../../helpers/middlewares' | 45 | import { checkUserCanManageVideo, doesVideoChannelOfAccountExist, doesVideoExist } from '../../../helpers/middlewares' |
46 | import { MVideoFullLight } from '@server/typings/models' | 46 | import { MVideoFullLight } from '@server/typings/models' |
47 | import { getVideo } from '../../../helpers/video' | 47 | import { getVideoWithAttributes } from '../../../helpers/video' |
48 | 48 | ||
49 | const videosAddValidator = getCommonVideoEditAttributes().concat([ | 49 | const videosAddValidator = getCommonVideoEditAttributes().concat([ |
50 | body('videofile') | 50 | body('videofile') |
@@ -123,7 +123,7 @@ const videosUpdateValidator = getCommonVideoEditAttributes().concat([ | |||
123 | ]) | 123 | ]) |
124 | 124 | ||
125 | async function checkVideoFollowConstraints (req: express.Request, res: express.Response, next: express.NextFunction) { | 125 | async function checkVideoFollowConstraints (req: express.Request, res: express.Response, next: express.NextFunction) { |
126 | const video = getVideo(res) | 126 | const video = getVideoWithAttributes(res) |
127 | 127 | ||
128 | // Anybody can watch local videos | 128 | // Anybody can watch local videos |
129 | if (video.isOwned() === true) return next() | 129 | if (video.isOwned() === true) return next() |
@@ -157,7 +157,7 @@ const videosCustomGetValidator = (fetchType: 'all' | 'only-video' | 'only-video- | |||
157 | if (areValidationErrors(req, res)) return | 157 | if (areValidationErrors(req, res)) return |
158 | if (!await doesVideoExist(req.params.id, res, fetchType)) return | 158 | if (!await doesVideoExist(req.params.id, res, fetchType)) return |
159 | 159 | ||
160 | const video = getVideo(res) | 160 | const video = getVideoWithAttributes(res) |
161 | const videoAll = video as MVideoFullLight | 161 | const videoAll = video as MVideoFullLight |
162 | 162 | ||
163 | // Video private or blacklisted | 163 | // Video private or blacklisted |
diff --git a/server/models/account/user.ts b/server/models/account/user.ts index 24b1626e7..cb54d79af 100644 --- a/server/models/account/user.ts +++ b/server/models/account/user.ts | |||
@@ -55,7 +55,7 @@ import { UserAdminFlag } from '../../../shared/models/users/user-flag.model' | |||
55 | import { isThemeNameValid } from '../../helpers/custom-validators/plugins' | 55 | import { isThemeNameValid } from '../../helpers/custom-validators/plugins' |
56 | import { getThemeOrDefault } from '../../lib/plugins/theme-utils' | 56 | import { getThemeOrDefault } from '../../lib/plugins/theme-utils' |
57 | import * as Bluebird from 'bluebird' | 57 | import * as Bluebird from 'bluebird' |
58 | import { MUserChannel, MUserDefault, MUserId, MUserWithNotificationSetting } from '@server/typings/models' | 58 | import { MUserNotifSettingChannelDefault, MUserDefault, MUserId, MUserWithNotificationSetting } from '@server/typings/models' |
59 | 59 | ||
60 | enum ScopeNames { | 60 | enum ScopeNames { |
61 | WITH_VIDEO_CHANNEL = 'WITH_VIDEO_CHANNEL' | 61 | WITH_VIDEO_CHANNEL = 'WITH_VIDEO_CHANNEL' |
@@ -384,7 +384,7 @@ export class UserModel extends Model<UserModel> { | |||
384 | return UserModel.findOne(query) | 384 | return UserModel.findOne(query) |
385 | } | 385 | } |
386 | 386 | ||
387 | static loadByUsernameAndPopulateChannels (username: string): Bluebird<MUserChannel> { | 387 | static loadByUsernameAndPopulateChannels (username: string): Bluebird<MUserNotifSettingChannelDefault> { |
388 | const query = { | 388 | const query = { |
389 | where: { | 389 | where: { |
390 | username: { [ Op.iLike ]: username } | 390 | username: { [ Op.iLike ]: username } |
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts index 79b9e7d2b..b6a60827f 100644 --- a/server/models/video/video-channel.ts +++ b/server/models/video/video-channel.ts | |||
@@ -37,7 +37,6 @@ import * as Bluebird from 'bluebird' | |||
37 | import { | 37 | import { |
38 | MChannelAccountDefault, | 38 | MChannelAccountDefault, |
39 | MChannelActor, | 39 | MChannelActor, |
40 | MChannelActorAccountDefault, | ||
41 | MChannelActorAccountDefaultVideos | 40 | MChannelActorAccountDefaultVideos |
42 | } from '../../typings/models/video' | 41 | } from '../../typings/models/video' |
43 | 42 | ||
@@ -376,13 +375,13 @@ export class VideoChannelModel extends Model<VideoChannelModel> { | |||
376 | }) | 375 | }) |
377 | } | 376 | } |
378 | 377 | ||
379 | static loadByIdAndPopulateAccount (id: number): Bluebird<MChannelActorAccountDefault> { | 378 | static loadByIdAndPopulateAccount (id: number): Bluebird<MChannelAccountDefault> { |
380 | return VideoChannelModel.unscoped() | 379 | return VideoChannelModel.unscoped() |
381 | .scope([ ScopeNames.WITH_ACTOR, ScopeNames.WITH_ACCOUNT ]) | 380 | .scope([ ScopeNames.WITH_ACTOR, ScopeNames.WITH_ACCOUNT ]) |
382 | .findByPk(id) | 381 | .findByPk(id) |
383 | } | 382 | } |
384 | 383 | ||
385 | static loadByIdAndAccount (id: number, accountId: number): Bluebird<MChannelActorAccountDefault> { | 384 | static loadByIdAndAccount (id: number, accountId: number): Bluebird<MChannelAccountDefault> { |
386 | const query = { | 385 | const query = { |
387 | where: { | 386 | where: { |
388 | id, | 387 | id, |
@@ -395,7 +394,7 @@ export class VideoChannelModel extends Model<VideoChannelModel> { | |||
395 | .findOne(query) | 394 | .findOne(query) |
396 | } | 395 | } |
397 | 396 | ||
398 | static loadAndPopulateAccount (id: number): Bluebird<MChannelActorAccountDefault> { | 397 | static loadAndPopulateAccount (id: number): Bluebird<MChannelAccountDefault> { |
399 | return VideoChannelModel.unscoped() | 398 | return VideoChannelModel.unscoped() |
400 | .scope([ ScopeNames.WITH_ACTOR, ScopeNames.WITH_ACCOUNT ]) | 399 | .scope([ ScopeNames.WITH_ACTOR, ScopeNames.WITH_ACCOUNT ]) |
401 | .findByPk(id) | 400 | .findByPk(id) |
@@ -427,7 +426,7 @@ export class VideoChannelModel extends Model<VideoChannelModel> { | |||
427 | return VideoChannelModel.loadByNameAndHostAndPopulateAccount(name, host) | 426 | return VideoChannelModel.loadByNameAndHostAndPopulateAccount(name, host) |
428 | } | 427 | } |
429 | 428 | ||
430 | static loadLocalByNameAndPopulateAccount (name: string): Bluebird<MChannelActorAccountDefault> { | 429 | static loadLocalByNameAndPopulateAccount (name: string): Bluebird<MChannelAccountDefault> { |
431 | const query = { | 430 | const query = { |
432 | include: [ | 431 | include: [ |
433 | { | 432 | { |
@@ -446,7 +445,7 @@ export class VideoChannelModel extends Model<VideoChannelModel> { | |||
446 | .findOne(query) | 445 | .findOne(query) |
447 | } | 446 | } |
448 | 447 | ||
449 | static loadByNameAndHostAndPopulateAccount (name: string, host: string): Bluebird<MChannelActorAccountDefault> { | 448 | static loadByNameAndHostAndPopulateAccount (name: string, host: string): Bluebird<MChannelAccountDefault> { |
450 | const query = { | 449 | const query = { |
451 | include: [ | 450 | include: [ |
452 | { | 451 | { |
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 7b1f0bc31..e62bde344 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -121,18 +121,18 @@ import { createTorrentPromise } from '../../helpers/webtorrent' | |||
121 | import { VideoStreamingPlaylistType } from '../../../shared/models/videos/video-streaming-playlist.type' | 121 | import { VideoStreamingPlaylistType } from '../../../shared/models/videos/video-streaming-playlist.type' |
122 | import { | 122 | import { |
123 | MChannel, | 123 | MChannel, |
124 | MChannelActorAccountDefault, | 124 | MChannelAccountDefault, |
125 | MChannelId, | 125 | MChannelId, |
126 | MUserAccountId, | 126 | MUserAccountId, |
127 | MUserId, | 127 | MUserId, |
128 | MVideoAccountAllFiles, | ||
129 | MVideoAccountLight, | 128 | MVideoAccountLight, |
129 | MVideoAccountLightBlacklistAllFiles, | ||
130 | MVideoDetails, | 130 | MVideoDetails, |
131 | MVideoForUser, | ||
131 | MVideoFullLight, | 132 | MVideoFullLight, |
132 | MVideoIdThumbnail, | 133 | MVideoIdThumbnail, |
133 | MVideoThumbnail, | 134 | MVideoThumbnail, |
134 | MVideoWithAllFiles, | 135 | MVideoWithAllFiles, |
135 | MVideoWithBlacklistThumbnailScheduled, | ||
136 | MVideoWithRights | 136 | MVideoWithRights |
137 | } from '../../typings/models' | 137 | } from '../../typings/models' |
138 | import { MVideoFile, MVideoFileRedundanciesOpt } from '../../typings/models/video/video-file' | 138 | import { MVideoFile, MVideoFileRedundanciesOpt } from '../../typings/models/video/video-file' |
@@ -1015,7 +1015,7 @@ export class VideoModel extends Model<VideoModel> { | |||
1015 | AccountModel | 1015 | AccountModel |
1016 | ], | 1016 | ], |
1017 | transaction: options.transaction | 1017 | transaction: options.transaction |
1018 | }) as MChannelActorAccountDefault | 1018 | }) as MChannelAccountDefault |
1019 | } | 1019 | } |
1020 | 1020 | ||
1021 | return sendDeleteVideo(instance, options.transaction) | 1021 | return sendDeleteVideo(instance, options.transaction) |
@@ -1209,10 +1209,10 @@ export class VideoModel extends Model<VideoModel> { | |||
1209 | 1209 | ||
1210 | return Promise.all([ | 1210 | return Promise.all([ |
1211 | VideoModel.count(countQuery), | 1211 | VideoModel.count(countQuery), |
1212 | VideoModel.scope(findScopes).findAll(findQuery) | 1212 | VideoModel.scope(findScopes).findAll<MVideoForUser>(findQuery) |
1213 | ]).then(([ count, rows ]) => { | 1213 | ]).then(([ count, rows ]) => { |
1214 | return { | 1214 | return { |
1215 | data: rows as MVideoWithBlacklistThumbnailScheduled[], | 1215 | data: rows, |
1216 | total: count | 1216 | total: count |
1217 | } | 1217 | } |
1218 | }) | 1218 | }) |
@@ -1468,7 +1468,7 @@ export class VideoModel extends Model<VideoModel> { | |||
1468 | return VideoModel.scope(ScopeNames.WITH_THUMBNAILS).findOne(query) | 1468 | return VideoModel.scope(ScopeNames.WITH_THUMBNAILS).findOne(query) |
1469 | } | 1469 | } |
1470 | 1470 | ||
1471 | static loadByUrlAndPopulateAccount (url: string, transaction?: Transaction): Bluebird<MVideoAccountAllFiles> { | 1471 | static loadByUrlAndPopulateAccount (url: string, transaction?: Transaction): Bluebird<MVideoAccountLightBlacklistAllFiles> { |
1472 | const query: FindOptions = { | 1472 | const query: FindOptions = { |
1473 | where: { | 1473 | where: { |
1474 | url | 1474 | url |
diff --git a/server/typings/express.ts b/server/typings/express.ts index 260091461..1fd809c1b 100644 --- a/server/typings/express.ts +++ b/server/typings/express.ts | |||
@@ -5,7 +5,7 @@ import { | |||
5 | MActorFollowActorsDefault, | 5 | MActorFollowActorsDefault, |
6 | MActorFollowActorsDefaultSubscription, | 6 | MActorFollowActorsDefaultSubscription, |
7 | MActorFull, | 7 | MActorFull, |
8 | MChannelActorAccountDefault, | 8 | MChannelAccountDefault, |
9 | MComment, | 9 | MComment, |
10 | MCommentOwnerVideoReply, | 10 | MCommentOwnerVideoReply, |
11 | MUserDefault, | 11 | MUserDefault, |
@@ -53,7 +53,7 @@ declare module 'express' { | |||
53 | 53 | ||
54 | videoStreamingPlaylist?: MStreamingPlaylist | 54 | videoStreamingPlaylist?: MStreamingPlaylist |
55 | 55 | ||
56 | videoChannel?: MChannelActorAccountDefault | 56 | videoChannel?: MChannelAccountDefault |
57 | 57 | ||
58 | videoPlaylistFull?: MVideoPlaylistFull | 58 | videoPlaylistFull?: MVideoPlaylistFull |
59 | videoPlaylistSummary?: MVideoPlaylistFullSummary | 59 | videoPlaylistSummary?: MVideoPlaylistFullSummary |
diff --git a/server/typings/models/account/account-blocklist.ts b/server/typings/models/account/account-blocklist.ts index 6d1771de8..d20d97aa8 100644 --- a/server/typings/models/account/account-blocklist.ts +++ b/server/typings/models/account/account-blocklist.ts | |||
@@ -2,10 +2,16 @@ import { AccountBlocklistModel } from '../../../models/account/account-blocklist | |||
2 | import { PickWith } from '../../utils' | 2 | import { PickWith } from '../../utils' |
3 | import { MAccountDefault } from './account' | 3 | import { MAccountDefault } from './account' |
4 | 4 | ||
5 | type Use<K extends keyof AccountBlocklistModel, M> = PickWith<AccountBlocklistModel, K, M> | ||
6 | |||
7 | // ############################################################################ | ||
8 | |||
5 | export type MAccountBlocklist = Omit<AccountBlocklistModel, 'ByAccount' | 'BlockedAccount'> | 9 | export type MAccountBlocklist = Omit<AccountBlocklistModel, 'ByAccount' | 'BlockedAccount'> |
6 | 10 | ||
11 | // ############################################################################ | ||
12 | |||
7 | export type MAccountBlocklistId = Pick<AccountBlocklistModel, 'id'> | 13 | export type MAccountBlocklistId = Pick<AccountBlocklistModel, 'id'> |
8 | 14 | ||
9 | export type MAccountBlocklistAccounts = MAccountBlocklist & | 15 | export type MAccountBlocklistAccounts = MAccountBlocklist & |
10 | PickWith<AccountBlocklistModel, 'ByAccount', MAccountDefault> & | 16 | Use<'ByAccount', MAccountDefault> & |
11 | PickWith<AccountBlocklistModel, 'BlockedAccount', MAccountDefault> | 17 | Use<'BlockedAccount', MAccountDefault> |
diff --git a/server/typings/models/account/account.ts b/server/typings/models/account/account.ts index f3646d510..9a8784e6b 100644 --- a/server/typings/models/account/account.ts +++ b/server/typings/models/account/account.ts | |||
@@ -5,7 +5,8 @@ import { | |||
5 | MActorAPI, | 5 | MActorAPI, |
6 | MActorAudience, | 6 | MActorAudience, |
7 | MActorDefault, | 7 | MActorDefault, |
8 | MActorDefaultLight, MActorId, | 8 | MActorDefaultLight, |
9 | MActorId, | ||
9 | MActorServer, | 10 | MActorServer, |
10 | MActorSummary, | 11 | MActorSummary, |
11 | MActorUrl | 12 | MActorUrl |
@@ -14,43 +15,63 @@ import { PickWith } from '../../utils' | |||
14 | import { MAccountBlocklistId } from './account-blocklist' | 15 | import { MAccountBlocklistId } from './account-blocklist' |
15 | import { MChannelDefault } from '@server/typings/models' | 16 | import { MChannelDefault } from '@server/typings/models' |
16 | 17 | ||
17 | export type MAccountId = Pick<AccountModel, 'id'> | 18 | type Use<K extends keyof AccountModel, M> = PickWith<AccountModel, K, M> |
18 | export type MAccountIdActor = MAccountId & | 19 | |
19 | PickWith<AccountModel, 'Actor', MActorAccountChannelId> | 20 | // ############################################################################ |
20 | export type MAccountIdActorId = MAccountId & | ||
21 | PickWith<AccountModel, 'Actor', MActorId> | ||
22 | 21 | ||
23 | export type MAccount = Omit<AccountModel, 'Actor' | 'User' | 'Application' | 'VideoChannels' | 'VideoPlaylists' | | 22 | export type MAccount = Omit<AccountModel, 'Actor' | 'User' | 'Application' | 'VideoChannels' | 'VideoPlaylists' | |
24 | 'VideoComments' | 'BlockedAccounts'> | 23 | 'VideoComments' | 'BlockedAccounts'> |
25 | 24 | ||
25 | // ############################################################################ | ||
26 | |||
27 | // Only some attributes | ||
28 | export type MAccountId = Pick<MAccount, 'id'> | ||
29 | export type MAccountUserId = Pick<MAccount, 'userId'> | ||
30 | |||
31 | // Only some Actor attributes | ||
32 | export type MAccountUrl = Use<'Actor', MActorUrl> | ||
33 | export type MAccountAudience = Use<'Actor', MActorAudience> | ||
34 | |||
35 | export type MAccountIdActor = MAccountId & | ||
36 | Use<'Actor', MActorAccountChannelId> | ||
37 | |||
38 | export type MAccountIdActorId = MAccountId & | ||
39 | Use<'Actor', MActorId> | ||
40 | |||
41 | // ############################################################################ | ||
42 | |||
26 | // Default scope | 43 | // Default scope |
27 | export type MAccountDefault = MAccount & | 44 | export type MAccountDefault = MAccount & |
28 | PickWith<AccountModel, 'Actor', MActorDefault> | 45 | Use<'Actor', MActorDefault> |
29 | 46 | ||
30 | export type MAccountDefaultChannelDefault = MAccountDefault & | 47 | // Default with default association scopes |
31 | PickWith<AccountModel, 'VideoChannels', MChannelDefault[]> | 48 | export type MAccountDefaultChannelDefault = MAccount & |
49 | Use<'Actor', MActorDefault> & | ||
50 | Use<'VideoChannels', MChannelDefault[]> | ||
32 | 51 | ||
52 | // We don't need some actors attributes | ||
33 | export type MAccountLight = MAccount & | 53 | export type MAccountLight = MAccount & |
34 | PickWith<AccountModel, 'Actor', MActorDefaultLight> | 54 | Use<'Actor', MActorDefaultLight> |
35 | 55 | ||
36 | export type MAccountUserId = Pick<MAccount, 'userId'> | 56 | // ############################################################################ |
37 | 57 | ||
58 | // Full actor | ||
38 | export type MAccountActor = MAccount & | 59 | export type MAccountActor = MAccount & |
39 | PickWith<AccountModel, 'Actor', MActor> | 60 | Use<'Actor', MActor> |
40 | export type MAccountServer = MAccountActor & | ||
41 | PickWith<AccountModel, 'Actor', MActorServer> | ||
42 | 61 | ||
43 | export type MAccountActorDefault = MAccount & | 62 | // Full actor with server |
44 | PickWith<AccountModel, 'Actor', MActorDefault> | 63 | export type MAccountServer = MAccount & |
64 | Use<'Actor', MActorServer> | ||
45 | 65 | ||
46 | export type MAccountSummary = Pick<MAccount, 'id' | 'name'> & | 66 | // ############################################################################ |
47 | PickWith<AccountModel, 'Actor', MActorSummary> | ||
48 | 67 | ||
49 | export type MAccountBlocks = MAccountSummary & | 68 | // For API |
50 | PickWith<AccountModel, 'BlockedAccounts', MAccountBlocklistId[]> | 69 | |
70 | export type MAccountSummary = Pick<MAccount, 'id' | 'name'> & | ||
71 | Use<'Actor', MActorSummary> | ||
51 | 72 | ||
52 | export type MAccountAPI = MAccountDefault & | 73 | export type MAccountSummaryBlocks = MAccountSummary & |
53 | PickWith<AccountModel, 'Actor', MActorAPI> | 74 | Use<'BlockedAccounts', MAccountBlocklistId[]> |
54 | 75 | ||
55 | export type MAccountUrl = PickWith<AccountModel, 'Actor', MActorUrl> | 76 | export type MAccountAPI = MAccount & |
56 | export type MAccountAudience = PickWith<AccountModel, 'Actor', MActorAudience> | 77 | Use<'Actor', MActorAPI> |
diff --git a/server/typings/models/account/actor-follow.ts b/server/typings/models/account/actor-follow.ts index 96c53d857..87050ac63 100644 --- a/server/typings/models/account/actor-follow.ts +++ b/server/typings/models/account/actor-follow.ts | |||
@@ -1,27 +1,55 @@ | |||
1 | import { ActorFollowModel } from '../../../models/activitypub/actor-follow' | 1 | import { ActorFollowModel } from '../../../models/activitypub/actor-follow' |
2 | import { MActor, MActorAccountChannel, MActorChannel, MActorChannelAccount, MActorDefault, MActorHost, MActorUsername } from './actor' | 2 | import { |
3 | MActor, | ||
4 | MActorAccount, | ||
5 | MActorAccountChannel, | ||
6 | MActorChannel, | ||
7 | MActorChannelAccountActor, | ||
8 | MActorDefault, | ||
9 | MActorHost, | ||
10 | MActorUsername | ||
11 | } from './actor' | ||
3 | import { PickWith } from '../../utils' | 12 | import { PickWith } from '../../utils' |
13 | import { ActorModel } from '@server/models/activitypub/actor' | ||
14 | |||
15 | type Use<K extends keyof ActorFollowModel, M> = PickWith<ActorFollowModel, K, M> | ||
16 | |||
17 | // ############################################################################ | ||
4 | 18 | ||
5 | export type MActorFollow = Omit<ActorFollowModel, 'ActorFollower' | 'ActorFollowing'> | 19 | export type MActorFollow = Omit<ActorFollowModel, 'ActorFollower' | 'ActorFollowing'> |
6 | 20 | ||
21 | // ############################################################################ | ||
22 | |||
23 | export type MActorFollowFollowingHost = MActorFollow & | ||
24 | Use<'ActorFollowing', MActorUsername & MActorHost> | ||
25 | |||
26 | // ############################################################################ | ||
27 | |||
28 | // With actors or actors default | ||
29 | |||
7 | export type MActorFollowActors = MActorFollow & | 30 | export type MActorFollowActors = MActorFollow & |
8 | PickWith<ActorFollowModel, 'ActorFollower', MActor> & | 31 | Use<'ActorFollower', MActor> & |
9 | PickWith<ActorFollowModel, 'ActorFollowing', MActor> | 32 | Use<'ActorFollowing', MActor> |
10 | 33 | ||
11 | export type MActorFollowActorsDefault = MActorFollow & | 34 | export type MActorFollowActorsDefault = MActorFollow & |
12 | PickWith<ActorFollowModel, 'ActorFollower', MActorDefault> & | 35 | Use<'ActorFollower', MActorDefault> & |
13 | PickWith<ActorFollowModel, 'ActorFollowing', MActorDefault> | 36 | Use<'ActorFollowing', MActorDefault> |
14 | |||
15 | export type MActorFollowActorsDefaultSubscription = MActorFollow & | ||
16 | PickWith<ActorFollowModel, 'ActorFollower', MActorDefault> & | ||
17 | PickWith<ActorFollowModel, 'ActorFollowing', MActorDefault & MActorChannel> | ||
18 | 37 | ||
19 | export type MActorFollowFull = MActorFollow & | 38 | export type MActorFollowFull = MActorFollow & |
20 | PickWith<ActorFollowModel, 'ActorFollower', MActorAccountChannel> & | 39 | Use<'ActorFollower', MActorAccountChannel> & |
21 | PickWith<ActorFollowModel, 'ActorFollowing', MActorAccountChannel> | 40 | Use<'ActorFollowing', MActorAccountChannel> |
22 | 41 | ||
23 | export type MActorFollowFollowingHost = MActorFollow & | 42 | // ############################################################################ |
24 | PickWith<ActorFollowModel, 'ActorFollowing', MActorUsername & MActorHost> | 43 | |
44 | // For subscriptions | ||
45 | |||
46 | export type MActorFollowActorsDefaultSubscription = MActorFollow & | ||
47 | Use<'ActorFollower', MActorDefault> & | ||
48 | Use<'ActorFollowing', MActorDefault & MActorChannel> | ||
49 | |||
50 | export type MActorFollowFollowingFullFollowerAccount = MActorFollow & | ||
51 | Use<'ActorFollower', MActorAccount> & | ||
52 | Use<'ActorFollowing', MActorAccountChannel> | ||
25 | 53 | ||
26 | export type MActorFollowSubscriptions = MActorFollow & | 54 | export type MActorFollowSubscriptions = MActorFollow & |
27 | PickWith<ActorFollowModel, 'ActorFollowing', MActorChannelAccount> | 55 | Use<'ActorFollowing', MActorChannelAccountActor> |
diff --git a/server/typings/models/account/actor.ts b/server/typings/models/account/actor.ts index f3e752a98..7d99a433b 100644 --- a/server/typings/models/account/actor.ts +++ b/server/typings/models/account/actor.ts | |||
@@ -1,74 +1,103 @@ | |||
1 | import { ActorModel } from '../../../models/activitypub/actor' | 1 | import { ActorModel } from '../../../models/activitypub/actor' |
2 | import { PickWith } from '../../utils' | 2 | import { PickWith } from '../../utils' |
3 | import { MAccount, MAccountActorDefault, MAccountId, MAccountIdActor } from './account' | 3 | import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from './account' |
4 | import { MServerHost, MServerHostBlocks, MServer } from '../server' | 4 | import { MServer, MServerHost, MServerHostBlocks } from '../server' |
5 | import { MAvatar } from './avatar' | 5 | import { MAvatar } from './avatar' |
6 | import { MChannel, MChannelAccountActor, MChannelActorAccountDefault, MChannelId, MChannelIdActor } from '../video' | 6 | import { MChannel, MChannelAccountActor, MChannelAccountDefault, MChannelId, MChannelIdActor } from '../video' |
7 | |||
8 | type Use<K extends keyof ActorModel, M> = PickWith<ActorModel, K, M> | ||
9 | |||
10 | // ############################################################################ | ||
7 | 11 | ||
8 | export type MActor = Omit<ActorModel, 'Account' | 'VideoChannel' | 'ActorFollowing' | 'Avatar' | 'ActorFollowers' | 'Server'> | 12 | export type MActor = Omit<ActorModel, 'Account' | 'VideoChannel' | 'ActorFollowing' | 'Avatar' | 'ActorFollowers' | 'Server'> |
9 | 13 | ||
14 | // ############################################################################ | ||
15 | |||
10 | export type MActorUrl = Pick<MActor, 'url'> | 16 | export type MActorUrl = Pick<MActor, 'url'> |
11 | export type MActorId = Pick<MActor, 'id'> | 17 | export type MActorId = Pick<MActor, 'id'> |
12 | export type MActorUsername = Pick<MActor, 'preferredUsername'> | 18 | export type MActorUsername = Pick<MActor, 'preferredUsername'> |
13 | export type MActorHost = PickWith<ActorModel, 'Server', MServerHost> | ||
14 | 19 | ||
15 | export type MActorFollowersUrl = Pick<MActor, 'followersUrl'> | 20 | export type MActorFollowersUrl = Pick<MActor, 'followersUrl'> |
16 | export type MActorAudience = MActorUrl & MActorFollowersUrl | 21 | export type MActorAudience = MActorUrl & MActorFollowersUrl |
22 | export type MActorFollowerException = Pick<ActorModel, 'sharedInboxUrl' | 'inboxUrl'> | ||
23 | export type MActorSignature = MActorAccountChannelId | ||
17 | 24 | ||
18 | export type MActorLight = Omit<MActor, 'privateKey' | 'privateKey'> | 25 | export type MActorLight = Omit<MActor, 'privateKey' | 'privateKey'> |
19 | 26 | ||
27 | // ############################################################################ | ||
28 | |||
29 | // Some association attributes | ||
30 | |||
31 | export type MActorHost = Use<'Server', MServerHost> | ||
32 | |||
20 | export type MActorDefaultLight = MActorLight & | 33 | export type MActorDefaultLight = MActorLight & |
21 | MActorHost & | 34 | Use<'Server', MServerHost> & |
22 | PickWith<ActorModel, 'Avatar', MAvatar> | 35 | Use<'Avatar', MAvatar> |
23 | 36 | ||
24 | export type MActorAccountId = MActor & | 37 | export type MActorAccountId = MActor & |
25 | PickWith<ActorModel, 'Account', MAccountId> | 38 | Use<'Account', MAccountId> |
26 | export type MActorAccountIdActor = MActor & | 39 | export type MActorAccountIdActor = MActor & |
27 | PickWith<ActorModel, 'Account', MAccountIdActor> | 40 | Use<'Account', MAccountIdActor> |
28 | 41 | ||
29 | export type MActorChannelId = MActor & | 42 | export type MActorChannelId = MActor & |
30 | PickWith<ActorModel, 'VideoChannel', MChannelId> | 43 | Use<'VideoChannel', MChannelId> |
31 | export type MActorChannelIdActor = MActor & | 44 | export type MActorChannelIdActor = MActor & |
32 | PickWith<ActorModel, 'VideoChannel', MChannelIdActor> | 45 | Use<'VideoChannel', MChannelIdActor> |
33 | 46 | ||
34 | export type MActorAccountChannelId = MActorAccountId & MActorChannelId | 47 | export type MActorAccountChannelId = MActorAccountId & MActorChannelId |
35 | export type MActorAccountChannelIdActor = MActorAccountIdActor & MActorChannelIdActor | 48 | export type MActorAccountChannelIdActor = MActorAccountIdActor & MActorChannelIdActor |
36 | 49 | ||
50 | // ############################################################################ | ||
51 | |||
52 | // Include raw account/channel/server | ||
53 | |||
37 | export type MActorAccount = MActor & | 54 | export type MActorAccount = MActor & |
38 | PickWith<ActorModel, 'Account', MAccount> | 55 | Use<'Account', MAccount> |
39 | 56 | ||
40 | export type MActorChannel = MActor & | 57 | export type MActorChannel = MActor & |
41 | PickWith<ActorModel, 'VideoChannel', MChannel> | 58 | Use<'VideoChannel', MChannel> |
42 | 59 | ||
43 | export type MActorAccountChannel = MActorAccount & MActorChannel | 60 | export type MActorAccountChannel = MActorAccount & MActorChannel |
44 | 61 | ||
45 | export type MActorChannelAccount = MActor & | ||
46 | PickWith<ActorModel, 'VideoChannel', MChannelAccountActor> | ||
47 | |||
48 | export type MActorServer = MActor & | 62 | export type MActorServer = MActor & |
49 | PickWith<ActorModel, 'Server', MServer> | 63 | Use<'Server', MServer> |
50 | 64 | ||
51 | export type MActorDefault = MActorServer & | 65 | // ############################################################################ |
52 | PickWith<ActorModel, 'Avatar', MAvatar> | ||
53 | 66 | ||
54 | export type MActorFull = MActorDefault & | 67 | // Complex actor associations |
55 | PickWith<ActorModel, 'Account', MAccount> & | ||
56 | PickWith<ActorModel, 'VideoChannel', MChannelAccountActor> | ||
57 | 68 | ||
58 | export type MActorFullActor = MActorDefault & | 69 | export type MActorDefault = MActor & |
59 | PickWith<ActorModel, 'Account', MAccountActorDefault> & | 70 | Use<'Server', MServer> & |
60 | PickWith<ActorModel, 'VideoChannel', MChannelActorAccountDefault> | 71 | Use<'Avatar', MAvatar> |
61 | 72 | ||
62 | export type MActorSummary = Pick<MActor, 'id' | 'preferredUsername' | 'url' | 'serverId' | 'avatarId'> & | 73 | // Actor with channel that is associated to an account and its actor |
63 | MActorHost & | 74 | // Actor -> VideoChannel -> Account -> Actor |
64 | PickWith<ActorModel, 'Avatar', MAvatar> | 75 | export type MActorChannelAccountActor = MActor & |
76 | Use<'VideoChannel', MChannelAccountActor> | ||
65 | 77 | ||
66 | export type MActorSummaryBlocks = Omit<MActorSummary, 'Server'> & | 78 | export type MActorFull = MActor & |
67 | PickWith<ActorModel, 'Server', MServerHostBlocks> | 79 | Use<'Server', MServer> & |
80 | Use<'Avatar', MAvatar> & | ||
81 | Use<'Account', MAccount> & | ||
82 | Use<'VideoChannel', MChannelAccountActor> | ||
68 | 83 | ||
69 | export type MActorFollowerException = Pick<ActorModel, 'sharedInboxUrl' | 'inboxUrl'> | 84 | // Same than ActorFull, but the account and the channel have their actor |
85 | export type MActorFullActor = MActor & | ||
86 | Use<'Server', MServer> & | ||
87 | Use<'Avatar', MAvatar> & | ||
88 | Use<'Account', MAccountDefault> & | ||
89 | Use<'VideoChannel', MChannelAccountDefault> | ||
90 | |||
91 | // ############################################################################ | ||
92 | |||
93 | // API | ||
94 | |||
95 | export type MActorSummary = Pick<MActor, 'id' | 'preferredUsername' | 'url' | 'serverId' | 'avatarId'> & | ||
96 | Use<'Server', MServerHost> & | ||
97 | Use<'Avatar', MAvatar> | ||
98 | |||
99 | export type MActorSummaryBlocks = MActorSummary & | ||
100 | Use<'Server', MServerHostBlocks> | ||
70 | 101 | ||
71 | export type MActorAPI = Omit<MActorDefault, 'publicKey' | 'privateKey' | 'inboxUrl' | 'outboxUrl' | 'sharedInboxUrl' | | 102 | export type MActorAPI = Omit<MActorDefault, 'publicKey' | 'privateKey' | 'inboxUrl' | 'outboxUrl' | 'sharedInboxUrl' | |
72 | 'followersUrl' | 'followingUrl' | 'url' | 'createdAt' | 'updatedAt'> | 103 | 'followersUrl' | 'followingUrl' | 'url' | 'createdAt' | 'updatedAt'> |
73 | |||
74 | export type MActorSignature = MActorAccountChannelId | ||
diff --git a/server/typings/models/index.d.ts b/server/typings/models/index.d.ts index 39e82e4a8..78b4948ce 100644 --- a/server/typings/models/index.d.ts +++ b/server/typings/models/index.d.ts | |||
@@ -1,4 +1,5 @@ | |||
1 | export * from './account' | 1 | export * from './account' |
2 | export * from './oauth' | ||
2 | export * from './server' | 3 | export * from './server' |
3 | export * from './user' | 4 | export * from './user' |
4 | export * from './video' | 5 | export * from './video' |
diff --git a/server/typings/models/oauth/index.d.ts b/server/typings/models/oauth/index.d.ts new file mode 100644 index 000000000..36b7ea8ca --- /dev/null +++ b/server/typings/models/oauth/index.d.ts | |||
@@ -0,0 +1,2 @@ | |||
1 | export * from './oauth-client' | ||
2 | export * from './oauth-token' | ||
diff --git a/server/typings/models/oauth/oauth-token.ts b/server/typings/models/oauth/oauth-token.ts index 105ea3df3..af3412925 100644 --- a/server/typings/models/oauth/oauth-token.ts +++ b/server/typings/models/oauth/oauth-token.ts | |||
@@ -2,8 +2,12 @@ import { OAuthTokenModel } from '@server/models/oauth/oauth-token' | |||
2 | import { PickWith } from '@server/typings/utils' | 2 | import { PickWith } from '@server/typings/utils' |
3 | import { MUserAccountUrl } from '@server/typings/models' | 3 | import { MUserAccountUrl } from '@server/typings/models' |
4 | 4 | ||
5 | type Use<K extends keyof OAuthTokenModel, M> = PickWith<OAuthTokenModel, K, M> | ||
6 | |||
7 | // ############################################################################ | ||
8 | |||
5 | export type MOAuthToken = Omit<OAuthTokenModel, 'User' | 'OAuthClients'> | 9 | export type MOAuthToken = Omit<OAuthTokenModel, 'User' | 'OAuthClients'> |
6 | 10 | ||
7 | export type MOAuthTokenUser = MOAuthToken & | 11 | export type MOAuthTokenUser = MOAuthToken & |
8 | PickWith<OAuthTokenModel, 'User', MUserAccountUrl> & | 12 | Use<'User', MUserAccountUrl> & |
9 | { user?: MUserAccountUrl } | 13 | { user?: MUserAccountUrl } |
diff --git a/server/typings/models/server/server-blocklist.ts b/server/typings/models/server/server-blocklist.ts index 38065f382..0ca00b5c2 100644 --- a/server/typings/models/server/server-blocklist.ts +++ b/server/typings/models/server/server-blocklist.ts | |||
@@ -2,8 +2,14 @@ import { ServerBlocklistModel } from '@server/models/server/server-blocklist' | |||
2 | import { PickWith } from '@server/typings/utils' | 2 | import { PickWith } from '@server/typings/utils' |
3 | import { MAccountDefault, MServer } from '@server/typings/models' | 3 | import { MAccountDefault, MServer } from '@server/typings/models' |
4 | 4 | ||
5 | type Use<K extends keyof ServerBlocklistModel, M> = PickWith<ServerBlocklistModel, K, M> | ||
6 | |||
7 | // ############################################################################ | ||
8 | |||
5 | export type MServerBlocklist = Omit<ServerBlocklistModel, 'ByAccount' | 'BlockedServer'> | 9 | export type MServerBlocklist = Omit<ServerBlocklistModel, 'ByAccount' | 'BlockedServer'> |
6 | 10 | ||
11 | // ############################################################################ | ||
12 | |||
7 | export type MServerBlocklistAccountServer = MServerBlocklist & | 13 | export type MServerBlocklistAccountServer = MServerBlocklist & |
8 | PickWith<ServerBlocklistModel, 'ByAccount', MAccountDefault> & | 14 | Use<'ByAccount', MAccountDefault> & |
9 | PickWith<ServerBlocklistModel, 'BlockedServer', MServer> | 15 | Use<'BlockedServer', MServer> |
diff --git a/server/typings/models/server/server.ts b/server/typings/models/server/server.ts index 6be7bf9bb..c059cff79 100644 --- a/server/typings/models/server/server.ts +++ b/server/typings/models/server/server.ts | |||
@@ -2,9 +2,15 @@ import { ServerModel } from '../../../models/server/server' | |||
2 | import { PickWith } from '../../utils' | 2 | import { PickWith } from '../../utils' |
3 | import { MAccountBlocklistId } from '../account' | 3 | import { MAccountBlocklistId } from '../account' |
4 | 4 | ||
5 | type Use<K extends keyof ServerModel, M> = PickWith<ServerModel, K, M> | ||
6 | |||
7 | // ############################################################################ | ||
8 | |||
5 | export type MServer = Omit<ServerModel, 'Actors' | 'BlockedByAccounts'> | 9 | export type MServer = Omit<ServerModel, 'Actors' | 'BlockedByAccounts'> |
6 | 10 | ||
11 | // ############################################################################ | ||
12 | |||
7 | export type MServerHost = Pick<MServer, 'host'> | 13 | export type MServerHost = Pick<MServer, 'host'> |
8 | 14 | ||
9 | export type MServerHostBlocks = MServerHost & | 15 | export type MServerHostBlocks = MServerHost & |
10 | PickWith<ServerModel, 'BlockedByAccounts', MAccountBlocklistId[]> | 16 | Use<'BlockedByAccounts', MAccountBlocklistId[]> |
diff --git a/server/typings/models/user/index.d.ts b/server/typings/models/user/index.d.ts index e3353d0b1..6657b2128 100644 --- a/server/typings/models/user/index.d.ts +++ b/server/typings/models/user/index.d.ts | |||
@@ -1,3 +1,4 @@ | |||
1 | export * from './user' | 1 | export * from './user' |
2 | export * from './user-notification' | 2 | export * from './user-notification' |
3 | export * from './user-notification-setting' | ||
3 | export * from './user-video-history' | 4 | export * from './user-video-history' |
diff --git a/server/typings/models/user/user-notification.ts b/server/typings/models/user/user-notification.ts index b872c5dc5..f9daf5eb2 100644 --- a/server/typings/models/user/user-notification.ts +++ b/server/typings/models/user/user-notification.ts | |||
@@ -12,6 +12,10 @@ import { VideoBlacklistModel } from '../../../models/video/video-blacklist' | |||
12 | import { VideoImportModel } from '../../../models/video/video-import' | 12 | import { VideoImportModel } from '../../../models/video/video-import' |
13 | import { ActorFollowModel } from '../../../models/activitypub/actor-follow' | 13 | import { ActorFollowModel } from '../../../models/activitypub/actor-follow' |
14 | 14 | ||
15 | type Use<K extends keyof UserNotificationModel, M> = PickWith<UserNotificationModel, K, M> | ||
16 | |||
17 | // ############################################################################ | ||
18 | |||
15 | export namespace UserNotificationIncludes { | 19 | export namespace UserNotificationIncludes { |
16 | export type VideoInclude = Pick<VideoModel, 'id' | 'uuid' | 'name'> | 20 | export type VideoInclude = Pick<VideoModel, 'id' | 'uuid' | 'name'> |
17 | export type VideoIncludeChannel = VideoInclude & | 21 | export type VideoIncludeChannel = VideoInclude & |
@@ -56,14 +60,18 @@ export namespace UserNotificationIncludes { | |||
56 | PickWith<ActorFollowModel, 'ActorFollowing', ActorFollowing> | 60 | PickWith<ActorFollowModel, 'ActorFollowing', ActorFollowing> |
57 | } | 61 | } |
58 | 62 | ||
59 | export type UserNotificationModelOnly = Omit<UserNotificationModel, 'User' | 'Video' | 'Comment' | 'VideoAbuse' | 'VideoBlacklist' | | 63 | // ############################################################################ |
64 | |||
65 | export type MUserNotification = Omit<UserNotificationModel, 'User' | 'Video' | 'Comment' | 'VideoAbuse' | 'VideoBlacklist' | | ||
60 | 'VideoImport' | 'Account' | 'ActorFollow'> | 66 | 'VideoImport' | 'Account' | 'ActorFollow'> |
61 | 67 | ||
62 | export type UserNotificationModelForApi = UserNotificationModelOnly & | 68 | // ############################################################################ |
63 | PickWith<UserNotificationModel, 'Video', UserNotificationIncludes.VideoIncludeChannel> & | 69 | |
64 | PickWith<UserNotificationModel, 'Comment', UserNotificationIncludes.VideoCommentInclude> & | 70 | export type UserNotificationModelForApi = MUserNotification & |
65 | PickWith<UserNotificationModel, 'VideoAbuse', UserNotificationIncludes.VideoAbuseInclude> & | 71 | Use<'Video', UserNotificationIncludes.VideoIncludeChannel> & |
66 | PickWith<UserNotificationModel, 'VideoBlacklist', UserNotificationIncludes.VideoBlacklistInclude> & | 72 | Use<'Comment', UserNotificationIncludes.VideoCommentInclude> & |
67 | PickWith<UserNotificationModel, 'VideoImport', UserNotificationIncludes.VideoImportInclude> & | 73 | Use<'VideoAbuse', UserNotificationIncludes.VideoAbuseInclude> & |
68 | PickWith<UserNotificationModel, 'ActorFollow', UserNotificationIncludes.ActorFollowInclude> & | 74 | Use<'VideoBlacklist', UserNotificationIncludes.VideoBlacklistInclude> & |
69 | PickWith<UserNotificationModel, 'Account', UserNotificationIncludes.AccountIncludeActor> | 75 | Use<'VideoImport', UserNotificationIncludes.VideoImportInclude> & |
76 | Use<'ActorFollow', UserNotificationIncludes.ActorFollowInclude> & | ||
77 | Use<'Account', UserNotificationIncludes.AccountIncludeActor> | ||
diff --git a/server/typings/models/user/user.ts b/server/typings/models/user/user.ts index b91eed8d9..466cde33b 100644 --- a/server/typings/models/user/user.ts +++ b/server/typings/models/user/user.ts | |||
@@ -3,30 +3,49 @@ import { PickWith } from '../../utils' | |||
3 | import { MAccount, MAccountDefault, MAccountDefaultChannelDefault, MAccountId, MAccountIdActorId, MAccountUrl } from '../account' | 3 | import { MAccount, MAccountDefault, MAccountDefaultChannelDefault, MAccountId, MAccountIdActorId, MAccountUrl } from '../account' |
4 | import { MNotificationSetting } from './user-notification-setting' | 4 | import { MNotificationSetting } from './user-notification-setting' |
5 | 5 | ||
6 | type Use<K extends keyof UserModel, M> = PickWith<UserModel, K, M> | ||
7 | |||
8 | // ############################################################################ | ||
9 | |||
6 | export type MUser = Omit<UserModel, 'Account' | 'NotificationSetting' | 'VideoImports' | 'OAuthTokens'> | 10 | export type MUser = Omit<UserModel, 'Account' | 'NotificationSetting' | 'VideoImports' | 'OAuthTokens'> |
7 | 11 | ||
12 | // ############################################################################ | ||
13 | |||
8 | export type MUserId = Pick<UserModel, 'id'> | 14 | export type MUserId = Pick<UserModel, 'id'> |
9 | 15 | ||
10 | export type MUserWithNotificationSetting = MUser & | 16 | // ############################################################################ |
11 | PickWith<UserModel, 'NotificationSetting', MNotificationSetting> | ||
12 | 17 | ||
13 | export type MUserAccountDefault = MUser & | 18 | // With account |
14 | PickWith<UserModel, 'Account', MAccountDefault> | 19 | |
20 | export type MUserAccountId = MUser & | ||
21 | Use<'Account', MAccountId> | ||
22 | |||
23 | export type MUserAccountUrl = MUser & | ||
24 | Use<'Account', MAccountUrl & MAccountIdActorId> | ||
15 | 25 | ||
16 | export type MUserAccount = MUser & | 26 | export type MUserAccount = MUser & |
17 | PickWith<UserModel, 'Account', MAccount> | 27 | Use<'Account', MAccount> |
18 | 28 | ||
19 | export type MUserAccountId = MUser & | 29 | export type MUserAccountDefault = MUser & |
20 | PickWith<UserModel, 'Account', MAccountId> | 30 | Use<'Account', MAccountDefault> |
21 | 31 | ||
22 | export type MUserNotifSettingAccount = MUserWithNotificationSetting & MUserAccount | 32 | // With channel |
23 | 33 | ||
24 | export type MUserDefault = MUser & | 34 | export type MUserNotifSettingChannelDefault = MUser & |
25 | MUserWithNotificationSetting & | 35 | Use<'NotificationSetting', MNotificationSetting> & |
26 | MUserAccountDefault | 36 | Use<'Account', MAccountDefaultChannelDefault> |
27 | 37 | ||
28 | export type MUserChannel = MUserWithNotificationSetting & | 38 | // With notification settings |
29 | PickWith<UserModel, 'Account', MAccountDefaultChannelDefault> | ||
30 | 39 | ||
31 | export type MUserAccountUrl = MUser & | 40 | export type MUserWithNotificationSetting = MUser & |
32 | PickWith<UserModel, 'Account', MAccountUrl & MAccountIdActorId> | 41 | Use<'NotificationSetting', MNotificationSetting> |
42 | |||
43 | export type MUserNotifSettingAccount = MUser & | ||
44 | Use<'NotificationSetting', MNotificationSetting> & | ||
45 | Use<'Account', MAccount> | ||
46 | |||
47 | // Default scope | ||
48 | |||
49 | export type MUserDefault = MUser & | ||
50 | Use<'NotificationSetting', MNotificationSetting> & | ||
51 | Use<'Account', MAccountDefault> | ||
diff --git a/server/typings/models/video/index.d.ts b/server/typings/models/video/index.d.ts index 528e9d274..bd69c8a4b 100644 --- a/server/typings/models/video/index.d.ts +++ b/server/typings/models/video/index.d.ts | |||
@@ -5,10 +5,14 @@ export * from './video' | |||
5 | export * from './video-abuse' | 5 | export * from './video-abuse' |
6 | export * from './video-blacklist' | 6 | export * from './video-blacklist' |
7 | export * from './video-caption' | 7 | export * from './video-caption' |
8 | export * from './video-change-ownership' | ||
8 | export * from './video-channels' | 9 | export * from './video-channels' |
9 | export * from './video-comment' | 10 | export * from './video-comment' |
10 | export * from './video-file' | 11 | export * from './video-file' |
12 | export * from './video-import' | ||
11 | export * from './video-playlist' | 13 | export * from './video-playlist' |
14 | export * from './video-playlist-element' | ||
15 | export * from './video-rate' | ||
12 | export * from './video-redundancy' | 16 | export * from './video-redundancy' |
13 | export * from './video-share' | 17 | export * from './video-share' |
14 | export * from './video-streaming-playlist' | 18 | export * from './video-streaming-playlist' |
diff --git a/server/typings/models/video/video-abuse.ts b/server/typings/models/video/video-abuse.ts index 1667ae55a..0474cac5b 100644 --- a/server/typings/models/video/video-abuse.ts +++ b/server/typings/models/video/video-abuse.ts | |||
@@ -3,13 +3,21 @@ import { PickWith } from '../../utils' | |||
3 | import { MVideo } from './video' | 3 | import { MVideo } from './video' |
4 | import { MAccountDefault } from '../account' | 4 | import { MAccountDefault } from '../account' |
5 | 5 | ||
6 | type Use<K extends keyof VideoAbuseModel, M> = PickWith<VideoAbuseModel, K, M> | ||
7 | |||
8 | // ############################################################################ | ||
9 | |||
6 | export type MVideoAbuse = Omit<VideoAbuseModel, 'Account' | 'Video' | 'toActivityPubObject'> | 10 | export type MVideoAbuse = Omit<VideoAbuseModel, 'Account' | 'Video' | 'toActivityPubObject'> |
7 | 11 | ||
12 | // ############################################################################ | ||
13 | |||
8 | export type MVideoAbuseId = Pick<VideoAbuseModel, 'id'> | 14 | export type MVideoAbuseId = Pick<VideoAbuseModel, 'id'> |
9 | 15 | ||
10 | export type MVideoAbuseVideo = MVideoAbuse & | 16 | export type MVideoAbuseVideo = MVideoAbuse & |
11 | Pick<VideoAbuseModel, 'toActivityPubObject'> & | 17 | Pick<VideoAbuseModel, 'toActivityPubObject'> & |
12 | PickWith<VideoAbuseModel, 'Video', MVideo> | 18 | Use<'Video', MVideo> |
13 | 19 | ||
14 | export type MVideoAbuseAccountVideo = MVideoAbuseVideo & | 20 | export type MVideoAbuseAccountVideo = MVideoAbuse & |
15 | PickWith<VideoAbuseModel, 'Account', MAccountDefault> | 21 | Pick<VideoAbuseModel, 'toActivityPubObject'> & |
22 | Use<'Video', MVideo> & | ||
23 | Use<'Account', MAccountDefault> | ||
diff --git a/server/typings/models/video/video-blacklist.ts b/server/typings/models/video/video-blacklist.ts index 9242b357d..cc539f95c 100644 --- a/server/typings/models/video/video-blacklist.ts +++ b/server/typings/models/video/video-blacklist.ts | |||
@@ -2,10 +2,16 @@ import { VideoBlacklistModel } from '../../../models/video/video-blacklist' | |||
2 | import { PickWith } from '@server/typings/utils' | 2 | import { PickWith } from '@server/typings/utils' |
3 | import { MVideo } from '@server/typings/models' | 3 | import { MVideo } from '@server/typings/models' |
4 | 4 | ||
5 | type Use<K extends keyof VideoBlacklistModel, M> = PickWith<VideoBlacklistModel, K, M> | ||
6 | |||
7 | // ############################################################################ | ||
8 | |||
5 | export type MVideoBlacklist = Omit<VideoBlacklistModel, 'Video'> | 9 | export type MVideoBlacklist = Omit<VideoBlacklistModel, 'Video'> |
6 | 10 | ||
7 | export type MVideoBlacklistLight = Pick<MVideoBlacklist, 'id' | 'reason' | 'unfederated'> | 11 | export type MVideoBlacklistLight = Pick<MVideoBlacklist, 'id' | 'reason' | 'unfederated'> |
8 | export type MVideoBlacklistUnfederated = Pick<MVideoBlacklist, 'unfederated'> | 12 | export type MVideoBlacklistUnfederated = Pick<MVideoBlacklist, 'unfederated'> |
9 | 13 | ||
14 | // ############################################################################ | ||
15 | |||
10 | export type MVideoBlacklistVideo = MVideoBlacklist & | 16 | export type MVideoBlacklistVideo = MVideoBlacklist & |
11 | PickWith<VideoBlacklistModel, 'Video', MVideo> | 17 | Use<'Video', MVideo> |
diff --git a/server/typings/models/video/video-caption.ts b/server/typings/models/video/video-caption.ts index 16d8b7392..fe0e664c2 100644 --- a/server/typings/models/video/video-caption.ts +++ b/server/typings/models/video/video-caption.ts | |||
@@ -2,9 +2,15 @@ import { VideoCaptionModel } from '../../../models/video/video-caption' | |||
2 | import { PickWith } from '@server/typings/utils' | 2 | import { PickWith } from '@server/typings/utils' |
3 | import { VideoModel } from '@server/models/video/video' | 3 | import { VideoModel } from '@server/models/video/video' |
4 | 4 | ||
5 | type Use<K extends keyof VideoCaptionModel, M> = PickWith<VideoCaptionModel, K, M> | ||
6 | |||
7 | // ############################################################################ | ||
8 | |||
5 | export type MVideoCaption = Omit<VideoCaptionModel, 'Video'> | 9 | export type MVideoCaption = Omit<VideoCaptionModel, 'Video'> |
6 | 10 | ||
11 | // ############################################################################ | ||
12 | |||
7 | export type MVideoCaptionLanguage = Pick<MVideoCaption, 'language'> | 13 | export type MVideoCaptionLanguage = Pick<MVideoCaption, 'language'> |
8 | 14 | ||
9 | export type MVideoCaptionVideo = MVideoCaption & | 15 | export type MVideoCaptionVideo = MVideoCaption & |
10 | PickWith<VideoCaptionModel, 'Video', Pick<VideoModel, 'id' | 'remote' | 'uuid'>> | 16 | Use<'Video', Pick<VideoModel, 'id' | 'remote' | 'uuid'>> |
diff --git a/server/typings/models/video/video-change-ownership.ts b/server/typings/models/video/video-change-ownership.ts index 718515e2d..0410115c6 100644 --- a/server/typings/models/video/video-change-ownership.ts +++ b/server/typings/models/video/video-change-ownership.ts | |||
@@ -2,9 +2,13 @@ import { VideoChangeOwnershipModel } from '@server/models/video/video-change-own | |||
2 | import { PickWith } from '@server/typings/utils' | 2 | import { PickWith } from '@server/typings/utils' |
3 | import { MAccountDefault, MVideoWithFileThumbnail } from '@server/typings/models' | 3 | import { MAccountDefault, MVideoWithFileThumbnail } from '@server/typings/models' |
4 | 4 | ||
5 | type Use<K extends keyof VideoChangeOwnershipModel, M> = PickWith<VideoChangeOwnershipModel, K, M> | ||
6 | |||
7 | // ############################################################################ | ||
8 | |||
5 | export type MVideoChangeOwnership = Omit<VideoChangeOwnershipModel, 'Initiator' | 'NextOwner' | 'Video'> | 9 | export type MVideoChangeOwnership = Omit<VideoChangeOwnershipModel, 'Initiator' | 'NextOwner' | 'Video'> |
6 | 10 | ||
7 | export type MVideoChangeOwnershipFull = MVideoChangeOwnership & | 11 | export type MVideoChangeOwnershipFull = MVideoChangeOwnership & |
8 | PickWith<VideoChangeOwnershipModel, 'Initiator', MAccountDefault> & | 12 | Use<'Initiator', MAccountDefault> & |
9 | PickWith<VideoChangeOwnershipModel, 'NextOwner', MAccountDefault> & | 13 | Use<'NextOwner', MAccountDefault> & |
10 | PickWith<VideoChangeOwnershipModel, 'Video', MVideoWithFileThumbnail> | 14 | Use<'Video', MVideoWithFileThumbnail> |
diff --git a/server/typings/models/video/video-channels.ts b/server/typings/models/video/video-channels.ts index e10bd6842..b6506ed9f 100644 --- a/server/typings/models/video/video-channels.ts +++ b/server/typings/models/video/video-channels.ts | |||
@@ -1,70 +1,97 @@ | |||
1 | import { FunctionProperties, PickWith } from '../../utils' | 1 | import { PickWith } from '../../utils' |
2 | import { VideoChannelModel } from '../../../models/video/video-channel' | 2 | import { VideoChannelModel } from '../../../models/video/video-channel' |
3 | import { | 3 | import { |
4 | MAccountActor, | 4 | MAccountActor, |
5 | MAccountAPI, | 5 | MAccountAPI, |
6 | MAccountBlocks, | ||
7 | MAccountDefault, | 6 | MAccountDefault, |
8 | MAccountLight, | 7 | MAccountLight, |
8 | MAccountSummaryBlocks, | ||
9 | MAccountUserId, | 9 | MAccountUserId, |
10 | MActor, | 10 | MActor, |
11 | MActorAccountChannelId, | 11 | MActorAccountChannelId, |
12 | MActorAPI, | 12 | MActorAPI, |
13 | MActorDefault, | 13 | MActorDefault, |
14 | MActorDefaultLight, MActorLight, | 14 | MActorDefaultLight, |
15 | MActorLight, | ||
15 | MActorSummary | 16 | MActorSummary |
16 | } from '../account' | 17 | } from '../account' |
17 | import { MVideo } from './video' | 18 | import { MVideo } from './video' |
18 | 19 | ||
19 | export type MChannelId = FunctionProperties<VideoChannelModel> | 20 | type Use<K extends keyof VideoChannelModel, M> = PickWith<VideoChannelModel, K, M> |
20 | export type MChannelIdActor = MChannelId & | 21 | |
21 | PickWith<VideoChannelModel, 'Actor', MActorAccountChannelId> | 22 | // ############################################################################ |
22 | 23 | ||
23 | export type MChannel = Omit<VideoChannelModel, 'Actor' | 'Account' | 'Videos' | 'VideoPlaylists'> | 24 | export type MChannel = Omit<VideoChannelModel, 'Actor' | 'Account' | 'Videos' | 'VideoPlaylists'> |
24 | 25 | ||
26 | // ############################################################################ | ||
27 | |||
28 | export type MChannelId = Pick<MChannel, 'id'> | ||
29 | |||
30 | // ############################################################################ | ||
31 | |||
32 | export type MChannelIdActor = MChannelId & | ||
33 | Use<'Actor', MActorAccountChannelId> | ||
34 | |||
25 | export type MChannelUserId = Pick<MChannel, 'accountId'> & | 35 | export type MChannelUserId = Pick<MChannel, 'accountId'> & |
26 | PickWith<VideoChannelModel, 'Account', MAccountUserId> | 36 | Use<'Account', MAccountUserId> |
37 | |||
38 | export type MChannelActor = MChannel & | ||
39 | Use<'Actor', MActor> | ||
27 | 40 | ||
28 | // Default scope | 41 | // Default scope |
29 | export type MChannelDefault = MChannel & | 42 | export type MChannelDefault = MChannel & |
30 | PickWith<VideoChannelModel, 'Actor', MActorDefault> | 43 | Use<'Actor', MActorDefault> |
44 | |||
45 | // ############################################################################ | ||
46 | |||
47 | // Not all association attributes | ||
31 | 48 | ||
32 | export type MChannelLight = MChannel & | 49 | export type MChannelLight = MChannel & |
33 | PickWith<VideoChannelModel, 'Actor', MActorDefaultLight> | 50 | Use<'Actor', MActorDefaultLight> |
34 | 51 | ||
35 | export type MChannelAccountLight = MChannel & | 52 | export type MChannelActorLight = MChannel & |
36 | PickWith<VideoChannelModel, 'Actor', MActorDefaultLight> & | 53 | Use<'Actor', MActorLight> |
37 | PickWith<VideoChannelModel, 'Account', MAccountLight> | ||
38 | 54 | ||
39 | export type MChannelSummary = Pick<MChannel, 'id' | 'name' | 'description' | 'actorId'> & | 55 | export type MChannelAccountLight = MChannel & |
40 | PickWith<VideoChannelModel, 'Actor', MActorSummary> | 56 | Use<'Actor', MActorDefaultLight> & |
57 | Use<'Account', MAccountLight> | ||
41 | 58 | ||
42 | export type MChannelSummaryAccount = MChannelSummary & | 59 | // ############################################################################ |
43 | PickWith<VideoChannelModel, 'Account', MAccountBlocks> | ||
44 | 60 | ||
45 | export type MChannelAPI = MChannel & | 61 | // Account associations |
46 | PickWith<VideoChannelModel, 'Actor', MActorAPI> & | ||
47 | PickWith<VideoChannelModel, 'Account', MAccountAPI> | ||
48 | 62 | ||
49 | export type MChannelAccountActor = MChannel & | 63 | export type MChannelAccountActor = MChannel & |
50 | PickWith<VideoChannelModel, 'Account', MAccountActor> | 64 | Use<'Account', MAccountActor> |
51 | export type MChannelAccountDefault = MChannelActor & | 65 | |
52 | PickWith<VideoChannelModel, 'Account', MAccountDefault> | 66 | export type MChannelAccountDefault = MChannel & |
67 | Use<'Actor', MActorDefault> & | ||
68 | Use<'Account', MAccountDefault> | ||
53 | 69 | ||
70 | export type MChannelActorAccountActor = MChannel & | ||
71 | Use<'Account', MAccountActor> & | ||
72 | Use<'Actor', MActor> | ||
73 | |||
74 | // ############################################################################ | ||
75 | |||
76 | // Videos associations | ||
54 | export type MChannelVideos = MChannel & | 77 | export type MChannelVideos = MChannel & |
55 | PickWith<VideoChannelModel, 'Videos', MVideo[]> | 78 | Use<'Videos', MVideo[]> |
56 | 79 | ||
57 | export type MChannelActor = MChannel & | 80 | export type MChannelActorAccountDefaultVideos = MChannel & |
58 | PickWith<VideoChannelModel, 'Actor', MActor> | 81 | Use<'Actor', MActorDefault> & |
59 | export type MChannelActorLight = MChannel & | 82 | Use<'Account', MAccountDefault> & |
60 | PickWith<VideoChannelModel, 'Actor', MActorLight> | 83 | Use<'Videos', MVideo[]> |
61 | export type MChannelActorDefault = MChannel & | 84 | |
62 | PickWith<VideoChannelModel, 'Actor', MActorDefault> | 85 | // ############################################################################ |
86 | |||
87 | // For API | ||
63 | 88 | ||
64 | export type MChannelActorAccountActor = MChannelAccountActor & MChannelActor | 89 | export type MChannelSummary = Pick<MChannel, 'id' | 'name' | 'description' | 'actorId'> & |
90 | Use<'Actor', MActorSummary> | ||
65 | 91 | ||
66 | export type MChannelActorAccountDefault = MChannel & | 92 | export type MChannelSummaryAccount = MChannelSummary & |
67 | PickWith<VideoChannelModel, 'Actor', MActorDefault> & | 93 | Use<'Account', MAccountSummaryBlocks> |
68 | PickWith<VideoChannelModel, 'Account', MAccountDefault> | ||
69 | 94 | ||
70 | export type MChannelActorAccountDefaultVideos = MChannelActorAccountDefault & MChannelVideos | 95 | export type MChannelAPI = MChannel & |
96 | Use<'Actor', MActorAPI> & | ||
97 | Use<'Account', MAccountAPI> | ||
diff --git a/server/typings/models/video/video-comment.ts b/server/typings/models/video/video-comment.ts index 675613804..187461213 100644 --- a/server/typings/models/video/video-comment.ts +++ b/server/typings/models/video/video-comment.ts | |||
@@ -1,29 +1,43 @@ | |||
1 | import { VideoCommentModel } from '../../../models/video/video-comment' | 1 | import { VideoCommentModel } from '../../../models/video/video-comment' |
2 | import { PickWith } from '../../utils' | 2 | import { PickWith } from '../../utils' |
3 | import { MAccountDefault } from '../account' | 3 | import { MAccountDefault } from '../account' |
4 | import { MVideoAccountDefault, MVideoAccountLight, MVideoFeed, MVideoIdUrl } from './video' | 4 | import { MVideoAccountLight, MVideoFeed, MVideoIdUrl } from './video' |
5 | |||
6 | type Use<K extends keyof VideoCommentModel, M> = PickWith<VideoCommentModel, K, M> | ||
7 | |||
8 | // ############################################################################ | ||
5 | 9 | ||
6 | export type MComment = Omit<VideoCommentModel, 'OriginVideoComment' | 'InReplyToVideoComment' | 'Video' | 'Account'> | 10 | export type MComment = Omit<VideoCommentModel, 'OriginVideoComment' | 'InReplyToVideoComment' | 'Video' | 'Account'> |
7 | export type MCommentId = Pick<MComment, 'id'> | 11 | export type MCommentId = Pick<MComment, 'id'> |
8 | 12 | ||
9 | export type MCommentAPI = MComment & { totalReplies: number } | 13 | // ############################################################################ |
10 | 14 | ||
11 | export type MCommentOwner = MComment & | 15 | export type MCommentOwner = MComment & |
12 | PickWith<VideoCommentModel, 'Account', MAccountDefault> | 16 | Use<'Account', MAccountDefault> |
13 | 17 | ||
14 | export type MCommentVideo = MComment & | 18 | export type MCommentVideo = MComment & |
15 | PickWith<VideoCommentModel, 'Video', MVideoAccountLight> | 19 | Use<'Video', MVideoAccountLight> |
16 | 20 | ||
17 | export type MCommentReply = MComment & | 21 | export type MCommentReply = MComment & |
18 | PickWith<VideoCommentModel, 'InReplyToVideoComment', MComment> | 22 | Use<'InReplyToVideoComment', MComment> |
23 | |||
24 | export type MCommentOwnerVideo = MComment & | ||
25 | Use<'Account', MAccountDefault> & | ||
26 | Use<'Video', MVideoAccountLight> | ||
19 | 27 | ||
20 | export type MCommentOwnerReply = MCommentOwner & MCommentReply | 28 | export type MCommentOwnerVideoReply = MComment & |
21 | export type MCommentOwnerVideo = MCommentOwner & MCommentVideo | 29 | Use<'Account', MAccountDefault> & |
22 | export type MCommentReplyVideo = MCommentReply & MCommentVideo | 30 | Use<'Video', MVideoAccountLight> & |
23 | export type MCommentOwnerVideoReply = MCommentOwnerVideo & MCommentReply | 31 | Use<'InReplyToVideoComment', MComment> |
24 | 32 | ||
25 | export type MCommentOwnerReplyVideoLight = MCommentOwnerReply & | 33 | export type MCommentOwnerReplyVideoLight = MComment & |
26 | PickWith<VideoCommentModel, 'Video', MVideoIdUrl> | 34 | Use<'Account', MAccountDefault> & |
35 | Use<'InReplyToVideoComment', MComment> & | ||
36 | Use<'Video', MVideoIdUrl> | ||
27 | 37 | ||
28 | export type MCommentOwnerVideoFeed = MCommentOwner & | 38 | export type MCommentOwnerVideoFeed = MCommentOwner & |
29 | PickWith<VideoCommentModel, 'Video', MVideoFeed> | 39 | Use<'Video', MVideoFeed> |
40 | |||
41 | // ############################################################################ | ||
42 | |||
43 | export type MCommentAPI = MComment & { totalReplies: number } | ||
diff --git a/server/typings/models/video/video-file.ts b/server/typings/models/video/video-file.ts index afa659d1f..484351a8d 100644 --- a/server/typings/models/video/video-file.ts +++ b/server/typings/models/video/video-file.ts | |||
@@ -3,13 +3,17 @@ import { PickWith, PickWithOpt } from '../../utils' | |||
3 | import { MVideo, MVideoUUID } from './video' | 3 | import { MVideo, MVideoUUID } from './video' |
4 | import { MVideoRedundancyFileUrl } from './video-redundancy' | 4 | import { MVideoRedundancyFileUrl } from './video-redundancy' |
5 | 5 | ||
6 | type Use<K extends keyof VideoFileModel, M> = PickWith<VideoFileModel, K, M> | ||
7 | |||
8 | // ############################################################################ | ||
9 | |||
6 | export type MVideoFile = Omit<VideoFileModel, 'Video' | 'RedundancyVideos'> | 10 | export type MVideoFile = Omit<VideoFileModel, 'Video' | 'RedundancyVideos'> |
7 | 11 | ||
8 | export type MVideoFileVideo = MVideoFile & | 12 | export type MVideoFileVideo = MVideoFile & |
9 | PickWith<VideoFileModel, 'Video', MVideo> | 13 | Use<'Video', MVideo> |
10 | 14 | ||
11 | export type MVideoFileVideoUUID = MVideoFile & | 15 | export type MVideoFileVideoUUID = MVideoFile & |
12 | PickWith<VideoFileModel, 'Video', MVideoUUID> | 16 | Use<'Video', MVideoUUID> |
13 | 17 | ||
14 | export type MVideoFileRedundanciesOpt = MVideoFile & | 18 | export type MVideoFileRedundanciesOpt = MVideoFile & |
15 | PickWithOpt<VideoFileModel, 'RedundancyVideos', MVideoRedundancyFileUrl[]> | 19 | PickWithOpt<VideoFileModel, 'RedundancyVideos', MVideoRedundancyFileUrl[]> |
diff --git a/server/typings/models/video/video-import.ts b/server/typings/models/video/video-import.ts index 51be900d6..ada723713 100644 --- a/server/typings/models/video/video-import.ts +++ b/server/typings/models/video/video-import.ts | |||
@@ -2,14 +2,23 @@ import { VideoImportModel } from '@server/models/video/video-import' | |||
2 | import { PickWith } from '@server/typings/utils' | 2 | import { PickWith } from '@server/typings/utils' |
3 | import { MUser, MVideo, MVideoAccountLight, MVideoTag, MVideoThumbnail, MVideoWithFile } from '@server/typings/models' | 3 | import { MUser, MVideo, MVideoAccountLight, MVideoTag, MVideoThumbnail, MVideoWithFile } from '@server/typings/models' |
4 | 4 | ||
5 | export type MVideoImport = Omit<VideoImportModel, 'User' | 'Video'> | 5 | type Use<K extends keyof VideoImportModel, M> = PickWith<VideoImportModel, K, M> |
6 | 6 | ||
7 | export type MVideoImportDefault = MVideoImport & | 7 | // ############################################################################ |
8 | PickWith<VideoImportModel, 'User', MUser> & | ||
9 | PickWith<VideoImportModel, 'Video', MVideoTag & MVideoAccountLight & MVideoThumbnail> | ||
10 | 8 | ||
11 | export type MVideoImportDefaultFiles = MVideoImportDefault & | 9 | export type MVideoImport = Omit<VideoImportModel, 'User' | 'Video'> |
12 | PickWith<VideoImportModel, 'Video', MVideoTag & MVideoAccountLight & MVideoThumbnail & MVideoWithFile> | ||
13 | 10 | ||
14 | export type MVideoImportVideo = MVideoImport & | 11 | export type MVideoImportVideo = MVideoImport & |
15 | PickWith<VideoImportModel, 'Video', MVideo> | 12 | Use<'Video', MVideo> |
13 | |||
14 | // ############################################################################ | ||
15 | |||
16 | type VideoAssociation = MVideoTag & MVideoAccountLight & MVideoThumbnail | ||
17 | |||
18 | export type MVideoImportDefault = MVideoImport & | ||
19 | Use<'User', MUser> & | ||
20 | Use<'Video', VideoAssociation> | ||
21 | |||
22 | export type MVideoImportDefaultFiles = MVideoImport & | ||
23 | Use<'User', MUser> & | ||
24 | Use<'Video', VideoAssociation & MVideoWithFile> | ||
diff --git a/server/typings/models/video/video-playlist-element.ts b/server/typings/models/video/video-playlist-element.ts index d1b8a18a0..5a039d7b1 100644 --- a/server/typings/models/video/video-playlist-element.ts +++ b/server/typings/models/video/video-playlist-element.ts | |||
@@ -2,14 +2,27 @@ import { VideoPlaylistElementModel } from '@server/models/video/video-playlist-e | |||
2 | import { PickWith } from '@server/typings/utils' | 2 | import { PickWith } from '@server/typings/utils' |
3 | import { MVideoPlaylistPrivacy, MVideoThumbnail, MVideoUrl } from '@server/typings/models' | 3 | import { MVideoPlaylistPrivacy, MVideoThumbnail, MVideoUrl } from '@server/typings/models' |
4 | 4 | ||
5 | type Use<K extends keyof VideoPlaylistElementModel, M> = PickWith<VideoPlaylistElementModel, K, M> | ||
6 | |||
7 | // ############################################################################ | ||
8 | |||
5 | export type MVideoPlaylistElement = Omit<VideoPlaylistElementModel, 'VideoPlaylist' | 'Video'> | 9 | export type MVideoPlaylistElement = Omit<VideoPlaylistElementModel, 'VideoPlaylist' | 'Video'> |
10 | |||
11 | // ############################################################################ | ||
12 | |||
6 | export type MVideoPlaylistElementId = Pick<MVideoPlaylistElement, 'id'> | 13 | export type MVideoPlaylistElementId = Pick<MVideoPlaylistElement, 'id'> |
7 | 14 | ||
8 | export type MVideoPlaylistElementLight = Pick<MVideoPlaylistElement, 'id' | 'videoId' | 'startTimestamp' | 'stopTimestamp'> | 15 | export type MVideoPlaylistElementLight = Pick<MVideoPlaylistElement, 'id' | 'videoId' | 'startTimestamp' | 'stopTimestamp'> |
9 | 16 | ||
17 | // ############################################################################ | ||
18 | |||
10 | export type MVideoPlaylistVideoThumbnail = MVideoPlaylistElement & | 19 | export type MVideoPlaylistVideoThumbnail = MVideoPlaylistElement & |
11 | PickWith<VideoPlaylistElementModel, 'Video', MVideoThumbnail> | 20 | Use<'Video', MVideoThumbnail> |
21 | |||
22 | // ############################################################################ | ||
23 | |||
24 | // For API | ||
12 | 25 | ||
13 | export type MVideoPlaylistAP = MVideoPlaylistElement & | 26 | export type MVideoPlaylistAP = MVideoPlaylistElement & |
14 | PickWith<VideoPlaylistElementModel, 'Video', MVideoUrl> & | 27 | Use<'Video', MVideoUrl> & |
15 | PickWith<VideoPlaylistElementModel, 'VideoPlaylist', MVideoPlaylistPrivacy> | 28 | Use<'VideoPlaylist', MVideoPlaylistPrivacy> |
diff --git a/server/typings/models/video/video-playlist.ts b/server/typings/models/video/video-playlist.ts index 825b3391c..633818405 100644 --- a/server/typings/models/video/video-playlist.ts +++ b/server/typings/models/video/video-playlist.ts | |||
@@ -5,38 +5,76 @@ import { MThumbnail } from './thumbnail' | |||
5 | import { MChannelDefault, MChannelSummary } from './video-channels' | 5 | import { MChannelDefault, MChannelSummary } from './video-channels' |
6 | import { MVideoPlaylistElementLight } from '@server/typings/models/video/video-playlist-element' | 6 | import { MVideoPlaylistElementLight } from '@server/typings/models/video/video-playlist-element' |
7 | 7 | ||
8 | type Use<K extends keyof VideoPlaylistModel, M> = PickWith<VideoPlaylistModel, K, M> | ||
9 | |||
10 | // ############################################################################ | ||
11 | |||
8 | export type MVideoPlaylist = Omit<VideoPlaylistModel, 'OwnerAccount' | 'VideoChannel' | 'VideoPlaylistElements' | 'Thumbnail'> | 12 | export type MVideoPlaylist = Omit<VideoPlaylistModel, 'OwnerAccount' | 'VideoChannel' | 'VideoPlaylistElements' | 'Thumbnail'> |
13 | |||
14 | // ############################################################################ | ||
15 | |||
9 | export type MVideoPlaylistId = Pick<MVideoPlaylist, 'id'> | 16 | export type MVideoPlaylistId = Pick<MVideoPlaylist, 'id'> |
10 | export type MVideoPlaylistPrivacy = Pick<MVideoPlaylist, 'privacy'> | 17 | export type MVideoPlaylistPrivacy = Pick<MVideoPlaylist, 'privacy'> |
18 | export type MVideoPlaylistUUID = Pick<MVideoPlaylist, 'uuid'> | ||
19 | export type MVideoPlaylistVideosLength = MVideoPlaylist & { videosLength: number } | ||
20 | |||
21 | // ############################################################################ | ||
22 | |||
23 | // With elements | ||
11 | 24 | ||
12 | export type MVideoPlaylistWithElements = MVideoPlaylist & | 25 | export type MVideoPlaylistWithElements = MVideoPlaylist & |
13 | PickWith<VideoPlaylistModel, 'VideoPlaylistElements', MVideoPlaylistElementLight[]> | 26 | Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]> |
14 | export type MVideoPlaylistIdWithElements = MVideoPlaylistId & MVideoPlaylistWithElements | ||
15 | 27 | ||
16 | export type MVideoPlaylistUUID = Pick<MVideoPlaylist, 'uuid'> | 28 | export type MVideoPlaylistIdWithElements = MVideoPlaylistId & |
29 | Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]> | ||
30 | |||
31 | // ############################################################################ | ||
32 | |||
33 | // With account | ||
17 | 34 | ||
18 | export type MVideoPlaylistOwner = MVideoPlaylist & | 35 | export type MVideoPlaylistOwner = MVideoPlaylist & |
19 | PickWith<VideoPlaylistModel, 'OwnerAccount', MAccount> | 36 | Use<'OwnerAccount', MAccount> |
20 | 37 | ||
21 | export type MVideoPlaylistOwnerDefault = MVideoPlaylist & | 38 | export type MVideoPlaylistOwnerDefault = MVideoPlaylist & |
22 | PickWith<VideoPlaylistModel, 'OwnerAccount', MAccountDefault> | 39 | Use<'OwnerAccount', MAccountDefault> |
40 | |||
41 | // ############################################################################ | ||
42 | |||
43 | // With thumbnail | ||
23 | 44 | ||
24 | export type MVideoPlaylistThumbnail = MVideoPlaylist & | 45 | export type MVideoPlaylistThumbnail = MVideoPlaylist & |
25 | PickWith<VideoPlaylistModel, 'Thumbnail', MThumbnail> | 46 | Use<'Thumbnail', MThumbnail> |
26 | 47 | ||
27 | export type MVideoPlaylistAccountThumbnail = MVideoPlaylistOwnerDefault & | 48 | export type MVideoPlaylistAccountThumbnail = MVideoPlaylist & |
28 | PickWith<VideoPlaylistModel, 'Thumbnail', MThumbnail> | 49 | Use<'OwnerAccount', MAccountDefault> & |
50 | Use<'Thumbnail', MThumbnail> | ||
29 | 51 | ||
30 | export type MVideoPlaylistAccountChannelSummary = MVideoPlaylist & | 52 | // ############################################################################ |
31 | PickWith<VideoPlaylistModel, 'OwnerAccount', MAccountSummary> & | 53 | |
32 | PickWith<VideoPlaylistModel, 'VideoChannel', MChannelSummary> | 54 | // With channel |
33 | 55 | ||
34 | export type MVideoPlaylistAccountChannelDefault = MVideoPlaylist & | 56 | export type MVideoPlaylistAccountChannelDefault = MVideoPlaylist & |
35 | PickWith<VideoPlaylistModel, 'OwnerAccount', MAccountDefault> & | 57 | Use<'OwnerAccount', MAccountDefault> & |
36 | PickWith<VideoPlaylistModel, 'VideoChannel', MChannelDefault> | 58 | Use<'VideoChannel', MChannelDefault> |
37 | 59 | ||
38 | export type MVideoPlaylistVideosLength = MVideoPlaylist & { videosLength: number } | 60 | // ############################################################################ |
39 | 61 | ||
40 | export type MVideoPlaylistFullSummary = MVideoPlaylistAccountChannelSummary & MVideoPlaylistThumbnail | 62 | // With all associations |
63 | |||
64 | export type MVideoPlaylistFull = MVideoPlaylist & | ||
65 | Use<'OwnerAccount', MAccountDefault> & | ||
66 | Use<'VideoChannel', MChannelDefault> & | ||
67 | Use<'Thumbnail', MThumbnail> | ||
68 | |||
69 | // ############################################################################ | ||
70 | |||
71 | // For API | ||
72 | |||
73 | export type MVideoPlaylistAccountChannelSummary = MVideoPlaylist & | ||
74 | Use<'OwnerAccount', MAccountSummary> & | ||
75 | Use<'VideoChannel', MChannelSummary> | ||
41 | 76 | ||
42 | export type MVideoPlaylistFull = MVideoPlaylist & MVideoPlaylistThumbnail & MVideoPlaylistAccountChannelDefault | 77 | export type MVideoPlaylistFullSummary = MVideoPlaylist & |
78 | Use<'Thumbnail', MThumbnail> & | ||
79 | Use<'OwnerAccount', MAccountSummary> & | ||
80 | Use<'VideoChannel', MChannelSummary> | ||
diff --git a/server/typings/models/video/video-rate.ts b/server/typings/models/video/video-rate.ts index 6eefe6362..fc9329993 100644 --- a/server/typings/models/video/video-rate.ts +++ b/server/typings/models/video/video-rate.ts | |||
@@ -2,11 +2,15 @@ import { AccountVideoRateModel } from '@server/models/account/account-video-rate | |||
2 | import { PickWith } from '@server/typings/utils' | 2 | import { PickWith } from '@server/typings/utils' |
3 | import { MAccountAudience, MAccountUrl, MVideo } from '..' | 3 | import { MAccountAudience, MAccountUrl, MVideo } from '..' |
4 | 4 | ||
5 | type Use<K extends keyof AccountVideoRateModel, M> = PickWith<AccountVideoRateModel, K, M> | ||
6 | |||
7 | // ############################################################################ | ||
8 | |||
5 | export type MAccountVideoRate = Omit<AccountVideoRateModel, 'Video' | 'Account'> | 9 | export type MAccountVideoRate = Omit<AccountVideoRateModel, 'Video' | 'Account'> |
6 | 10 | ||
7 | export type MAccountVideoRateAccountUrl = MAccountVideoRate & | 11 | export type MAccountVideoRateAccountUrl = MAccountVideoRate & |
8 | PickWith<AccountVideoRateModel, 'Account', MAccountUrl> | 12 | Use<'Account', MAccountUrl> |
9 | 13 | ||
10 | export type MAccountVideoRateAccountVideo = MAccountVideoRate & | 14 | export type MAccountVideoRateAccountVideo = MAccountVideoRate & |
11 | PickWith<AccountVideoRateModel, 'Account', MAccountAudience> & | 15 | Use<'Account', MAccountAudience> & |
12 | PickWith<AccountVideoRateModel, 'Video', MVideo> | 16 | Use<'Video', MVideo> |
diff --git a/server/typings/models/video/video-redundancy.ts b/server/typings/models/video/video-redundancy.ts index ec61bfb68..c25eb9c09 100644 --- a/server/typings/models/video/video-redundancy.ts +++ b/server/typings/models/video/video-redundancy.ts | |||
@@ -2,17 +2,25 @@ import { VideoRedundancyModel } from '../../../models/redundancy/video-redundanc | |||
2 | import { PickWith } from '@server/typings/utils' | 2 | import { PickWith } from '@server/typings/utils' |
3 | import { MStreamingPlaylistVideo, MVideoFile, MVideoFileVideo } from '@server/typings/models' | 3 | import { MStreamingPlaylistVideo, MVideoFile, MVideoFileVideo } from '@server/typings/models' |
4 | 4 | ||
5 | type Use<K extends keyof VideoRedundancyModel, M> = PickWith<VideoRedundancyModel, K, M> | ||
6 | |||
7 | // ############################################################################ | ||
8 | |||
5 | export type MVideoRedundancy = Omit<VideoRedundancyModel, 'VideoFile' | 'VideoStreamingPlaylist' | 'Actor'> | 9 | export type MVideoRedundancy = Omit<VideoRedundancyModel, 'VideoFile' | 'VideoStreamingPlaylist' | 'Actor'> |
6 | 10 | ||
7 | export type MVideoRedundancyFileUrl = Pick<MVideoRedundancy, 'fileUrl'> | 11 | export type MVideoRedundancyFileUrl = Pick<MVideoRedundancy, 'fileUrl'> |
8 | 12 | ||
13 | // ############################################################################ | ||
14 | |||
9 | export type MVideoRedundancyFile = MVideoRedundancy & | 15 | export type MVideoRedundancyFile = MVideoRedundancy & |
10 | PickWith<VideoRedundancyModel, 'VideoFile', MVideoFile> | 16 | Use<'VideoFile', MVideoFile> |
11 | 17 | ||
12 | export type MVideoRedundancyFileVideo = MVideoRedundancy & | 18 | export type MVideoRedundancyFileVideo = MVideoRedundancy & |
13 | PickWith<VideoRedundancyModel, 'VideoFile', MVideoFileVideo> | 19 | Use<'VideoFile', MVideoFileVideo> |
14 | 20 | ||
15 | export type MVideoRedundancyStreamingPlaylistVideo = MVideoRedundancy & | 21 | export type MVideoRedundancyStreamingPlaylistVideo = MVideoRedundancy & |
16 | PickWith<VideoRedundancyModel, 'VideoStreamingPlaylist', MStreamingPlaylistVideo> | 22 | Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo> |
17 | 23 | ||
18 | export type MVideoRedundancyVideo = MVideoRedundancyFileVideo | MVideoRedundancyStreamingPlaylistVideo | 24 | export type MVideoRedundancyVideo = MVideoRedundancy & |
25 | Use<'VideoFile', MVideoFileVideo> & | ||
26 | Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo> | ||
diff --git a/server/typings/models/video/video-share.ts b/server/typings/models/video/video-share.ts index 7e8cb8b61..a7a90beeb 100644 --- a/server/typings/models/video/video-share.ts +++ b/server/typings/models/video/video-share.ts | |||
@@ -3,10 +3,15 @@ import { PickWith } from '../../utils' | |||
3 | import { MActorDefault } from '../account' | 3 | import { MActorDefault } from '../account' |
4 | import { MVideo } from './video' | 4 | import { MVideo } from './video' |
5 | 5 | ||
6 | type Use<K extends keyof VideoShareModel, M> = PickWith<VideoShareModel, K, M> | ||
7 | |||
8 | // ############################################################################ | ||
9 | |||
6 | export type MVideoShare = Omit<VideoShareModel, 'Actor' | 'Video'> | 10 | export type MVideoShare = Omit<VideoShareModel, 'Actor' | 'Video'> |
7 | 11 | ||
8 | export type MVideoShareActor = MVideoShare & | 12 | export type MVideoShareActor = MVideoShare & |
9 | PickWith<VideoShareModel, 'Actor', MActorDefault> | 13 | Use<'Actor', MActorDefault> |
10 | 14 | ||
11 | export type MVideoShareFull = MVideoShareActor & | 15 | export type MVideoShareFull = MVideoShare & |
12 | PickWith<VideoShareModel, 'Video', MVideo> | 16 | Use<'Actor', MActorDefault> & |
17 | Use<'Video', MVideo> | ||
diff --git a/server/typings/models/video/video-streaming-playlist.ts b/server/typings/models/video/video-streaming-playlist.ts index 5b6310771..f1b3438b6 100644 --- a/server/typings/models/video/video-streaming-playlist.ts +++ b/server/typings/models/video/video-streaming-playlist.ts | |||
@@ -3,10 +3,14 @@ import { PickWith } from '../../utils' | |||
3 | import { MVideoRedundancyFileUrl } from './video-redundancy' | 3 | import { MVideoRedundancyFileUrl } from './video-redundancy' |
4 | import { MVideo } from '@server/typings/models' | 4 | import { MVideo } from '@server/typings/models' |
5 | 5 | ||
6 | type Use<K extends keyof VideoStreamingPlaylistModel, M> = PickWith<VideoStreamingPlaylistModel, K, M> | ||
7 | |||
8 | // ############################################################################ | ||
9 | |||
6 | export type MStreamingPlaylist = Omit<VideoStreamingPlaylistModel, 'Video' | 'RedundancyVideos'> | 10 | export type MStreamingPlaylist = Omit<VideoStreamingPlaylistModel, 'Video' | 'RedundancyVideos'> |
7 | 11 | ||
8 | export type MStreamingPlaylistVideo = MStreamingPlaylist & | 12 | export type MStreamingPlaylistVideo = MStreamingPlaylist & |
9 | PickWith<VideoStreamingPlaylistModel, 'Video', MVideo> | 13 | Use<'Video', MVideo> |
10 | 14 | ||
11 | export type MStreamingPlaylistRedundancies = MStreamingPlaylist & | 15 | export type MStreamingPlaylistRedundancies = MStreamingPlaylist & |
12 | PickWith<VideoStreamingPlaylistModel, 'RedundancyVideos', MVideoRedundancyFileUrl[]> | 16 | Use<'RedundancyVideos', MVideoRedundancyFileUrl[]> |
diff --git a/server/typings/models/video/video.ts b/server/typings/models/video/video.ts index 0ffd0c302..914eb7f57 100644 --- a/server/typings/models/video/video.ts +++ b/server/typings/models/video/video.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { VideoModel } from '../../../models/video/video' | 1 | import { VideoModel } from '../../../models/video/video' |
2 | import { PickWith, PickWithOpt } from '../../utils' | 2 | import { PickWith, PickWithOpt } from '../../utils' |
3 | import { MChannelAccountLight, MChannelActor, MChannelActorAccountDefault, MChannelUserId } from './video-channels' | 3 | import { MChannelAccountDefault, MChannelAccountLight, MChannelActor, MChannelUserId } from './video-channels' |
4 | import { MTag } from './tag' | 4 | import { MTag } from './tag' |
5 | import { MVideoCaptionLanguage } from './video-caption' | 5 | import { MVideoCaptionLanguage } from './video-caption' |
6 | import { MStreamingPlaylist, MStreamingPlaylistRedundancies } from './video-streaming-playlist' | 6 | import { MStreamingPlaylist, MStreamingPlaylistRedundancies } from './video-streaming-playlist' |
@@ -10,10 +10,16 @@ import { MVideoBlacklistLight, MVideoBlacklistUnfederated } from './video-blackl | |||
10 | import { MScheduleVideoUpdate } from './schedule-video-update' | 10 | import { MScheduleVideoUpdate } from './schedule-video-update' |
11 | import { MUserVideoHistoryTime } from '../user/user-video-history' | 11 | import { MUserVideoHistoryTime } from '../user/user-video-history' |
12 | 12 | ||
13 | type Use<K extends keyof VideoModel, M> = PickWith<VideoModel, K, M> | ||
14 | |||
15 | // ############################################################################ | ||
16 | |||
13 | export type MVideo = Omit<VideoModel, 'VideoChannel' | 'Tags' | 'Thumbnails' | 'VideoPlaylistElements' | 'VideoAbuses' | | 17 | export type MVideo = Omit<VideoModel, 'VideoChannel' | 'Tags' | 'Thumbnails' | 'VideoPlaylistElements' | 'VideoAbuses' | |
14 | 'VideoFiles' | 'VideoStreamingPlaylists' | 'VideoShares' | 'AccountVideoRates' | 'VideoComments' | 'VideoViews' | 'UserVideoHistories' | | 18 | 'VideoFiles' | 'VideoStreamingPlaylists' | 'VideoShares' | 'AccountVideoRates' | 'VideoComments' | 'VideoViews' | 'UserVideoHistories' | |
15 | 'ScheduleVideoUpdate' | 'VideoBlacklist' | 'VideoImport' | 'VideoCaptions'> | 19 | 'ScheduleVideoUpdate' | 'VideoBlacklist' | 'VideoImport' | 'VideoCaptions'> |
16 | 20 | ||
21 | // ############################################################################ | ||
22 | |||
17 | export type MVideoId = Pick<MVideo, 'id'> | 23 | export type MVideoId = Pick<MVideo, 'id'> |
18 | export type MVideoUrl = Pick<MVideo, 'url'> | 24 | export type MVideoUrl = Pick<MVideo, 'url'> |
19 | export type MVideoUUID = Pick<MVideo, 'uuid'> | 25 | export type MVideoUUID = Pick<MVideo, 'uuid'> |
@@ -21,83 +27,120 @@ export type MVideoUUID = Pick<MVideo, 'uuid'> | |||
21 | export type MVideoIdUrl = MVideoId & MVideoUrl | 27 | export type MVideoIdUrl = MVideoId & MVideoUrl |
22 | export type MVideoFeed = Pick<MVideo, 'name' | 'uuid'> | 28 | export type MVideoFeed = Pick<MVideo, 'name' | 'uuid'> |
23 | 29 | ||
30 | // ############################################################################ | ||
31 | |||
32 | // Video raw associations: schedules, video files, tags, thumbnails, captions, streaming playlists | ||
33 | |||
34 | // "With" to not confuse with the VideoFile model | ||
24 | export type MVideoWithFile = MVideo & | 35 | export type MVideoWithFile = MVideo & |
25 | PickWith<VideoModel, 'VideoFiles', MVideoFile[]> | 36 | Use<'VideoFiles', MVideoFile[]> |
26 | 37 | ||
27 | export type MVideoThumbnail = MVideo & | 38 | export type MVideoThumbnail = MVideo & |
28 | PickWith<VideoModel, 'Thumbnails', MThumbnail[]> | 39 | Use<'Thumbnails', MThumbnail[]> |
29 | export type MVideoIdThumbnail = MVideoThumbnail & MVideoId | 40 | |
41 | export type MVideoIdThumbnail = MVideoId & | ||
42 | Use<'Thumbnails', MThumbnail[]> | ||
43 | |||
44 | export type MVideoWithFileThumbnail = MVideo & | ||
45 | Use<'VideoFiles', MVideoFile[]> & | ||
46 | Use<'Thumbnails', MThumbnail[]> | ||
30 | 47 | ||
31 | export type MVideoTag = MVideo & | 48 | export type MVideoTag = MVideo & |
32 | PickWith<VideoModel, 'Tags', MTag[]> | 49 | Use<'Tags', MTag[]> |
33 | 50 | ||
34 | export type MVideoWithSchedule = MVideo & | 51 | export type MVideoWithSchedule = MVideo & |
35 | PickWithOpt<VideoModel, 'ScheduleVideoUpdate', MScheduleVideoUpdate> | 52 | PickWithOpt<VideoModel, 'ScheduleVideoUpdate', MScheduleVideoUpdate> |
36 | 53 | ||
37 | export type MVideoWithFileThumbnail = MVideoWithFile & MVideoThumbnail | 54 | export type MVideoWithCaptions = MVideo & |
55 | Use<'VideoCaptions', MVideoCaptionLanguage[]> | ||
38 | 56 | ||
39 | export type MVideoUser = MVideo & | 57 | export type MVideoWithStreamingPlaylist = MVideo & |
40 | PickWith<VideoModel, 'VideoChannel', MChannelUserId> | 58 | Use<'VideoStreamingPlaylists', MStreamingPlaylist[]> |
41 | 59 | ||
42 | export type MVideoWithCaptions = MVideo & | 60 | // ############################################################################ |
43 | PickWith<VideoModel, 'VideoCaptions', MVideoCaptionLanguage[]> | 61 | |
62 | // Associations with not all their attributes | ||
63 | |||
64 | export type MVideoUserHistory = MVideo & | ||
65 | Use<'UserVideoHistories', MUserVideoHistoryTime[]> | ||
44 | 66 | ||
45 | export type MVideoWithBlacklistLight = MVideo & | 67 | export type MVideoWithBlacklistLight = MVideo & |
46 | PickWith<VideoModel, 'VideoBlacklist', MVideoBlacklistLight> | 68 | Use<'VideoBlacklist', MVideoBlacklistLight> |
47 | 69 | ||
48 | export type MVideoAccountLight = MVideo & | 70 | export type MVideoAccountLight = MVideo & |
49 | PickWith<VideoModel, 'VideoChannel', MChannelAccountLight> | 71 | Use<'VideoChannel', MChannelAccountLight> |
50 | 72 | ||
51 | export type MVideoWithRights = MVideoWithBlacklistLight & MVideoThumbnail & MVideoUser | 73 | export type MVideoWithRights = MVideo & |
74 | Use<'VideoBlacklist', MVideoBlacklistLight> & | ||
75 | Use<'Thumbnails', MThumbnail[]> & | ||
76 | Use<'VideoChannel', MChannelUserId> | ||
52 | 77 | ||
53 | export type MVideoWithStreamingPlaylist = MVideo & | 78 | // ############################################################################ |
54 | PickWith<VideoModel, 'VideoStreamingPlaylists', MStreamingPlaylist[]> | ||
55 | 79 | ||
56 | export type MVideoWithAllFiles = MVideoWithFileThumbnail & MVideoWithStreamingPlaylist | 80 | // All files with some additional associations |
57 | 81 | ||
58 | export type MVideoAccountAllFiles = MVideoWithAllFiles & MVideoAccountLight & MVideoWithBlacklistLight | 82 | export type MVideoWithAllFiles = MVideo & |
59 | export type MVideoAccountAllFilesCaptions = MVideoAccountAllFiles & MVideoWithCaptions | 83 | Use<'VideoFiles', MVideoFile[]> & |
84 | Use<'Thumbnails', MThumbnail[]> & | ||
85 | Use<'VideoStreamingPlaylists', MStreamingPlaylist[]> | ||
60 | 86 | ||
61 | export type MVideoUserHistory = MVideo & | 87 | export type MVideoAccountLightBlacklistAllFiles = MVideo & |
62 | PickWith<VideoModel, 'UserVideoHistories', MUserVideoHistoryTime[]> | 88 | Use<'VideoFiles', MVideoFile[]> & |
89 | Use<'Thumbnails', MThumbnail[]> & | ||
90 | Use<'VideoStreamingPlaylists', MStreamingPlaylist[]> & | ||
91 | Use<'VideoChannel', MChannelAccountLight> & | ||
92 | Use<'VideoBlacklist', MVideoBlacklistLight> | ||
63 | 93 | ||
64 | export type MVideoWithBlacklistThumbnailScheduled = MVideoWithSchedule & MVideoWithBlacklistLight & MVideoWithFileThumbnail | 94 | // ############################################################################ |
95 | |||
96 | // With account | ||
65 | 97 | ||
66 | export type MVideoAccountDefault = MVideo & | 98 | export type MVideoAccountDefault = MVideo & |
67 | PickWith<VideoModel, 'VideoChannel', MChannelActorAccountDefault> | 99 | Use<'VideoChannel', MChannelAccountDefault> |
68 | 100 | ||
69 | export type MVideoThumbnailAccountDefault = MVideoThumbnail & | 101 | export type MVideoThumbnailAccountDefault = MVideo & |
70 | PickWith<VideoModel, 'VideoChannel', MChannelActorAccountDefault> | 102 | Use<'Thumbnails', MThumbnail[]> & |
103 | Use<'VideoChannel', MChannelAccountDefault> | ||
71 | 104 | ||
72 | export type MVideoWithChannelActor = MVideo & | 105 | export type MVideoWithChannelActor = MVideo & |
73 | PickWith<VideoModel, 'VideoChannel', MChannelActor> | 106 | Use<'VideoChannel', MChannelActor> |
74 | 107 | ||
75 | export type MVideoFullLight = MVideoThumbnail & | 108 | export type MVideoFullLight = MVideo & |
76 | MVideoWithBlacklistLight & | 109 | Use<'Thumbnails', MThumbnail[]> & |
77 | MVideoTag & | 110 | Use<'VideoBlacklist', MVideoBlacklistLight> & |
78 | MVideoAccountLight & | 111 | Use<'Tags', MTag[]> & |
79 | MVideoUserHistory & | 112 | Use<'VideoChannel', MChannelAccountLight> & |
80 | MVideoWithFile & | 113 | Use<'UserVideoHistories', MUserVideoHistoryTime[]> & |
81 | MVideoWithSchedule & | 114 | Use<'VideoFiles', MVideoFile[]> & |
82 | MVideoWithStreamingPlaylist & | 115 | Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> & |
83 | MVideoUserHistory | 116 | Use<'VideoStreamingPlaylists', MStreamingPlaylist[]> |
117 | |||
118 | // ############################################################################ | ||
119 | |||
120 | // API | ||
84 | 121 | ||
85 | export type MVideoAP = MVideo & | 122 | export type MVideoAP = MVideo & |
86 | MVideoTag & | 123 | Use<'Tags', MTag[]> & |
87 | MVideoAccountLight & | 124 | Use<'VideoChannel', MChannelAccountLight> & |
88 | MVideoWithStreamingPlaylist & | 125 | Use<'VideoStreamingPlaylists', MStreamingPlaylist[]> & |
89 | MVideoWithCaptions & | 126 | Use<'VideoCaptions', MVideoCaptionLanguage[]> & |
90 | PickWith<VideoModel, 'VideoBlacklist', MVideoBlacklistUnfederated> & | 127 | Use<'VideoBlacklist', MVideoBlacklistUnfederated> & |
91 | PickWith<VideoModel, 'VideoFiles', MVideoFileRedundanciesOpt[]> | 128 | Use<'VideoFiles', MVideoFileRedundanciesOpt[]> |
92 | 129 | ||
93 | export type MVideoAPWithoutCaption = Omit<MVideoAP, 'VideoCaptions'> | 130 | export type MVideoAPWithoutCaption = Omit<MVideoAP, 'VideoCaptions'> |
94 | 131 | ||
95 | export type MVideoDetails = MVideo & | 132 | export type MVideoDetails = MVideo & |
96 | MVideoWithBlacklistLight & | 133 | Use<'VideoBlacklist', MVideoBlacklistLight> & |
97 | MVideoTag & | 134 | Use<'Tags', MTag[]> & |
98 | MVideoAccountLight & | 135 | Use<'VideoChannel', MChannelAccountLight> & |
99 | MVideoWithSchedule & | 136 | Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> & |
100 | MVideoThumbnail & | 137 | Use<'Thumbnails', MThumbnail[]> & |
101 | MVideoUserHistory & | 138 | Use<'UserVideoHistories', MUserVideoHistoryTime[]> & |
102 | PickWith<VideoModel, 'VideoStreamingPlaylists', MStreamingPlaylistRedundancies[]> & | 139 | Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundancies[]> & |
103 | PickWith<VideoModel, 'VideoFiles', MVideoFileRedundanciesOpt[]> | 140 | Use<'VideoFiles', MVideoFileRedundanciesOpt[]> |
141 | |||
142 | export type MVideoForUser = MVideo & | ||
143 | Use<'VideoChannel', MChannelAccountDefault> & | ||
144 | Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> & | ||
145 | Use<'VideoBlacklist', MVideoBlacklistLight> & | ||
146 | Use<'Thumbnails', MThumbnail[]> | ||