aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/typings/models
diff options
context:
space:
mode:
Diffstat (limited to 'server/typings/models')
-rw-r--r--server/typings/models/account/account-blocklist.ts10
-rw-r--r--server/typings/models/account/account.ts69
-rw-r--r--server/typings/models/account/actor-follow.ts56
-rw-r--r--server/typings/models/account/actor.ts93
-rw-r--r--server/typings/models/index.d.ts1
-rw-r--r--server/typings/models/oauth/index.d.ts2
-rw-r--r--server/typings/models/oauth/oauth-token.ts6
-rw-r--r--server/typings/models/server/server-blocklist.ts10
-rw-r--r--server/typings/models/server/server.ts8
-rw-r--r--server/typings/models/user/index.d.ts1
-rw-r--r--server/typings/models/user/user-notification.ts26
-rw-r--r--server/typings/models/user/user.ts49
-rw-r--r--server/typings/models/video/index.d.ts4
-rw-r--r--server/typings/models/video/video-abuse.ts14
-rw-r--r--server/typings/models/video/video-blacklist.ts8
-rw-r--r--server/typings/models/video/video-caption.ts8
-rw-r--r--server/typings/models/video/video-change-ownership.ts10
-rw-r--r--server/typings/models/video/video-channels.ts95
-rw-r--r--server/typings/models/video/video-comment.ts38
-rw-r--r--server/typings/models/video/video-file.ts8
-rw-r--r--server/typings/models/video/video-import.ts23
-rw-r--r--server/typings/models/video/video-playlist-element.ts19
-rw-r--r--server/typings/models/video/video-playlist.ts70
-rw-r--r--server/typings/models/video/video-rate.ts10
-rw-r--r--server/typings/models/video/video-redundancy.ts16
-rw-r--r--server/typings/models/video/video-share.ts11
-rw-r--r--server/typings/models/video/video-streaming-playlist.ts8
-rw-r--r--server/typings/models/video/video.ts141
28 files changed, 571 insertions, 243 deletions
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
2import { PickWith } from '../../utils' 2import { PickWith } from '../../utils'
3import { MAccountDefault } from './account' 3import { MAccountDefault } from './account'
4 4
5type Use<K extends keyof AccountBlocklistModel, M> = PickWith<AccountBlocklistModel, K, M>
6
7// ############################################################################
8
5export type MAccountBlocklist = Omit<AccountBlocklistModel, 'ByAccount' | 'BlockedAccount'> 9export type MAccountBlocklist = Omit<AccountBlocklistModel, 'ByAccount' | 'BlockedAccount'>
6 10
11// ############################################################################
12
7export type MAccountBlocklistId = Pick<AccountBlocklistModel, 'id'> 13export type MAccountBlocklistId = Pick<AccountBlocklistModel, 'id'>
8 14
9export type MAccountBlocklistAccounts = MAccountBlocklist & 15export 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'
14import { MAccountBlocklistId } from './account-blocklist' 15import { MAccountBlocklistId } from './account-blocklist'
15import { MChannelDefault } from '@server/typings/models' 16import { MChannelDefault } from '@server/typings/models'
16 17
17export type MAccountId = Pick<AccountModel, 'id'> 18type Use<K extends keyof AccountModel, M> = PickWith<AccountModel, K, M>
18export type MAccountIdActor = MAccountId & 19
19 PickWith<AccountModel, 'Actor', MActorAccountChannelId> 20// ############################################################################
20export type MAccountIdActorId = MAccountId &
21 PickWith<AccountModel, 'Actor', MActorId>
22 21
23export type MAccount = Omit<AccountModel, 'Actor' | 'User' | 'Application' | 'VideoChannels' | 'VideoPlaylists' | 22export type MAccount = Omit<AccountModel, 'Actor' | 'User' | 'Application' | 'VideoChannels' | 'VideoPlaylists' |
24 'VideoComments' | 'BlockedAccounts'> 23 'VideoComments' | 'BlockedAccounts'>
25 24
25// ############################################################################
26
27// Only some attributes
28export type MAccountId = Pick<MAccount, 'id'>
29export type MAccountUserId = Pick<MAccount, 'userId'>
30
31// Only some Actor attributes
32export type MAccountUrl = Use<'Actor', MActorUrl>
33export type MAccountAudience = Use<'Actor', MActorAudience>
34
35export type MAccountIdActor = MAccountId &
36 Use<'Actor', MActorAccountChannelId>
37
38export type MAccountIdActorId = MAccountId &
39 Use<'Actor', MActorId>
40
41// ############################################################################
42
26// Default scope 43// Default scope
27export type MAccountDefault = MAccount & 44export type MAccountDefault = MAccount &
28 PickWith<AccountModel, 'Actor', MActorDefault> 45 Use<'Actor', MActorDefault>
29 46
30export type MAccountDefaultChannelDefault = MAccountDefault & 47// Default with default association scopes
31 PickWith<AccountModel, 'VideoChannels', MChannelDefault[]> 48export type MAccountDefaultChannelDefault = MAccount &
49 Use<'Actor', MActorDefault> &
50 Use<'VideoChannels', MChannelDefault[]>
32 51
52// We don't need some actors attributes
33export type MAccountLight = MAccount & 53export type MAccountLight = MAccount &
34 PickWith<AccountModel, 'Actor', MActorDefaultLight> 54 Use<'Actor', MActorDefaultLight>
35 55
36export type MAccountUserId = Pick<MAccount, 'userId'> 56// ############################################################################
37 57
58// Full actor
38export type MAccountActor = MAccount & 59export type MAccountActor = MAccount &
39 PickWith<AccountModel, 'Actor', MActor> 60 Use<'Actor', MActor>
40export type MAccountServer = MAccountActor &
41 PickWith<AccountModel, 'Actor', MActorServer>
42 61
43export type MAccountActorDefault = MAccount & 62// Full actor with server
44 PickWith<AccountModel, 'Actor', MActorDefault> 63export type MAccountServer = MAccount &
64 Use<'Actor', MActorServer>
45 65
46export type MAccountSummary = Pick<MAccount, 'id' | 'name'> & 66// ############################################################################
47 PickWith<AccountModel, 'Actor', MActorSummary>
48 67
49export type MAccountBlocks = MAccountSummary & 68// For API
50 PickWith<AccountModel, 'BlockedAccounts', MAccountBlocklistId[]> 69
70export type MAccountSummary = Pick<MAccount, 'id' | 'name'> &
71 Use<'Actor', MActorSummary>
51 72
52export type MAccountAPI = MAccountDefault & 73export type MAccountSummaryBlocks = MAccountSummary &
53 PickWith<AccountModel, 'Actor', MActorAPI> 74 Use<'BlockedAccounts', MAccountBlocklistId[]>
54 75
55export type MAccountUrl = PickWith<AccountModel, 'Actor', MActorUrl> 76export type MAccountAPI = MAccount &
56export 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 @@
1import { ActorFollowModel } from '../../../models/activitypub/actor-follow' 1import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
2import { MActor, MActorAccountChannel, MActorChannel, MActorChannelAccount, MActorDefault, MActorHost, MActorUsername } from './actor' 2import {
3 MActor,
4 MActorAccount,
5 MActorAccountChannel,
6 MActorChannel,
7 MActorChannelAccountActor,
8 MActorDefault,
9 MActorHost,
10 MActorUsername
11} from './actor'
3import { PickWith } from '../../utils' 12import { PickWith } from '../../utils'
13import { ActorModel } from '@server/models/activitypub/actor'
14
15type Use<K extends keyof ActorFollowModel, M> = PickWith<ActorFollowModel, K, M>
16
17// ############################################################################
4 18
5export type MActorFollow = Omit<ActorFollowModel, 'ActorFollower' | 'ActorFollowing'> 19export type MActorFollow = Omit<ActorFollowModel, 'ActorFollower' | 'ActorFollowing'>
6 20
21// ############################################################################
22
23export type MActorFollowFollowingHost = MActorFollow &
24 Use<'ActorFollowing', MActorUsername & MActorHost>
25
26// ############################################################################
27
28// With actors or actors default
29
7export type MActorFollowActors = MActorFollow & 30export type MActorFollowActors = MActorFollow &
8 PickWith<ActorFollowModel, 'ActorFollower', MActor> & 31 Use<'ActorFollower', MActor> &
9 PickWith<ActorFollowModel, 'ActorFollowing', MActor> 32 Use<'ActorFollowing', MActor>
10 33
11export type MActorFollowActorsDefault = MActorFollow & 34export type MActorFollowActorsDefault = MActorFollow &
12 PickWith<ActorFollowModel, 'ActorFollower', MActorDefault> & 35 Use<'ActorFollower', MActorDefault> &
13 PickWith<ActorFollowModel, 'ActorFollowing', MActorDefault> 36 Use<'ActorFollowing', MActorDefault>
14
15export type MActorFollowActorsDefaultSubscription = MActorFollow &
16 PickWith<ActorFollowModel, 'ActorFollower', MActorDefault> &
17 PickWith<ActorFollowModel, 'ActorFollowing', MActorDefault & MActorChannel>
18 37
19export type MActorFollowFull = MActorFollow & 38export type MActorFollowFull = MActorFollow &
20 PickWith<ActorFollowModel, 'ActorFollower', MActorAccountChannel> & 39 Use<'ActorFollower', MActorAccountChannel> &
21 PickWith<ActorFollowModel, 'ActorFollowing', MActorAccountChannel> 40 Use<'ActorFollowing', MActorAccountChannel>
22 41
23export type MActorFollowFollowingHost = MActorFollow & 42// ############################################################################
24 PickWith<ActorFollowModel, 'ActorFollowing', MActorUsername & MActorHost> 43
44// For subscriptions
45
46export type MActorFollowActorsDefaultSubscription = MActorFollow &
47 Use<'ActorFollower', MActorDefault> &
48 Use<'ActorFollowing', MActorDefault & MActorChannel>
49
50export type MActorFollowFollowingFullFollowerAccount = MActorFollow &
51 Use<'ActorFollower', MActorAccount> &
52 Use<'ActorFollowing', MActorAccountChannel>
25 53
26export type MActorFollowSubscriptions = MActorFollow & 54export 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 @@
1import { ActorModel } from '../../../models/activitypub/actor' 1import { ActorModel } from '../../../models/activitypub/actor'
2import { PickWith } from '../../utils' 2import { PickWith } from '../../utils'
3import { MAccount, MAccountActorDefault, MAccountId, MAccountIdActor } from './account' 3import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from './account'
4import { MServerHost, MServerHostBlocks, MServer } from '../server' 4import { MServer, MServerHost, MServerHostBlocks } from '../server'
5import { MAvatar } from './avatar' 5import { MAvatar } from './avatar'
6import { MChannel, MChannelAccountActor, MChannelActorAccountDefault, MChannelId, MChannelIdActor } from '../video' 6import { MChannel, MChannelAccountActor, MChannelAccountDefault, MChannelId, MChannelIdActor } from '../video'
7
8type Use<K extends keyof ActorModel, M> = PickWith<ActorModel, K, M>
9
10// ############################################################################
7 11
8export type MActor = Omit<ActorModel, 'Account' | 'VideoChannel' | 'ActorFollowing' | 'Avatar' | 'ActorFollowers' | 'Server'> 12export type MActor = Omit<ActorModel, 'Account' | 'VideoChannel' | 'ActorFollowing' | 'Avatar' | 'ActorFollowers' | 'Server'>
9 13
14// ############################################################################
15
10export type MActorUrl = Pick<MActor, 'url'> 16export type MActorUrl = Pick<MActor, 'url'>
11export type MActorId = Pick<MActor, 'id'> 17export type MActorId = Pick<MActor, 'id'>
12export type MActorUsername = Pick<MActor, 'preferredUsername'> 18export type MActorUsername = Pick<MActor, 'preferredUsername'>
13export type MActorHost = PickWith<ActorModel, 'Server', MServerHost>
14 19
15export type MActorFollowersUrl = Pick<MActor, 'followersUrl'> 20export type MActorFollowersUrl = Pick<MActor, 'followersUrl'>
16export type MActorAudience = MActorUrl & MActorFollowersUrl 21export type MActorAudience = MActorUrl & MActorFollowersUrl
22export type MActorFollowerException = Pick<ActorModel, 'sharedInboxUrl' | 'inboxUrl'>
23export type MActorSignature = MActorAccountChannelId
17 24
18export type MActorLight = Omit<MActor, 'privateKey' | 'privateKey'> 25export type MActorLight = Omit<MActor, 'privateKey' | 'privateKey'>
19 26
27// ############################################################################
28
29// Some association attributes
30
31export type MActorHost = Use<'Server', MServerHost>
32
20export type MActorDefaultLight = MActorLight & 33export type MActorDefaultLight = MActorLight &
21 MActorHost & 34 Use<'Server', MServerHost> &
22 PickWith<ActorModel, 'Avatar', MAvatar> 35 Use<'Avatar', MAvatar>
23 36
24export type MActorAccountId = MActor & 37export type MActorAccountId = MActor &
25 PickWith<ActorModel, 'Account', MAccountId> 38 Use<'Account', MAccountId>
26export type MActorAccountIdActor = MActor & 39export type MActorAccountIdActor = MActor &
27 PickWith<ActorModel, 'Account', MAccountIdActor> 40 Use<'Account', MAccountIdActor>
28 41
29export type MActorChannelId = MActor & 42export type MActorChannelId = MActor &
30 PickWith<ActorModel, 'VideoChannel', MChannelId> 43 Use<'VideoChannel', MChannelId>
31export type MActorChannelIdActor = MActor & 44export type MActorChannelIdActor = MActor &
32 PickWith<ActorModel, 'VideoChannel', MChannelIdActor> 45 Use<'VideoChannel', MChannelIdActor>
33 46
34export type MActorAccountChannelId = MActorAccountId & MActorChannelId 47export type MActorAccountChannelId = MActorAccountId & MActorChannelId
35export type MActorAccountChannelIdActor = MActorAccountIdActor & MActorChannelIdActor 48export type MActorAccountChannelIdActor = MActorAccountIdActor & MActorChannelIdActor
36 49
50// ############################################################################
51
52// Include raw account/channel/server
53
37export type MActorAccount = MActor & 54export type MActorAccount = MActor &
38 PickWith<ActorModel, 'Account', MAccount> 55 Use<'Account', MAccount>
39 56
40export type MActorChannel = MActor & 57export type MActorChannel = MActor &
41 PickWith<ActorModel, 'VideoChannel', MChannel> 58 Use<'VideoChannel', MChannel>
42 59
43export type MActorAccountChannel = MActorAccount & MActorChannel 60export type MActorAccountChannel = MActorAccount & MActorChannel
44 61
45export type MActorChannelAccount = MActor &
46 PickWith<ActorModel, 'VideoChannel', MChannelAccountActor>
47
48export type MActorServer = MActor & 62export type MActorServer = MActor &
49 PickWith<ActorModel, 'Server', MServer> 63 Use<'Server', MServer>
50 64
51export type MActorDefault = MActorServer & 65// ############################################################################
52 PickWith<ActorModel, 'Avatar', MAvatar>
53 66
54export type MActorFull = MActorDefault & 67// Complex actor associations
55 PickWith<ActorModel, 'Account', MAccount> &
56 PickWith<ActorModel, 'VideoChannel', MChannelAccountActor>
57 68
58export type MActorFullActor = MActorDefault & 69export type MActorDefault = MActor &
59 PickWith<ActorModel, 'Account', MAccountActorDefault> & 70 Use<'Server', MServer> &
60 PickWith<ActorModel, 'VideoChannel', MChannelActorAccountDefault> 71 Use<'Avatar', MAvatar>
61 72
62export 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> 75export type MActorChannelAccountActor = MActor &
76 Use<'VideoChannel', MChannelAccountActor>
65 77
66export type MActorSummaryBlocks = Omit<MActorSummary, 'Server'> & 78export 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
69export type MActorFollowerException = Pick<ActorModel, 'sharedInboxUrl' | 'inboxUrl'> 84// Same than ActorFull, but the account and the channel have their actor
85export 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
95export type MActorSummary = Pick<MActor, 'id' | 'preferredUsername' | 'url' | 'serverId' | 'avatarId'> &
96 Use<'Server', MServerHost> &
97 Use<'Avatar', MAvatar>
98
99export type MActorSummaryBlocks = MActorSummary &
100 Use<'Server', MServerHostBlocks>
70 101
71export type MActorAPI = Omit<MActorDefault, 'publicKey' | 'privateKey' | 'inboxUrl' | 'outboxUrl' | 'sharedInboxUrl' | 102export type MActorAPI = Omit<MActorDefault, 'publicKey' | 'privateKey' | 'inboxUrl' | 'outboxUrl' | 'sharedInboxUrl' |
72 'followersUrl' | 'followingUrl' | 'url' | 'createdAt' | 'updatedAt'> 103 'followersUrl' | 'followingUrl' | 'url' | 'createdAt' | 'updatedAt'>
73
74export 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 @@
1export * from './account' 1export * from './account'
2export * from './oauth'
2export * from './server' 3export * from './server'
3export * from './user' 4export * from './user'
4export * from './video' 5export * 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 @@
1export * from './oauth-client'
2export * 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'
2import { PickWith } from '@server/typings/utils' 2import { PickWith } from '@server/typings/utils'
3import { MUserAccountUrl } from '@server/typings/models' 3import { MUserAccountUrl } from '@server/typings/models'
4 4
5type Use<K extends keyof OAuthTokenModel, M> = PickWith<OAuthTokenModel, K, M>
6
7// ############################################################################
8
5export type MOAuthToken = Omit<OAuthTokenModel, 'User' | 'OAuthClients'> 9export type MOAuthToken = Omit<OAuthTokenModel, 'User' | 'OAuthClients'>
6 10
7export type MOAuthTokenUser = MOAuthToken & 11export 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'
2import { PickWith } from '@server/typings/utils' 2import { PickWith } from '@server/typings/utils'
3import { MAccountDefault, MServer } from '@server/typings/models' 3import { MAccountDefault, MServer } from '@server/typings/models'
4 4
5type Use<K extends keyof ServerBlocklistModel, M> = PickWith<ServerBlocklistModel, K, M>
6
7// ############################################################################
8
5export type MServerBlocklist = Omit<ServerBlocklistModel, 'ByAccount' | 'BlockedServer'> 9export type MServerBlocklist = Omit<ServerBlocklistModel, 'ByAccount' | 'BlockedServer'>
6 10
11// ############################################################################
12
7export type MServerBlocklistAccountServer = MServerBlocklist & 13export 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'
2import { PickWith } from '../../utils' 2import { PickWith } from '../../utils'
3import { MAccountBlocklistId } from '../account' 3import { MAccountBlocklistId } from '../account'
4 4
5type Use<K extends keyof ServerModel, M> = PickWith<ServerModel, K, M>
6
7// ############################################################################
8
5export type MServer = Omit<ServerModel, 'Actors' | 'BlockedByAccounts'> 9export type MServer = Omit<ServerModel, 'Actors' | 'BlockedByAccounts'>
6 10
11// ############################################################################
12
7export type MServerHost = Pick<MServer, 'host'> 13export type MServerHost = Pick<MServer, 'host'>
8 14
9export type MServerHostBlocks = MServerHost & 15export 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 @@
1export * from './user' 1export * from './user'
2export * from './user-notification' 2export * from './user-notification'
3export * from './user-notification-setting'
3export * from './user-video-history' 4export * 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'
12import { VideoImportModel } from '../../../models/video/video-import' 12import { VideoImportModel } from '../../../models/video/video-import'
13import { ActorFollowModel } from '../../../models/activitypub/actor-follow' 13import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
14 14
15type Use<K extends keyof UserNotificationModel, M> = PickWith<UserNotificationModel, K, M>
16
17// ############################################################################
18
15export namespace UserNotificationIncludes { 19export 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
59export type UserNotificationModelOnly = Omit<UserNotificationModel, 'User' | 'Video' | 'Comment' | 'VideoAbuse' | 'VideoBlacklist' | 63// ############################################################################
64
65export type MUserNotification = Omit<UserNotificationModel, 'User' | 'Video' | 'Comment' | 'VideoAbuse' | 'VideoBlacklist' |
60 'VideoImport' | 'Account' | 'ActorFollow'> 66 'VideoImport' | 'Account' | 'ActorFollow'>
61 67
62export type UserNotificationModelForApi = UserNotificationModelOnly & 68// ############################################################################
63 PickWith<UserNotificationModel, 'Video', UserNotificationIncludes.VideoIncludeChannel> & 69
64 PickWith<UserNotificationModel, 'Comment', UserNotificationIncludes.VideoCommentInclude> & 70export 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'
3import { MAccount, MAccountDefault, MAccountDefaultChannelDefault, MAccountId, MAccountIdActorId, MAccountUrl } from '../account' 3import { MAccount, MAccountDefault, MAccountDefaultChannelDefault, MAccountId, MAccountIdActorId, MAccountUrl } from '../account'
4import { MNotificationSetting } from './user-notification-setting' 4import { MNotificationSetting } from './user-notification-setting'
5 5
6type Use<K extends keyof UserModel, M> = PickWith<UserModel, K, M>
7
8// ############################################################################
9
6export type MUser = Omit<UserModel, 'Account' | 'NotificationSetting' | 'VideoImports' | 'OAuthTokens'> 10export type MUser = Omit<UserModel, 'Account' | 'NotificationSetting' | 'VideoImports' | 'OAuthTokens'>
7 11
12// ############################################################################
13
8export type MUserId = Pick<UserModel, 'id'> 14export type MUserId = Pick<UserModel, 'id'>
9 15
10export type MUserWithNotificationSetting = MUser & 16// ############################################################################
11 PickWith<UserModel, 'NotificationSetting', MNotificationSetting>
12 17
13export type MUserAccountDefault = MUser & 18// With account
14 PickWith<UserModel, 'Account', MAccountDefault> 19
20export type MUserAccountId = MUser &
21 Use<'Account', MAccountId>
22
23export type MUserAccountUrl = MUser &
24 Use<'Account', MAccountUrl & MAccountIdActorId>
15 25
16export type MUserAccount = MUser & 26export type MUserAccount = MUser &
17 PickWith<UserModel, 'Account', MAccount> 27 Use<'Account', MAccount>
18 28
19export type MUserAccountId = MUser & 29export type MUserAccountDefault = MUser &
20 PickWith<UserModel, 'Account', MAccountId> 30 Use<'Account', MAccountDefault>
21 31
22export type MUserNotifSettingAccount = MUserWithNotificationSetting & MUserAccount 32// With channel
23 33
24export type MUserDefault = MUser & 34export type MUserNotifSettingChannelDefault = MUser &
25 MUserWithNotificationSetting & 35 Use<'NotificationSetting', MNotificationSetting> &
26 MUserAccountDefault 36 Use<'Account', MAccountDefaultChannelDefault>
27 37
28export type MUserChannel = MUserWithNotificationSetting & 38// With notification settings
29 PickWith<UserModel, 'Account', MAccountDefaultChannelDefault>
30 39
31export type MUserAccountUrl = MUser & 40export type MUserWithNotificationSetting = MUser &
32 PickWith<UserModel, 'Account', MAccountUrl & MAccountIdActorId> 41 Use<'NotificationSetting', MNotificationSetting>
42
43export type MUserNotifSettingAccount = MUser &
44 Use<'NotificationSetting', MNotificationSetting> &
45 Use<'Account', MAccount>
46
47// Default scope
48
49export 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'
5export * from './video-abuse' 5export * from './video-abuse'
6export * from './video-blacklist' 6export * from './video-blacklist'
7export * from './video-caption' 7export * from './video-caption'
8export * from './video-change-ownership'
8export * from './video-channels' 9export * from './video-channels'
9export * from './video-comment' 10export * from './video-comment'
10export * from './video-file' 11export * from './video-file'
12export * from './video-import'
11export * from './video-playlist' 13export * from './video-playlist'
14export * from './video-playlist-element'
15export * from './video-rate'
12export * from './video-redundancy' 16export * from './video-redundancy'
13export * from './video-share' 17export * from './video-share'
14export * from './video-streaming-playlist' 18export * 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'
3import { MVideo } from './video' 3import { MVideo } from './video'
4import { MAccountDefault } from '../account' 4import { MAccountDefault } from '../account'
5 5
6type Use<K extends keyof VideoAbuseModel, M> = PickWith<VideoAbuseModel, K, M>
7
8// ############################################################################
9
6export type MVideoAbuse = Omit<VideoAbuseModel, 'Account' | 'Video' | 'toActivityPubObject'> 10export type MVideoAbuse = Omit<VideoAbuseModel, 'Account' | 'Video' | 'toActivityPubObject'>
7 11
12// ############################################################################
13
8export type MVideoAbuseId = Pick<VideoAbuseModel, 'id'> 14export type MVideoAbuseId = Pick<VideoAbuseModel, 'id'>
9 15
10export type MVideoAbuseVideo = MVideoAbuse & 16export type MVideoAbuseVideo = MVideoAbuse &
11 Pick<VideoAbuseModel, 'toActivityPubObject'> & 17 Pick<VideoAbuseModel, 'toActivityPubObject'> &
12 PickWith<VideoAbuseModel, 'Video', MVideo> 18 Use<'Video', MVideo>
13 19
14export type MVideoAbuseAccountVideo = MVideoAbuseVideo & 20export 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'
2import { PickWith } from '@server/typings/utils' 2import { PickWith } from '@server/typings/utils'
3import { MVideo } from '@server/typings/models' 3import { MVideo } from '@server/typings/models'
4 4
5type Use<K extends keyof VideoBlacklistModel, M> = PickWith<VideoBlacklistModel, K, M>
6
7// ############################################################################
8
5export type MVideoBlacklist = Omit<VideoBlacklistModel, 'Video'> 9export type MVideoBlacklist = Omit<VideoBlacklistModel, 'Video'>
6 10
7export type MVideoBlacklistLight = Pick<MVideoBlacklist, 'id' | 'reason' | 'unfederated'> 11export type MVideoBlacklistLight = Pick<MVideoBlacklist, 'id' | 'reason' | 'unfederated'>
8export type MVideoBlacklistUnfederated = Pick<MVideoBlacklist, 'unfederated'> 12export type MVideoBlacklistUnfederated = Pick<MVideoBlacklist, 'unfederated'>
9 13
14// ############################################################################
15
10export type MVideoBlacklistVideo = MVideoBlacklist & 16export 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'
2import { PickWith } from '@server/typings/utils' 2import { PickWith } from '@server/typings/utils'
3import { VideoModel } from '@server/models/video/video' 3import { VideoModel } from '@server/models/video/video'
4 4
5type Use<K extends keyof VideoCaptionModel, M> = PickWith<VideoCaptionModel, K, M>
6
7// ############################################################################
8
5export type MVideoCaption = Omit<VideoCaptionModel, 'Video'> 9export type MVideoCaption = Omit<VideoCaptionModel, 'Video'>
6 10
11// ############################################################################
12
7export type MVideoCaptionLanguage = Pick<MVideoCaption, 'language'> 13export type MVideoCaptionLanguage = Pick<MVideoCaption, 'language'>
8 14
9export type MVideoCaptionVideo = MVideoCaption & 15export 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
2import { PickWith } from '@server/typings/utils' 2import { PickWith } from '@server/typings/utils'
3import { MAccountDefault, MVideoWithFileThumbnail } from '@server/typings/models' 3import { MAccountDefault, MVideoWithFileThumbnail } from '@server/typings/models'
4 4
5type Use<K extends keyof VideoChangeOwnershipModel, M> = PickWith<VideoChangeOwnershipModel, K, M>
6
7// ############################################################################
8
5export type MVideoChangeOwnership = Omit<VideoChangeOwnershipModel, 'Initiator' | 'NextOwner' | 'Video'> 9export type MVideoChangeOwnership = Omit<VideoChangeOwnershipModel, 'Initiator' | 'NextOwner' | 'Video'>
6 10
7export type MVideoChangeOwnershipFull = MVideoChangeOwnership & 11export 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 @@
1import { FunctionProperties, PickWith } from '../../utils' 1import { PickWith } from '../../utils'
2import { VideoChannelModel } from '../../../models/video/video-channel' 2import { VideoChannelModel } from '../../../models/video/video-channel'
3import { 3import {
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'
17import { MVideo } from './video' 18import { MVideo } from './video'
18 19
19export type MChannelId = FunctionProperties<VideoChannelModel> 20type Use<K extends keyof VideoChannelModel, M> = PickWith<VideoChannelModel, K, M>
20export type MChannelIdActor = MChannelId & 21
21 PickWith<VideoChannelModel, 'Actor', MActorAccountChannelId> 22// ############################################################################
22 23
23export type MChannel = Omit<VideoChannelModel, 'Actor' | 'Account' | 'Videos' | 'VideoPlaylists'> 24export type MChannel = Omit<VideoChannelModel, 'Actor' | 'Account' | 'Videos' | 'VideoPlaylists'>
24 25
26// ############################################################################
27
28export type MChannelId = Pick<MChannel, 'id'>
29
30// ############################################################################
31
32export type MChannelIdActor = MChannelId &
33 Use<'Actor', MActorAccountChannelId>
34
25export type MChannelUserId = Pick<MChannel, 'accountId'> & 35export type MChannelUserId = Pick<MChannel, 'accountId'> &
26 PickWith<VideoChannelModel, 'Account', MAccountUserId> 36 Use<'Account', MAccountUserId>
37
38export type MChannelActor = MChannel &
39 Use<'Actor', MActor>
27 40
28// Default scope 41// Default scope
29export type MChannelDefault = MChannel & 42export type MChannelDefault = MChannel &
30 PickWith<VideoChannelModel, 'Actor', MActorDefault> 43 Use<'Actor', MActorDefault>
44
45// ############################################################################
46
47// Not all association attributes
31 48
32export type MChannelLight = MChannel & 49export type MChannelLight = MChannel &
33 PickWith<VideoChannelModel, 'Actor', MActorDefaultLight> 50 Use<'Actor', MActorDefaultLight>
34 51
35export type MChannelAccountLight = MChannel & 52export type MChannelActorLight = MChannel &
36 PickWith<VideoChannelModel, 'Actor', MActorDefaultLight> & 53 Use<'Actor', MActorLight>
37 PickWith<VideoChannelModel, 'Account', MAccountLight>
38 54
39export type MChannelSummary = Pick<MChannel, 'id' | 'name' | 'description' | 'actorId'> & 55export type MChannelAccountLight = MChannel &
40 PickWith<VideoChannelModel, 'Actor', MActorSummary> 56 Use<'Actor', MActorDefaultLight> &
57 Use<'Account', MAccountLight>
41 58
42export type MChannelSummaryAccount = MChannelSummary & 59// ############################################################################
43 PickWith<VideoChannelModel, 'Account', MAccountBlocks>
44 60
45export type MChannelAPI = MChannel & 61// Account associations
46 PickWith<VideoChannelModel, 'Actor', MActorAPI> &
47 PickWith<VideoChannelModel, 'Account', MAccountAPI>
48 62
49export type MChannelAccountActor = MChannel & 63export type MChannelAccountActor = MChannel &
50 PickWith<VideoChannelModel, 'Account', MAccountActor> 64 Use<'Account', MAccountActor>
51export type MChannelAccountDefault = MChannelActor & 65
52 PickWith<VideoChannelModel, 'Account', MAccountDefault> 66export type MChannelAccountDefault = MChannel &
67 Use<'Actor', MActorDefault> &
68 Use<'Account', MAccountDefault>
53 69
70export type MChannelActorAccountActor = MChannel &
71 Use<'Account', MAccountActor> &
72 Use<'Actor', MActor>
73
74// ############################################################################
75
76// Videos associations
54export type MChannelVideos = MChannel & 77export type MChannelVideos = MChannel &
55 PickWith<VideoChannelModel, 'Videos', MVideo[]> 78 Use<'Videos', MVideo[]>
56 79
57export type MChannelActor = MChannel & 80export type MChannelActorAccountDefaultVideos = MChannel &
58 PickWith<VideoChannelModel, 'Actor', MActor> 81 Use<'Actor', MActorDefault> &
59export type MChannelActorLight = MChannel & 82 Use<'Account', MAccountDefault> &
60 PickWith<VideoChannelModel, 'Actor', MActorLight> 83 Use<'Videos', MVideo[]>
61export type MChannelActorDefault = MChannel & 84
62 PickWith<VideoChannelModel, 'Actor', MActorDefault> 85// ############################################################################
86
87// For API
63 88
64export type MChannelActorAccountActor = MChannelAccountActor & MChannelActor 89export type MChannelSummary = Pick<MChannel, 'id' | 'name' | 'description' | 'actorId'> &
90 Use<'Actor', MActorSummary>
65 91
66export type MChannelActorAccountDefault = MChannel & 92export type MChannelSummaryAccount = MChannelSummary &
67 PickWith<VideoChannelModel, 'Actor', MActorDefault> & 93 Use<'Account', MAccountSummaryBlocks>
68 PickWith<VideoChannelModel, 'Account', MAccountDefault>
69 94
70export type MChannelActorAccountDefaultVideos = MChannelActorAccountDefault & MChannelVideos 95export 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 @@
1import { VideoCommentModel } from '../../../models/video/video-comment' 1import { VideoCommentModel } from '../../../models/video/video-comment'
2import { PickWith } from '../../utils' 2import { PickWith } from '../../utils'
3import { MAccountDefault } from '../account' 3import { MAccountDefault } from '../account'
4import { MVideoAccountDefault, MVideoAccountLight, MVideoFeed, MVideoIdUrl } from './video' 4import { MVideoAccountLight, MVideoFeed, MVideoIdUrl } from './video'
5
6type Use<K extends keyof VideoCommentModel, M> = PickWith<VideoCommentModel, K, M>
7
8// ############################################################################
5 9
6export type MComment = Omit<VideoCommentModel, 'OriginVideoComment' | 'InReplyToVideoComment' | 'Video' | 'Account'> 10export type MComment = Omit<VideoCommentModel, 'OriginVideoComment' | 'InReplyToVideoComment' | 'Video' | 'Account'>
7export type MCommentId = Pick<MComment, 'id'> 11export type MCommentId = Pick<MComment, 'id'>
8 12
9export type MCommentAPI = MComment & { totalReplies: number } 13// ############################################################################
10 14
11export type MCommentOwner = MComment & 15export type MCommentOwner = MComment &
12 PickWith<VideoCommentModel, 'Account', MAccountDefault> 16 Use<'Account', MAccountDefault>
13 17
14export type MCommentVideo = MComment & 18export type MCommentVideo = MComment &
15 PickWith<VideoCommentModel, 'Video', MVideoAccountLight> 19 Use<'Video', MVideoAccountLight>
16 20
17export type MCommentReply = MComment & 21export type MCommentReply = MComment &
18 PickWith<VideoCommentModel, 'InReplyToVideoComment', MComment> 22 Use<'InReplyToVideoComment', MComment>
23
24export type MCommentOwnerVideo = MComment &
25 Use<'Account', MAccountDefault> &
26 Use<'Video', MVideoAccountLight>
19 27
20export type MCommentOwnerReply = MCommentOwner & MCommentReply 28export type MCommentOwnerVideoReply = MComment &
21export type MCommentOwnerVideo = MCommentOwner & MCommentVideo 29 Use<'Account', MAccountDefault> &
22export type MCommentReplyVideo = MCommentReply & MCommentVideo 30 Use<'Video', MVideoAccountLight> &
23export type MCommentOwnerVideoReply = MCommentOwnerVideo & MCommentReply 31 Use<'InReplyToVideoComment', MComment>
24 32
25export type MCommentOwnerReplyVideoLight = MCommentOwnerReply & 33export type MCommentOwnerReplyVideoLight = MComment &
26 PickWith<VideoCommentModel, 'Video', MVideoIdUrl> 34 Use<'Account', MAccountDefault> &
35 Use<'InReplyToVideoComment', MComment> &
36 Use<'Video', MVideoIdUrl>
27 37
28export type MCommentOwnerVideoFeed = MCommentOwner & 38export type MCommentOwnerVideoFeed = MCommentOwner &
29 PickWith<VideoCommentModel, 'Video', MVideoFeed> 39 Use<'Video', MVideoFeed>
40
41// ############################################################################
42
43export 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'
3import { MVideo, MVideoUUID } from './video' 3import { MVideo, MVideoUUID } from './video'
4import { MVideoRedundancyFileUrl } from './video-redundancy' 4import { MVideoRedundancyFileUrl } from './video-redundancy'
5 5
6type Use<K extends keyof VideoFileModel, M> = PickWith<VideoFileModel, K, M>
7
8// ############################################################################
9
6export type MVideoFile = Omit<VideoFileModel, 'Video' | 'RedundancyVideos'> 10export type MVideoFile = Omit<VideoFileModel, 'Video' | 'RedundancyVideos'>
7 11
8export type MVideoFileVideo = MVideoFile & 12export type MVideoFileVideo = MVideoFile &
9 PickWith<VideoFileModel, 'Video', MVideo> 13 Use<'Video', MVideo>
10 14
11export type MVideoFileVideoUUID = MVideoFile & 15export type MVideoFileVideoUUID = MVideoFile &
12 PickWith<VideoFileModel, 'Video', MVideoUUID> 16 Use<'Video', MVideoUUID>
13 17
14export type MVideoFileRedundanciesOpt = MVideoFile & 18export 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'
2import { PickWith } from '@server/typings/utils' 2import { PickWith } from '@server/typings/utils'
3import { MUser, MVideo, MVideoAccountLight, MVideoTag, MVideoThumbnail, MVideoWithFile } from '@server/typings/models' 3import { MUser, MVideo, MVideoAccountLight, MVideoTag, MVideoThumbnail, MVideoWithFile } from '@server/typings/models'
4 4
5export type MVideoImport = Omit<VideoImportModel, 'User' | 'Video'> 5type Use<K extends keyof VideoImportModel, M> = PickWith<VideoImportModel, K, M>
6 6
7export type MVideoImportDefault = MVideoImport & 7// ############################################################################
8 PickWith<VideoImportModel, 'User', MUser> &
9 PickWith<VideoImportModel, 'Video', MVideoTag & MVideoAccountLight & MVideoThumbnail>
10 8
11export type MVideoImportDefaultFiles = MVideoImportDefault & 9export type MVideoImport = Omit<VideoImportModel, 'User' | 'Video'>
12 PickWith<VideoImportModel, 'Video', MVideoTag & MVideoAccountLight & MVideoThumbnail & MVideoWithFile>
13 10
14export type MVideoImportVideo = MVideoImport & 11export type MVideoImportVideo = MVideoImport &
15 PickWith<VideoImportModel, 'Video', MVideo> 12 Use<'Video', MVideo>
13
14// ############################################################################
15
16type VideoAssociation = MVideoTag & MVideoAccountLight & MVideoThumbnail
17
18export type MVideoImportDefault = MVideoImport &
19 Use<'User', MUser> &
20 Use<'Video', VideoAssociation>
21
22export 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
2import { PickWith } from '@server/typings/utils' 2import { PickWith } from '@server/typings/utils'
3import { MVideoPlaylistPrivacy, MVideoThumbnail, MVideoUrl } from '@server/typings/models' 3import { MVideoPlaylistPrivacy, MVideoThumbnail, MVideoUrl } from '@server/typings/models'
4 4
5type Use<K extends keyof VideoPlaylistElementModel, M> = PickWith<VideoPlaylistElementModel, K, M>
6
7// ############################################################################
8
5export type MVideoPlaylistElement = Omit<VideoPlaylistElementModel, 'VideoPlaylist' | 'Video'> 9export type MVideoPlaylistElement = Omit<VideoPlaylistElementModel, 'VideoPlaylist' | 'Video'>
10
11// ############################################################################
12
6export type MVideoPlaylistElementId = Pick<MVideoPlaylistElement, 'id'> 13export type MVideoPlaylistElementId = Pick<MVideoPlaylistElement, 'id'>
7 14
8export type MVideoPlaylistElementLight = Pick<MVideoPlaylistElement, 'id' | 'videoId' | 'startTimestamp' | 'stopTimestamp'> 15export type MVideoPlaylistElementLight = Pick<MVideoPlaylistElement, 'id' | 'videoId' | 'startTimestamp' | 'stopTimestamp'>
9 16
17// ############################################################################
18
10export type MVideoPlaylistVideoThumbnail = MVideoPlaylistElement & 19export type MVideoPlaylistVideoThumbnail = MVideoPlaylistElement &
11 PickWith<VideoPlaylistElementModel, 'Video', MVideoThumbnail> 20 Use<'Video', MVideoThumbnail>
21
22// ############################################################################
23
24// For API
12 25
13export type MVideoPlaylistAP = MVideoPlaylistElement & 26export 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'
5import { MChannelDefault, MChannelSummary } from './video-channels' 5import { MChannelDefault, MChannelSummary } from './video-channels'
6import { MVideoPlaylistElementLight } from '@server/typings/models/video/video-playlist-element' 6import { MVideoPlaylistElementLight } from '@server/typings/models/video/video-playlist-element'
7 7
8type Use<K extends keyof VideoPlaylistModel, M> = PickWith<VideoPlaylistModel, K, M>
9
10// ############################################################################
11
8export type MVideoPlaylist = Omit<VideoPlaylistModel, 'OwnerAccount' | 'VideoChannel' | 'VideoPlaylistElements' | 'Thumbnail'> 12export type MVideoPlaylist = Omit<VideoPlaylistModel, 'OwnerAccount' | 'VideoChannel' | 'VideoPlaylistElements' | 'Thumbnail'>
13
14// ############################################################################
15
9export type MVideoPlaylistId = Pick<MVideoPlaylist, 'id'> 16export type MVideoPlaylistId = Pick<MVideoPlaylist, 'id'>
10export type MVideoPlaylistPrivacy = Pick<MVideoPlaylist, 'privacy'> 17export type MVideoPlaylistPrivacy = Pick<MVideoPlaylist, 'privacy'>
18export type MVideoPlaylistUUID = Pick<MVideoPlaylist, 'uuid'>
19export type MVideoPlaylistVideosLength = MVideoPlaylist & { videosLength: number }
20
21// ############################################################################
22
23// With elements
11 24
12export type MVideoPlaylistWithElements = MVideoPlaylist & 25export type MVideoPlaylistWithElements = MVideoPlaylist &
13 PickWith<VideoPlaylistModel, 'VideoPlaylistElements', MVideoPlaylistElementLight[]> 26 Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]>
14export type MVideoPlaylistIdWithElements = MVideoPlaylistId & MVideoPlaylistWithElements
15 27
16export type MVideoPlaylistUUID = Pick<MVideoPlaylist, 'uuid'> 28export type MVideoPlaylistIdWithElements = MVideoPlaylistId &
29 Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]>
30
31// ############################################################################
32
33// With account
17 34
18export type MVideoPlaylistOwner = MVideoPlaylist & 35export type MVideoPlaylistOwner = MVideoPlaylist &
19 PickWith<VideoPlaylistModel, 'OwnerAccount', MAccount> 36 Use<'OwnerAccount', MAccount>
20 37
21export type MVideoPlaylistOwnerDefault = MVideoPlaylist & 38export type MVideoPlaylistOwnerDefault = MVideoPlaylist &
22 PickWith<VideoPlaylistModel, 'OwnerAccount', MAccountDefault> 39 Use<'OwnerAccount', MAccountDefault>
40
41// ############################################################################
42
43// With thumbnail
23 44
24export type MVideoPlaylistThumbnail = MVideoPlaylist & 45export type MVideoPlaylistThumbnail = MVideoPlaylist &
25 PickWith<VideoPlaylistModel, 'Thumbnail', MThumbnail> 46 Use<'Thumbnail', MThumbnail>
26 47
27export type MVideoPlaylistAccountThumbnail = MVideoPlaylistOwnerDefault & 48export type MVideoPlaylistAccountThumbnail = MVideoPlaylist &
28 PickWith<VideoPlaylistModel, 'Thumbnail', MThumbnail> 49 Use<'OwnerAccount', MAccountDefault> &
50 Use<'Thumbnail', MThumbnail>
29 51
30export type MVideoPlaylistAccountChannelSummary = MVideoPlaylist & 52// ############################################################################
31 PickWith<VideoPlaylistModel, 'OwnerAccount', MAccountSummary> & 53
32 PickWith<VideoPlaylistModel, 'VideoChannel', MChannelSummary> 54// With channel
33 55
34export type MVideoPlaylistAccountChannelDefault = MVideoPlaylist & 56export type MVideoPlaylistAccountChannelDefault = MVideoPlaylist &
35 PickWith<VideoPlaylistModel, 'OwnerAccount', MAccountDefault> & 57 Use<'OwnerAccount', MAccountDefault> &
36 PickWith<VideoPlaylistModel, 'VideoChannel', MChannelDefault> 58 Use<'VideoChannel', MChannelDefault>
37 59
38export type MVideoPlaylistVideosLength = MVideoPlaylist & { videosLength: number } 60// ############################################################################
39 61
40export type MVideoPlaylistFullSummary = MVideoPlaylistAccountChannelSummary & MVideoPlaylistThumbnail 62// With all associations
63
64export type MVideoPlaylistFull = MVideoPlaylist &
65 Use<'OwnerAccount', MAccountDefault> &
66 Use<'VideoChannel', MChannelDefault> &
67 Use<'Thumbnail', MThumbnail>
68
69// ############################################################################
70
71// For API
72
73export type MVideoPlaylistAccountChannelSummary = MVideoPlaylist &
74 Use<'OwnerAccount', MAccountSummary> &
75 Use<'VideoChannel', MChannelSummary>
41 76
42export type MVideoPlaylistFull = MVideoPlaylist & MVideoPlaylistThumbnail & MVideoPlaylistAccountChannelDefault 77export 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
2import { PickWith } from '@server/typings/utils' 2import { PickWith } from '@server/typings/utils'
3import { MAccountAudience, MAccountUrl, MVideo } from '..' 3import { MAccountAudience, MAccountUrl, MVideo } from '..'
4 4
5type Use<K extends keyof AccountVideoRateModel, M> = PickWith<AccountVideoRateModel, K, M>
6
7// ############################################################################
8
5export type MAccountVideoRate = Omit<AccountVideoRateModel, 'Video' | 'Account'> 9export type MAccountVideoRate = Omit<AccountVideoRateModel, 'Video' | 'Account'>
6 10
7export type MAccountVideoRateAccountUrl = MAccountVideoRate & 11export type MAccountVideoRateAccountUrl = MAccountVideoRate &
8 PickWith<AccountVideoRateModel, 'Account', MAccountUrl> 12 Use<'Account', MAccountUrl>
9 13
10export type MAccountVideoRateAccountVideo = MAccountVideoRate & 14export 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
2import { PickWith } from '@server/typings/utils' 2import { PickWith } from '@server/typings/utils'
3import { MStreamingPlaylistVideo, MVideoFile, MVideoFileVideo } from '@server/typings/models' 3import { MStreamingPlaylistVideo, MVideoFile, MVideoFileVideo } from '@server/typings/models'
4 4
5type Use<K extends keyof VideoRedundancyModel, M> = PickWith<VideoRedundancyModel, K, M>
6
7// ############################################################################
8
5export type MVideoRedundancy = Omit<VideoRedundancyModel, 'VideoFile' | 'VideoStreamingPlaylist' | 'Actor'> 9export type MVideoRedundancy = Omit<VideoRedundancyModel, 'VideoFile' | 'VideoStreamingPlaylist' | 'Actor'>
6 10
7export type MVideoRedundancyFileUrl = Pick<MVideoRedundancy, 'fileUrl'> 11export type MVideoRedundancyFileUrl = Pick<MVideoRedundancy, 'fileUrl'>
8 12
13// ############################################################################
14
9export type MVideoRedundancyFile = MVideoRedundancy & 15export type MVideoRedundancyFile = MVideoRedundancy &
10 PickWith<VideoRedundancyModel, 'VideoFile', MVideoFile> 16 Use<'VideoFile', MVideoFile>
11 17
12export type MVideoRedundancyFileVideo = MVideoRedundancy & 18export type MVideoRedundancyFileVideo = MVideoRedundancy &
13 PickWith<VideoRedundancyModel, 'VideoFile', MVideoFileVideo> 19 Use<'VideoFile', MVideoFileVideo>
14 20
15export type MVideoRedundancyStreamingPlaylistVideo = MVideoRedundancy & 21export type MVideoRedundancyStreamingPlaylistVideo = MVideoRedundancy &
16 PickWith<VideoRedundancyModel, 'VideoStreamingPlaylist', MStreamingPlaylistVideo> 22 Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo>
17 23
18export type MVideoRedundancyVideo = MVideoRedundancyFileVideo | MVideoRedundancyStreamingPlaylistVideo 24export 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'
3import { MActorDefault } from '../account' 3import { MActorDefault } from '../account'
4import { MVideo } from './video' 4import { MVideo } from './video'
5 5
6type Use<K extends keyof VideoShareModel, M> = PickWith<VideoShareModel, K, M>
7
8// ############################################################################
9
6export type MVideoShare = Omit<VideoShareModel, 'Actor' | 'Video'> 10export type MVideoShare = Omit<VideoShareModel, 'Actor' | 'Video'>
7 11
8export type MVideoShareActor = MVideoShare & 12export type MVideoShareActor = MVideoShare &
9 PickWith<VideoShareModel, 'Actor', MActorDefault> 13 Use<'Actor', MActorDefault>
10 14
11export type MVideoShareFull = MVideoShareActor & 15export 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'
3import { MVideoRedundancyFileUrl } from './video-redundancy' 3import { MVideoRedundancyFileUrl } from './video-redundancy'
4import { MVideo } from '@server/typings/models' 4import { MVideo } from '@server/typings/models'
5 5
6type Use<K extends keyof VideoStreamingPlaylistModel, M> = PickWith<VideoStreamingPlaylistModel, K, M>
7
8// ############################################################################
9
6export type MStreamingPlaylist = Omit<VideoStreamingPlaylistModel, 'Video' | 'RedundancyVideos'> 10export type MStreamingPlaylist = Omit<VideoStreamingPlaylistModel, 'Video' | 'RedundancyVideos'>
7 11
8export type MStreamingPlaylistVideo = MStreamingPlaylist & 12export type MStreamingPlaylistVideo = MStreamingPlaylist &
9 PickWith<VideoStreamingPlaylistModel, 'Video', MVideo> 13 Use<'Video', MVideo>
10 14
11export type MStreamingPlaylistRedundancies = MStreamingPlaylist & 15export 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 @@
1import { VideoModel } from '../../../models/video/video' 1import { VideoModel } from '../../../models/video/video'
2import { PickWith, PickWithOpt } from '../../utils' 2import { PickWith, PickWithOpt } from '../../utils'
3import { MChannelAccountLight, MChannelActor, MChannelActorAccountDefault, MChannelUserId } from './video-channels' 3import { MChannelAccountDefault, MChannelAccountLight, MChannelActor, MChannelUserId } from './video-channels'
4import { MTag } from './tag' 4import { MTag } from './tag'
5import { MVideoCaptionLanguage } from './video-caption' 5import { MVideoCaptionLanguage } from './video-caption'
6import { MStreamingPlaylist, MStreamingPlaylistRedundancies } from './video-streaming-playlist' 6import { MStreamingPlaylist, MStreamingPlaylistRedundancies } from './video-streaming-playlist'
@@ -10,10 +10,16 @@ import { MVideoBlacklistLight, MVideoBlacklistUnfederated } from './video-blackl
10import { MScheduleVideoUpdate } from './schedule-video-update' 10import { MScheduleVideoUpdate } from './schedule-video-update'
11import { MUserVideoHistoryTime } from '../user/user-video-history' 11import { MUserVideoHistoryTime } from '../user/user-video-history'
12 12
13type Use<K extends keyof VideoModel, M> = PickWith<VideoModel, K, M>
14
15// ############################################################################
16
13export type MVideo = Omit<VideoModel, 'VideoChannel' | 'Tags' | 'Thumbnails' | 'VideoPlaylistElements' | 'VideoAbuses' | 17export 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
17export type MVideoId = Pick<MVideo, 'id'> 23export type MVideoId = Pick<MVideo, 'id'>
18export type MVideoUrl = Pick<MVideo, 'url'> 24export type MVideoUrl = Pick<MVideo, 'url'>
19export type MVideoUUID = Pick<MVideo, 'uuid'> 25export type MVideoUUID = Pick<MVideo, 'uuid'>
@@ -21,83 +27,120 @@ export type MVideoUUID = Pick<MVideo, 'uuid'>
21export type MVideoIdUrl = MVideoId & MVideoUrl 27export type MVideoIdUrl = MVideoId & MVideoUrl
22export type MVideoFeed = Pick<MVideo, 'name' | 'uuid'> 28export 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
24export type MVideoWithFile = MVideo & 35export type MVideoWithFile = MVideo &
25 PickWith<VideoModel, 'VideoFiles', MVideoFile[]> 36 Use<'VideoFiles', MVideoFile[]>
26 37
27export type MVideoThumbnail = MVideo & 38export type MVideoThumbnail = MVideo &
28 PickWith<VideoModel, 'Thumbnails', MThumbnail[]> 39 Use<'Thumbnails', MThumbnail[]>
29export type MVideoIdThumbnail = MVideoThumbnail & MVideoId 40
41export type MVideoIdThumbnail = MVideoId &
42 Use<'Thumbnails', MThumbnail[]>
43
44export type MVideoWithFileThumbnail = MVideo &
45 Use<'VideoFiles', MVideoFile[]> &
46 Use<'Thumbnails', MThumbnail[]>
30 47
31export type MVideoTag = MVideo & 48export type MVideoTag = MVideo &
32 PickWith<VideoModel, 'Tags', MTag[]> 49 Use<'Tags', MTag[]>
33 50
34export type MVideoWithSchedule = MVideo & 51export type MVideoWithSchedule = MVideo &
35 PickWithOpt<VideoModel, 'ScheduleVideoUpdate', MScheduleVideoUpdate> 52 PickWithOpt<VideoModel, 'ScheduleVideoUpdate', MScheduleVideoUpdate>
36 53
37export type MVideoWithFileThumbnail = MVideoWithFile & MVideoThumbnail 54export type MVideoWithCaptions = MVideo &
55 Use<'VideoCaptions', MVideoCaptionLanguage[]>
38 56
39export type MVideoUser = MVideo & 57export type MVideoWithStreamingPlaylist = MVideo &
40 PickWith<VideoModel, 'VideoChannel', MChannelUserId> 58 Use<'VideoStreamingPlaylists', MStreamingPlaylist[]>
41 59
42export type MVideoWithCaptions = MVideo & 60// ############################################################################
43 PickWith<VideoModel, 'VideoCaptions', MVideoCaptionLanguage[]> 61
62// Associations with not all their attributes
63
64export type MVideoUserHistory = MVideo &
65 Use<'UserVideoHistories', MUserVideoHistoryTime[]>
44 66
45export type MVideoWithBlacklistLight = MVideo & 67export type MVideoWithBlacklistLight = MVideo &
46 PickWith<VideoModel, 'VideoBlacklist', MVideoBlacklistLight> 68 Use<'VideoBlacklist', MVideoBlacklistLight>
47 69
48export type MVideoAccountLight = MVideo & 70export type MVideoAccountLight = MVideo &
49 PickWith<VideoModel, 'VideoChannel', MChannelAccountLight> 71 Use<'VideoChannel', MChannelAccountLight>
50 72
51export type MVideoWithRights = MVideoWithBlacklistLight & MVideoThumbnail & MVideoUser 73export type MVideoWithRights = MVideo &
74 Use<'VideoBlacklist', MVideoBlacklistLight> &
75 Use<'Thumbnails', MThumbnail[]> &
76 Use<'VideoChannel', MChannelUserId>
52 77
53export type MVideoWithStreamingPlaylist = MVideo & 78// ############################################################################
54 PickWith<VideoModel, 'VideoStreamingPlaylists', MStreamingPlaylist[]>
55 79
56export type MVideoWithAllFiles = MVideoWithFileThumbnail & MVideoWithStreamingPlaylist 80// All files with some additional associations
57 81
58export type MVideoAccountAllFiles = MVideoWithAllFiles & MVideoAccountLight & MVideoWithBlacklistLight 82export type MVideoWithAllFiles = MVideo &
59export type MVideoAccountAllFilesCaptions = MVideoAccountAllFiles & MVideoWithCaptions 83 Use<'VideoFiles', MVideoFile[]> &
84 Use<'Thumbnails', MThumbnail[]> &
85 Use<'VideoStreamingPlaylists', MStreamingPlaylist[]>
60 86
61export type MVideoUserHistory = MVideo & 87export 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
64export type MVideoWithBlacklistThumbnailScheduled = MVideoWithSchedule & MVideoWithBlacklistLight & MVideoWithFileThumbnail 94// ############################################################################
95
96// With account
65 97
66export type MVideoAccountDefault = MVideo & 98export type MVideoAccountDefault = MVideo &
67 PickWith<VideoModel, 'VideoChannel', MChannelActorAccountDefault> 99 Use<'VideoChannel', MChannelAccountDefault>
68 100
69export type MVideoThumbnailAccountDefault = MVideoThumbnail & 101export type MVideoThumbnailAccountDefault = MVideo &
70 PickWith<VideoModel, 'VideoChannel', MChannelActorAccountDefault> 102 Use<'Thumbnails', MThumbnail[]> &
103 Use<'VideoChannel', MChannelAccountDefault>
71 104
72export type MVideoWithChannelActor = MVideo & 105export type MVideoWithChannelActor = MVideo &
73 PickWith<VideoModel, 'VideoChannel', MChannelActor> 106 Use<'VideoChannel', MChannelActor>
74 107
75export type MVideoFullLight = MVideoThumbnail & 108export 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
85export type MVideoAP = MVideo & 122export 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
93export type MVideoAPWithoutCaption = Omit<MVideoAP, 'VideoCaptions'> 130export type MVideoAPWithoutCaption = Omit<MVideoAP, 'VideoCaptions'>
94 131
95export type MVideoDetails = MVideo & 132export 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
142export type MVideoForUser = MVideo &
143 Use<'VideoChannel', MChannelAccountDefault> &
144 Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> &
145 Use<'VideoBlacklist', MVideoBlacklistLight> &
146 Use<'Thumbnails', MThumbnail[]>