diff options
Diffstat (limited to 'server/typings')
43 files changed, 12 insertions, 1651 deletions
diff --git a/server/typings/activitypub-processor.model.ts b/server/typings/activitypub-processor.model.ts deleted file mode 100644 index 7ed3a65b1..000000000 --- a/server/typings/activitypub-processor.model.ts +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | import { Activity } from '../../shared/models/activitypub' | ||
2 | import { MActorDefault, MActorSignature } from './models' | ||
3 | |||
4 | export type APProcessorOptions<T extends Activity> = { | ||
5 | activity: T | ||
6 | byActor: MActorSignature | ||
7 | inboxActor?: MActorDefault | ||
8 | fromFetch?: boolean | ||
9 | } | ||
diff --git a/server/typings/express.ts b/server/typings/express.d.ts index 15d445c2d..451bf9103 100644 --- a/server/typings/express.ts +++ b/server/typings/express.d.ts | |||
@@ -18,21 +18,21 @@ import { | |||
18 | MVideoShareActor, | 18 | MVideoShareActor, |
19 | MVideoThumbnail, | 19 | MVideoThumbnail, |
20 | MVideoWithRights | 20 | MVideoWithRights |
21 | } from './models' | 21 | } from '../types/models' |
22 | import { MVideoPlaylistFull, MVideoPlaylistFullSummary } from './models/video/video-playlist' | 22 | import { MVideoPlaylistFull, MVideoPlaylistFullSummary } from '../types/models/video/video-playlist' |
23 | import { MVideoImportDefault } from '@server/typings/models/video/video-import' | 23 | import { MVideoImportDefault } from '@server/types/models/video/video-import' |
24 | import { MAccountBlocklist, MActorUrl, MStreamingPlaylist, MVideoFile, MVideoImmutable } from '@server/typings/models' | 24 | import { MAccountBlocklist, MActorUrl, MStreamingPlaylist, MVideoFile, MVideoImmutable } from '@server/types/models' |
25 | import { MVideoPlaylistElement, MVideoPlaylistElementVideoUrlPlaylistPrivacy } from '@server/typings/models/video/video-playlist-element' | 25 | import { MVideoPlaylistElement, MVideoPlaylistElementVideoUrlPlaylistPrivacy } from '@server/types/models/video/video-playlist-element' |
26 | import { MAccountVideoRateAccountVideo } from '@server/typings/models/video/video-rate' | 26 | import { MAccountVideoRateAccountVideo } from '@server/types/models/video/video-rate' |
27 | import { MVideoChangeOwnershipFull } from './models/video/video-change-ownership' | 27 | import { MVideoChangeOwnershipFull } from '../types/models/video/video-change-ownership' |
28 | import { MPlugin, MServer } from '@server/typings/models/server' | 28 | import { MPlugin, MServer } from '@server/types/models/server' |
29 | import { MServerBlocklist } from './models/server/server-blocklist' | 29 | import { MServerBlocklist } from '../types/models/server/server-blocklist' |
30 | import { MOAuthTokenUser } from '@server/typings/models/oauth/oauth-token' | 30 | import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token' |
31 | import { UserRole } from '@shared/models' | 31 | import { UserRole } from '@shared/models' |
32 | import { RegisterServerAuthExternalOptions } from '@shared/models/plugins/register-server-auth.model' | 32 | import { RegisterServerAuthExternalOptions } from '@shared/models/plugins/register-server-auth.model' |
33 | 33 | ||
34 | declare module 'express' { | 34 | declare module 'express' { |
35 | interface Request { | 35 | export interface Request { |
36 | query: any | 36 | query: any |
37 | } | 37 | } |
38 | 38 | ||
diff --git a/server/typings/models/account/account-blocklist.ts b/server/typings/models/account/account-blocklist.ts deleted file mode 100644 index 0d8bf11bd..000000000 --- a/server/typings/models/account/account-blocklist.ts +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | import { AccountBlocklistModel } from '../../../models/account/account-blocklist' | ||
2 | import { PickWith } from '../../utils' | ||
3 | import { MAccountDefault, MAccountFormattable } from './account' | ||
4 | |||
5 | type Use<K extends keyof AccountBlocklistModel, M> = PickWith<AccountBlocklistModel, K, M> | ||
6 | |||
7 | // ############################################################################ | ||
8 | |||
9 | export type MAccountBlocklist = Omit<AccountBlocklistModel, 'ByAccount' | 'BlockedAccount'> | ||
10 | |||
11 | // ############################################################################ | ||
12 | |||
13 | export type MAccountBlocklistId = Pick<AccountBlocklistModel, 'id'> | ||
14 | |||
15 | export type MAccountBlocklistAccounts = | ||
16 | MAccountBlocklist & | ||
17 | Use<'ByAccount', MAccountDefault> & | ||
18 | Use<'BlockedAccount', MAccountDefault> | ||
19 | |||
20 | // ############################################################################ | ||
21 | |||
22 | // Format for API or AP object | ||
23 | |||
24 | export type MAccountBlocklistFormattable = | ||
25 | Pick<MAccountBlocklist, 'createdAt'> & | ||
26 | Use<'ByAccount', MAccountFormattable> & | ||
27 | Use<'BlockedAccount', MAccountFormattable> | ||
diff --git a/server/typings/models/account/account.ts b/server/typings/models/account/account.ts deleted file mode 100644 index 7b826ee04..000000000 --- a/server/typings/models/account/account.ts +++ /dev/null | |||
@@ -1,109 +0,0 @@ | |||
1 | import { AccountModel } from '../../../models/account/account' | ||
2 | import { | ||
3 | MActor, | ||
4 | MActorAP, | ||
5 | MActorAPI, | ||
6 | MActorAudience, | ||
7 | MActorDefault, | ||
8 | MActorDefaultLight, | ||
9 | MActorFormattable, | ||
10 | MActorId, | ||
11 | MActorServer, | ||
12 | MActorSummary, | ||
13 | MActorSummaryFormattable, | ||
14 | MActorUrl | ||
15 | } from './actor' | ||
16 | import { FunctionProperties, PickWith } from '../../utils' | ||
17 | import { MAccountBlocklistId } from './account-blocklist' | ||
18 | import { MChannelDefault } from '../video/video-channels' | ||
19 | |||
20 | type Use<K extends keyof AccountModel, M> = PickWith<AccountModel, K, M> | ||
21 | |||
22 | // ############################################################################ | ||
23 | |||
24 | export type MAccount = | ||
25 | Omit<AccountModel, 'Actor' | 'User' | 'Application' | 'VideoChannels' | 'VideoPlaylists' | | ||
26 | 'VideoComments' | 'BlockedAccounts'> | ||
27 | |||
28 | // ############################################################################ | ||
29 | |||
30 | // Only some attributes | ||
31 | export type MAccountId = Pick<MAccount, 'id'> | ||
32 | export type MAccountUserId = Pick<MAccount, 'userId'> | ||
33 | |||
34 | // Only some Actor attributes | ||
35 | export type MAccountUrl = Use<'Actor', MActorUrl> | ||
36 | export type MAccountAudience = Use<'Actor', MActorAudience> | ||
37 | |||
38 | export type MAccountIdActor = | ||
39 | MAccountId & | ||
40 | Use<'Actor', MActor> | ||
41 | |||
42 | export type MAccountIdActorId = | ||
43 | MAccountId & | ||
44 | Use<'Actor', MActorId> | ||
45 | |||
46 | // ############################################################################ | ||
47 | |||
48 | // Default scope | ||
49 | export type MAccountDefault = | ||
50 | MAccount & | ||
51 | Use<'Actor', MActorDefault> | ||
52 | |||
53 | // Default with default association scopes | ||
54 | export type MAccountDefaultChannelDefault = | ||
55 | MAccount & | ||
56 | Use<'Actor', MActorDefault> & | ||
57 | Use<'VideoChannels', MChannelDefault[]> | ||
58 | |||
59 | // We don't need some actors attributes | ||
60 | export type MAccountLight = | ||
61 | MAccount & | ||
62 | Use<'Actor', MActorDefaultLight> | ||
63 | |||
64 | // ############################################################################ | ||
65 | |||
66 | // Full actor | ||
67 | export type MAccountActor = | ||
68 | MAccount & | ||
69 | Use<'Actor', MActor> | ||
70 | |||
71 | // Full actor with server | ||
72 | export type MAccountServer = | ||
73 | MAccount & | ||
74 | Use<'Actor', MActorServer> | ||
75 | |||
76 | // ############################################################################ | ||
77 | |||
78 | // For API | ||
79 | |||
80 | export type MAccountSummary = | ||
81 | FunctionProperties<MAccount> & | ||
82 | Pick<MAccount, 'id' | 'name'> & | ||
83 | Use<'Actor', MActorSummary> | ||
84 | |||
85 | export type MAccountSummaryBlocks = | ||
86 | MAccountSummary & | ||
87 | Use<'BlockedAccounts', MAccountBlocklistId[]> | ||
88 | |||
89 | export type MAccountAPI = | ||
90 | MAccount & | ||
91 | Use<'Actor', MActorAPI> | ||
92 | |||
93 | // ############################################################################ | ||
94 | |||
95 | // Format for API or AP object | ||
96 | |||
97 | export type MAccountSummaryFormattable = | ||
98 | FunctionProperties<MAccount> & | ||
99 | Pick<MAccount, 'id' | 'name'> & | ||
100 | Use<'Actor', MActorSummaryFormattable> | ||
101 | |||
102 | export type MAccountFormattable = | ||
103 | FunctionProperties<MAccount> & | ||
104 | Pick<MAccount, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'userId'> & | ||
105 | Use<'Actor', MActorFormattable> | ||
106 | |||
107 | export type MAccountAP = | ||
108 | Pick<MAccount, 'name' | 'description'> & | ||
109 | Use<'Actor', MActorAP> | ||
diff --git a/server/typings/models/account/actor-follow.ts b/server/typings/models/account/actor-follow.ts deleted file mode 100644 index 5d0c03c8d..000000000 --- a/server/typings/models/account/actor-follow.ts +++ /dev/null | |||
@@ -1,70 +0,0 @@ | |||
1 | import { ActorFollowModel } from '../../../models/activitypub/actor-follow' | ||
2 | import { | ||
3 | MActor, | ||
4 | MActorChannelAccountActor, | ||
5 | MActorDefault, | ||
6 | MActorDefaultAccountChannel, | ||
7 | MActorFormattable, | ||
8 | MActorHost, | ||
9 | MActorUsername | ||
10 | } from './actor' | ||
11 | import { PickWith } from '../../utils' | ||
12 | import { ActorModel } from '@server/models/activitypub/actor' | ||
13 | import { MChannelDefault } from '../video/video-channels' | ||
14 | |||
15 | type Use<K extends keyof ActorFollowModel, M> = PickWith<ActorFollowModel, K, M> | ||
16 | |||
17 | // ############################################################################ | ||
18 | |||
19 | export type MActorFollow = Omit<ActorFollowModel, 'ActorFollower' | 'ActorFollowing'> | ||
20 | |||
21 | // ############################################################################ | ||
22 | |||
23 | export type MActorFollowFollowingHost = | ||
24 | MActorFollow & | ||
25 | Use<'ActorFollowing', MActorUsername & MActorHost> | ||
26 | |||
27 | // ############################################################################ | ||
28 | |||
29 | // With actors or actors default | ||
30 | |||
31 | export type MActorFollowActors = | ||
32 | MActorFollow & | ||
33 | Use<'ActorFollower', MActor> & | ||
34 | Use<'ActorFollowing', MActor> | ||
35 | |||
36 | export type MActorFollowActorsDefault = | ||
37 | MActorFollow & | ||
38 | Use<'ActorFollower', MActorDefault> & | ||
39 | Use<'ActorFollowing', MActorDefault> | ||
40 | |||
41 | export type MActorFollowFull = | ||
42 | MActorFollow & | ||
43 | Use<'ActorFollower', MActorDefaultAccountChannel> & | ||
44 | Use<'ActorFollowing', MActorDefaultAccountChannel> | ||
45 | |||
46 | // ############################################################################ | ||
47 | |||
48 | // For subscriptions | ||
49 | |||
50 | type SubscriptionFollowing = | ||
51 | MActorDefault & | ||
52 | PickWith<ActorModel, 'VideoChannel', MChannelDefault> | ||
53 | |||
54 | export type MActorFollowActorsDefaultSubscription = | ||
55 | MActorFollow & | ||
56 | Use<'ActorFollower', MActorDefault> & | ||
57 | Use<'ActorFollowing', SubscriptionFollowing> | ||
58 | |||
59 | export type MActorFollowSubscriptions = | ||
60 | MActorFollow & | ||
61 | Use<'ActorFollowing', MActorChannelAccountActor> | ||
62 | |||
63 | // ############################################################################ | ||
64 | |||
65 | // Format for API or AP object | ||
66 | |||
67 | export type MActorFollowFormattable = | ||
68 | Pick<MActorFollow, 'id' | 'score' | 'state' | 'createdAt' | 'updatedAt'> & | ||
69 | Use<'ActorFollower', MActorFormattable> & | ||
70 | Use<'ActorFollowing', MActorFormattable> | ||
diff --git a/server/typings/models/account/actor.ts b/server/typings/models/account/actor.ts deleted file mode 100644 index 1160e84cb..000000000 --- a/server/typings/models/account/actor.ts +++ /dev/null | |||
@@ -1,139 +0,0 @@ | |||
1 | import { ActorModel } from '../../../models/activitypub/actor' | ||
2 | import { FunctionProperties, PickWith, PickWithOpt } from '../../utils' | ||
3 | import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from './account' | ||
4 | import { MServer, MServerHost, MServerHostBlocks, MServerRedundancyAllowed } from '../server' | ||
5 | import { MAvatar, MAvatarFormattable } from './avatar' | ||
6 | import { MChannel, MChannelAccountActor, MChannelAccountDefault, MChannelId, MChannelIdActor } from '../video' | ||
7 | |||
8 | type Use<K extends keyof ActorModel, M> = PickWith<ActorModel, K, M> | ||
9 | |||
10 | // ############################################################################ | ||
11 | |||
12 | export type MActor = Omit<ActorModel, 'Account' | 'VideoChannel' | 'ActorFollowing' | 'Avatar' | 'ActorFollowers' | 'Server'> | ||
13 | |||
14 | // ############################################################################ | ||
15 | |||
16 | export type MActorUrl = Pick<MActor, 'url'> | ||
17 | export type MActorId = Pick<MActor, 'id'> | ||
18 | export type MActorUsername = Pick<MActor, 'preferredUsername'> | ||
19 | |||
20 | export type MActorFollowersUrl = Pick<MActor, 'followersUrl'> | ||
21 | export type MActorAudience = MActorUrl & MActorFollowersUrl | ||
22 | export type MActorWithInboxes = Pick<ActorModel, 'sharedInboxUrl' | 'inboxUrl' | 'getSharedInbox'> | ||
23 | export type MActorSignature = MActorAccountChannelId | ||
24 | |||
25 | export type MActorLight = Omit<MActor, 'privateKey' | 'privateKey'> | ||
26 | |||
27 | // ############################################################################ | ||
28 | |||
29 | // Some association attributes | ||
30 | |||
31 | export type MActorHost = Use<'Server', MServerHost> | ||
32 | export type MActorRedundancyAllowedOpt = PickWithOpt<ActorModel, 'Server', MServerRedundancyAllowed> | ||
33 | |||
34 | export type MActorDefaultLight = | ||
35 | MActorLight & | ||
36 | Use<'Server', MServerHost> & | ||
37 | Use<'Avatar', MAvatar> | ||
38 | |||
39 | export type MActorAccountId = | ||
40 | MActor & | ||
41 | Use<'Account', MAccountId> | ||
42 | export type MActorAccountIdActor = | ||
43 | MActor & | ||
44 | Use<'Account', MAccountIdActor> | ||
45 | |||
46 | export type MActorChannelId = | ||
47 | MActor & | ||
48 | Use<'VideoChannel', MChannelId> | ||
49 | export type MActorChannelIdActor = | ||
50 | MActor & | ||
51 | Use<'VideoChannel', MChannelIdActor> | ||
52 | |||
53 | export type MActorAccountChannelId = MActorAccountId & MActorChannelId | ||
54 | export type MActorAccountChannelIdActor = MActorAccountIdActor & MActorChannelIdActor | ||
55 | |||
56 | // ############################################################################ | ||
57 | |||
58 | // Include raw account/channel/server | ||
59 | |||
60 | export type MActorAccount = | ||
61 | MActor & | ||
62 | Use<'Account', MAccount> | ||
63 | |||
64 | export type MActorChannel = | ||
65 | MActor & | ||
66 | Use<'VideoChannel', MChannel> | ||
67 | |||
68 | export type MActorDefaultAccountChannel = MActorDefault & MActorAccount & MActorChannel | ||
69 | |||
70 | export type MActorServer = | ||
71 | MActor & | ||
72 | Use<'Server', MServer> | ||
73 | |||
74 | // ############################################################################ | ||
75 | |||
76 | // Complex actor associations | ||
77 | |||
78 | export type MActorDefault = | ||
79 | MActor & | ||
80 | Use<'Server', MServer> & | ||
81 | Use<'Avatar', MAvatar> | ||
82 | |||
83 | // Actor with channel that is associated to an account and its actor | ||
84 | // Actor -> VideoChannel -> Account -> Actor | ||
85 | export type MActorChannelAccountActor = | ||
86 | MActor & | ||
87 | Use<'VideoChannel', MChannelAccountActor> | ||
88 | |||
89 | export type MActorFull = | ||
90 | MActor & | ||
91 | Use<'Server', MServer> & | ||
92 | Use<'Avatar', MAvatar> & | ||
93 | Use<'Account', MAccount> & | ||
94 | Use<'VideoChannel', MChannelAccountActor> | ||
95 | |||
96 | // Same than ActorFull, but the account and the channel have their actor | ||
97 | export type MActorFullActor = | ||
98 | MActor & | ||
99 | Use<'Server', MServer> & | ||
100 | Use<'Avatar', MAvatar> & | ||
101 | Use<'Account', MAccountDefault> & | ||
102 | Use<'VideoChannel', MChannelAccountDefault> | ||
103 | |||
104 | // ############################################################################ | ||
105 | |||
106 | // API | ||
107 | |||
108 | export type MActorSummary = | ||
109 | FunctionProperties<MActor> & | ||
110 | Pick<MActor, 'id' | 'preferredUsername' | 'url' | 'serverId' | 'avatarId'> & | ||
111 | Use<'Server', MServerHost> & | ||
112 | Use<'Avatar', MAvatar> | ||
113 | |||
114 | export type MActorSummaryBlocks = | ||
115 | MActorSummary & | ||
116 | Use<'Server', MServerHostBlocks> | ||
117 | |||
118 | export type MActorAPI = | ||
119 | Omit<MActorDefault, 'publicKey' | 'privateKey' | 'inboxUrl' | 'outboxUrl' | 'sharedInboxUrl' | | ||
120 | 'followersUrl' | 'followingUrl' | 'url' | 'createdAt' | 'updatedAt'> | ||
121 | |||
122 | // ############################################################################ | ||
123 | |||
124 | // Format for API or AP object | ||
125 | |||
126 | export type MActorSummaryFormattable = | ||
127 | FunctionProperties<MActor> & | ||
128 | Pick<MActor, 'url' | 'preferredUsername'> & | ||
129 | Use<'Server', MServerHost> & | ||
130 | Use<'Avatar', MAvatarFormattable> | ||
131 | |||
132 | export type MActorFormattable = | ||
133 | MActorSummaryFormattable & | ||
134 | Pick<MActor, 'id' | 'followingCount' | 'followersCount' | 'createdAt' | 'updatedAt'> & | ||
135 | Use<'Server', MServerHost & Partial<Pick<MServer, 'redundancyAllowed'>>> | ||
136 | |||
137 | export type MActorAP = | ||
138 | MActor & | ||
139 | Use<'Avatar', MAvatar> | ||
diff --git a/server/typings/models/account/avatar.ts b/server/typings/models/account/avatar.ts deleted file mode 100644 index 21b47180f..000000000 --- a/server/typings/models/account/avatar.ts +++ /dev/null | |||
@@ -1,12 +0,0 @@ | |||
1 | import { AvatarModel } from '../../../models/avatar/avatar' | ||
2 | import { FunctionProperties } from '@server/typings/utils' | ||
3 | |||
4 | export type MAvatar = AvatarModel | ||
5 | |||
6 | // ############################################################################ | ||
7 | |||
8 | // Format for API or AP object | ||
9 | |||
10 | export type MAvatarFormattable = | ||
11 | FunctionProperties<MAvatar> & | ||
12 | Pick<MAvatar, 'filename' | 'createdAt' | 'updatedAt'> | ||
diff --git a/server/typings/models/account/index.ts b/server/typings/models/account/index.ts deleted file mode 100644 index 513c09c40..000000000 --- a/server/typings/models/account/index.ts +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | export * from './account' | ||
2 | export * from './account-blocklist' | ||
3 | export * from './actor' | ||
4 | export * from './actor-follow' | ||
5 | export * from './avatar' | ||
diff --git a/server/typings/models/index.ts b/server/typings/models/index.ts deleted file mode 100644 index 78b4948ce..000000000 --- a/server/typings/models/index.ts +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | export * from './account' | ||
2 | export * from './oauth' | ||
3 | export * from './server' | ||
4 | export * from './user' | ||
5 | export * from './video' | ||
diff --git a/server/typings/models/oauth/index.ts b/server/typings/models/oauth/index.ts deleted file mode 100644 index 36b7ea8ca..000000000 --- a/server/typings/models/oauth/index.ts +++ /dev/null | |||
@@ -1,2 +0,0 @@ | |||
1 | export * from './oauth-client' | ||
2 | export * from './oauth-token' | ||
diff --git a/server/typings/models/oauth/oauth-client.ts b/server/typings/models/oauth/oauth-client.ts deleted file mode 100644 index 904a07863..000000000 --- a/server/typings/models/oauth/oauth-client.ts +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | import { OAuthClientModel } from '@server/models/oauth/oauth-client' | ||
2 | |||
3 | export type MOAuthClient = Omit<OAuthClientModel, 'OAuthTokens'> | ||
diff --git a/server/typings/models/oauth/oauth-token.ts b/server/typings/models/oauth/oauth-token.ts deleted file mode 100644 index b24a95fd8..000000000 --- a/server/typings/models/oauth/oauth-token.ts +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | import { OAuthTokenModel } from '@server/models/oauth/oauth-token' | ||
2 | import { PickWith } from '@server/typings/utils' | ||
3 | import { MUserAccountUrl } from '../user/user' | ||
4 | |||
5 | type Use<K extends keyof OAuthTokenModel, M> = PickWith<OAuthTokenModel, K, M> | ||
6 | |||
7 | // ############################################################################ | ||
8 | |||
9 | export type MOAuthToken = Omit<OAuthTokenModel, 'User' | 'OAuthClients'> | ||
10 | |||
11 | export type MOAuthTokenUser = | ||
12 | MOAuthToken & | ||
13 | Use<'User', MUserAccountUrl> & | ||
14 | { user?: MUserAccountUrl } | ||
diff --git a/server/typings/models/server/index.ts b/server/typings/models/server/index.ts deleted file mode 100644 index c853795ad..000000000 --- a/server/typings/models/server/index.ts +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | export * from './plugin' | ||
2 | export * from './server' | ||
3 | export * from './server-blocklist' | ||
diff --git a/server/typings/models/server/plugin.ts b/server/typings/models/server/plugin.ts deleted file mode 100644 index 83eb83794..000000000 --- a/server/typings/models/server/plugin.ts +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | import { PluginModel } from '@server/models/server/plugin' | ||
2 | |||
3 | export type MPlugin = PluginModel | ||
4 | |||
5 | // ############################################################################ | ||
6 | |||
7 | // Format for API or AP object | ||
8 | |||
9 | export type MPluginFormattable = | ||
10 | Pick<MPlugin, 'name' | 'type' | 'version' | 'latestVersion' | 'enabled' | 'uninstalled' | ||
11 | | 'peertubeEngine' | 'description' | 'homepage' | 'settings' | 'createdAt' | 'updatedAt'> | ||
diff --git a/server/typings/models/server/server-blocklist.ts b/server/typings/models/server/server-blocklist.ts deleted file mode 100644 index ff6f49176..000000000 --- a/server/typings/models/server/server-blocklist.ts +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | import { ServerBlocklistModel } from '@server/models/server/server-blocklist' | ||
2 | import { PickWith } from '@server/typings/utils' | ||
3 | import { MAccountDefault, MAccountFormattable } from '../account/account' | ||
4 | import { MServer, MServerFormattable } from './server' | ||
5 | |||
6 | type Use<K extends keyof ServerBlocklistModel, M> = PickWith<ServerBlocklistModel, K, M> | ||
7 | |||
8 | // ############################################################################ | ||
9 | |||
10 | export type MServerBlocklist = Omit<ServerBlocklistModel, 'ByAccount' | 'BlockedServer'> | ||
11 | |||
12 | // ############################################################################ | ||
13 | |||
14 | export type MServerBlocklistAccountServer = | ||
15 | MServerBlocklist & | ||
16 | Use<'ByAccount', MAccountDefault> & | ||
17 | Use<'BlockedServer', MServer> | ||
18 | |||
19 | // ############################################################################ | ||
20 | |||
21 | // Format for API or AP object | ||
22 | |||
23 | export type MServerBlocklistFormattable = | ||
24 | Pick<MServerBlocklist, 'createdAt'> & | ||
25 | Use<'ByAccount', MAccountFormattable> & | ||
26 | Use<'BlockedServer', MServerFormattable> | ||
diff --git a/server/typings/models/server/server.ts b/server/typings/models/server/server.ts deleted file mode 100644 index b35e55aeb..000000000 --- a/server/typings/models/server/server.ts +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | import { ServerModel } from '../../../models/server/server' | ||
2 | import { FunctionProperties, PickWith } from '../../utils' | ||
3 | import { MAccountBlocklistId } from '../account' | ||
4 | |||
5 | type Use<K extends keyof ServerModel, M> = PickWith<ServerModel, K, M> | ||
6 | |||
7 | // ############################################################################ | ||
8 | |||
9 | export type MServer = Omit<ServerModel, 'Actors' | 'BlockedByAccounts'> | ||
10 | |||
11 | // ############################################################################ | ||
12 | |||
13 | export type MServerHost = Pick<MServer, 'host'> | ||
14 | export type MServerRedundancyAllowed = Pick<MServer, 'redundancyAllowed'> | ||
15 | |||
16 | export type MServerHostBlocks = | ||
17 | MServerHost & | ||
18 | Use<'BlockedByAccounts', MAccountBlocklistId[]> | ||
19 | |||
20 | // ############################################################################ | ||
21 | |||
22 | // Format for API or AP object | ||
23 | |||
24 | export type MServerFormattable = | ||
25 | FunctionProperties<MServer> & | ||
26 | Pick<MServer, 'host'> | ||
diff --git a/server/typings/models/user/index.ts b/server/typings/models/user/index.ts deleted file mode 100644 index 6657b2128..000000000 --- a/server/typings/models/user/index.ts +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | export * from './user' | ||
2 | export * from './user-notification' | ||
3 | export * from './user-notification-setting' | ||
4 | export * from './user-video-history' | ||
diff --git a/server/typings/models/user/user-notification-setting.ts b/server/typings/models/user/user-notification-setting.ts deleted file mode 100644 index c674add1b..000000000 --- a/server/typings/models/user/user-notification-setting.ts +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | import { UserNotificationSettingModel } from '@server/models/account/user-notification-setting' | ||
2 | |||
3 | export type MNotificationSetting = Omit<UserNotificationSettingModel, 'User'> | ||
4 | |||
5 | // ############################################################################ | ||
6 | |||
7 | // Format for API or AP object | ||
8 | |||
9 | export type MNotificationSettingFormattable = MNotificationSetting | ||
diff --git a/server/typings/models/user/user-notification.ts b/server/typings/models/user/user-notification.ts deleted file mode 100644 index 2080360e1..000000000 --- a/server/typings/models/user/user-notification.ts +++ /dev/null | |||
@@ -1,92 +0,0 @@ | |||
1 | import { UserNotificationModel } from '../../../models/account/user-notification' | ||
2 | import { PickWith, PickWithOpt } from '../../utils' | ||
3 | import { VideoModel } from '../../../models/video/video' | ||
4 | import { ActorModel } from '../../../models/activitypub/actor' | ||
5 | import { ServerModel } from '../../../models/server/server' | ||
6 | import { AvatarModel } from '../../../models/avatar/avatar' | ||
7 | import { VideoChannelModel } from '../../../models/video/video-channel' | ||
8 | import { AccountModel } from '../../../models/account/account' | ||
9 | import { VideoCommentModel } from '../../../models/video/video-comment' | ||
10 | import { VideoAbuseModel } from '../../../models/video/video-abuse' | ||
11 | import { VideoBlacklistModel } from '../../../models/video/video-blacklist' | ||
12 | import { VideoImportModel } from '../../../models/video/video-import' | ||
13 | import { ActorFollowModel } from '../../../models/activitypub/actor-follow' | ||
14 | |||
15 | type Use<K extends keyof UserNotificationModel, M> = PickWith<UserNotificationModel, K, M> | ||
16 | |||
17 | // ############################################################################ | ||
18 | |||
19 | export module UserNotificationIncludes { | ||
20 | |||
21 | export type VideoInclude = Pick<VideoModel, 'id' | 'uuid' | 'name'> | ||
22 | export type VideoIncludeChannel = | ||
23 | VideoInclude & | ||
24 | PickWith<VideoModel, 'VideoChannel', VideoChannelIncludeActor> | ||
25 | |||
26 | export type ActorInclude = | ||
27 | Pick<ActorModel, 'preferredUsername' | 'getHost'> & | ||
28 | PickWith<ActorModel, 'Avatar', Pick<AvatarModel, 'filename' | 'getStaticPath'>> & | ||
29 | PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>> | ||
30 | |||
31 | export type VideoChannelInclude = Pick<VideoChannelModel, 'id' | 'name' | 'getDisplayName'> | ||
32 | export type VideoChannelIncludeActor = | ||
33 | VideoChannelInclude & | ||
34 | PickWith<VideoChannelModel, 'Actor', ActorInclude> | ||
35 | |||
36 | export type AccountInclude = Pick<AccountModel, 'id' | 'name' | 'getDisplayName'> | ||
37 | export type AccountIncludeActor = | ||
38 | AccountInclude & | ||
39 | PickWith<AccountModel, 'Actor', ActorInclude> | ||
40 | |||
41 | export type VideoCommentInclude = | ||
42 | Pick<VideoCommentModel, 'id' | 'originCommentId' | 'getThreadId'> & | ||
43 | PickWith<VideoCommentModel, 'Account', AccountIncludeActor> & | ||
44 | PickWith<VideoCommentModel, 'Video', VideoInclude> | ||
45 | |||
46 | export type VideoAbuseInclude = | ||
47 | Pick<VideoAbuseModel, 'id'> & | ||
48 | PickWith<VideoAbuseModel, 'Video', VideoInclude> | ||
49 | |||
50 | export type VideoBlacklistInclude = | ||
51 | Pick<VideoBlacklistModel, 'id'> & | ||
52 | PickWith<VideoAbuseModel, 'Video', VideoInclude> | ||
53 | |||
54 | export type VideoImportInclude = | ||
55 | Pick<VideoImportModel, 'id' | 'magnetUri' | 'targetUrl' | 'torrentName'> & | ||
56 | PickWith<VideoImportModel, 'Video', VideoInclude> | ||
57 | |||
58 | export type ActorFollower = | ||
59 | Pick<ActorModel, 'preferredUsername' | 'getHost'> & | ||
60 | PickWith<ActorModel, 'Account', AccountInclude> & | ||
61 | PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>> & | ||
62 | PickWithOpt<ActorModel, 'Avatar', Pick<AvatarModel, 'filename' | 'getStaticPath'>> | ||
63 | |||
64 | export type ActorFollowing = | ||
65 | Pick<ActorModel, 'preferredUsername' | 'type' | 'getHost'> & | ||
66 | PickWith<ActorModel, 'VideoChannel', VideoChannelInclude> & | ||
67 | PickWith<ActorModel, 'Account', AccountInclude> & | ||
68 | PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>> | ||
69 | |||
70 | export type ActorFollowInclude = | ||
71 | Pick<ActorFollowModel, 'id' | 'state'> & | ||
72 | PickWith<ActorFollowModel, 'ActorFollower', ActorFollower> & | ||
73 | PickWith<ActorFollowModel, 'ActorFollowing', ActorFollowing> | ||
74 | } | ||
75 | |||
76 | // ############################################################################ | ||
77 | |||
78 | export type MUserNotification = | ||
79 | Omit<UserNotificationModel, 'User' | 'Video' | 'Comment' | 'VideoAbuse' | 'VideoBlacklist' | | ||
80 | 'VideoImport' | 'Account' | 'ActorFollow'> | ||
81 | |||
82 | // ############################################################################ | ||
83 | |||
84 | export type UserNotificationModelForApi = | ||
85 | MUserNotification & | ||
86 | Use<'Video', UserNotificationIncludes.VideoIncludeChannel> & | ||
87 | Use<'Comment', UserNotificationIncludes.VideoCommentInclude> & | ||
88 | Use<'VideoAbuse', UserNotificationIncludes.VideoAbuseInclude> & | ||
89 | Use<'VideoBlacklist', UserNotificationIncludes.VideoBlacklistInclude> & | ||
90 | Use<'VideoImport', UserNotificationIncludes.VideoImportInclude> & | ||
91 | Use<'ActorFollow', UserNotificationIncludes.ActorFollowInclude> & | ||
92 | Use<'Account', UserNotificationIncludes.AccountIncludeActor> | ||
diff --git a/server/typings/models/user/user-video-history.ts b/server/typings/models/user/user-video-history.ts deleted file mode 100644 index 62673ab1b..000000000 --- a/server/typings/models/user/user-video-history.ts +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | import { UserVideoHistoryModel } from '../../../models/account/user-video-history' | ||
2 | |||
3 | export type MUserVideoHistory = Omit<UserVideoHistoryModel, 'Video' | 'User'> | ||
4 | |||
5 | export type MUserVideoHistoryTime = Pick<MUserVideoHistory, 'currentTime'> | ||
diff --git a/server/typings/models/user/user.ts b/server/typings/models/user/user.ts deleted file mode 100644 index 31cf075ef..000000000 --- a/server/typings/models/user/user.ts +++ /dev/null | |||
@@ -1,89 +0,0 @@ | |||
1 | import { UserModel } from '../../../models/account/user' | ||
2 | import { PickWith, PickWithOpt } from '../../utils' | ||
3 | import { | ||
4 | MAccount, | ||
5 | MAccountDefault, | ||
6 | MAccountDefaultChannelDefault, | ||
7 | MAccountFormattable, | ||
8 | MAccountId, | ||
9 | MAccountIdActorId, | ||
10 | MAccountUrl | ||
11 | } from '../account' | ||
12 | import { MNotificationSetting, MNotificationSettingFormattable } from './user-notification-setting' | ||
13 | import { AccountModel } from '@server/models/account/account' | ||
14 | import { MChannelFormattable } from '../video/video-channels' | ||
15 | import { MVideoPlaylist } from '@server/typings/models' | ||
16 | |||
17 | type Use<K extends keyof UserModel, M> = PickWith<UserModel, K, M> | ||
18 | |||
19 | // ############################################################################ | ||
20 | |||
21 | export type MUser = Omit<UserModel, 'Account' | 'NotificationSetting' | 'VideoImports' | 'OAuthTokens'> | ||
22 | |||
23 | // ############################################################################ | ||
24 | |||
25 | export type MUserQuotaUsed = MUser & { videoQuotaUsed?: number, videoQuotaUsedDaily?: number } | ||
26 | export type MUserId = Pick<UserModel, 'id'> | ||
27 | |||
28 | // ############################################################################ | ||
29 | |||
30 | // With account | ||
31 | |||
32 | export type MUserAccountId = | ||
33 | MUser & | ||
34 | Use<'Account', MAccountId> | ||
35 | |||
36 | export type MUserAccountUrl = | ||
37 | MUser & | ||
38 | Use<'Account', MAccountUrl & MAccountIdActorId> | ||
39 | |||
40 | export type MUserAccount = | ||
41 | MUser & | ||
42 | Use<'Account', MAccount> | ||
43 | |||
44 | export type MUserAccountDefault = | ||
45 | MUser & | ||
46 | Use<'Account', MAccountDefault> | ||
47 | |||
48 | // With channel | ||
49 | |||
50 | export type MUserNotifSettingChannelDefault = | ||
51 | MUser & | ||
52 | Use<'NotificationSetting', MNotificationSetting> & | ||
53 | Use<'Account', MAccountDefaultChannelDefault> | ||
54 | |||
55 | // With notification settings | ||
56 | |||
57 | export type MUserWithNotificationSetting = | ||
58 | MUser & | ||
59 | Use<'NotificationSetting', MNotificationSetting> | ||
60 | |||
61 | export type MUserNotifSettingAccount = | ||
62 | MUser & | ||
63 | Use<'NotificationSetting', MNotificationSetting> & | ||
64 | Use<'Account', MAccount> | ||
65 | |||
66 | // Default scope | ||
67 | |||
68 | export type MUserDefault = | ||
69 | MUser & | ||
70 | Use<'NotificationSetting', MNotificationSetting> & | ||
71 | Use<'Account', MAccountDefault> | ||
72 | |||
73 | // ############################################################################ | ||
74 | |||
75 | // Format for API or AP object | ||
76 | |||
77 | type MAccountWithChannels = MAccountFormattable & PickWithOpt<AccountModel, 'VideoChannels', MChannelFormattable[]> | ||
78 | type MAccountWithChannelsAndSpecialPlaylists = | ||
79 | MAccountWithChannels & | ||
80 | PickWithOpt<AccountModel, 'VideoPlaylists', MVideoPlaylist[]> | ||
81 | |||
82 | export type MUserFormattable = | ||
83 | MUserQuotaUsed & | ||
84 | Use<'Account', MAccountWithChannels> & | ||
85 | PickWithOpt<UserModel, 'NotificationSetting', MNotificationSettingFormattable> | ||
86 | |||
87 | export type MMyUserFormattable = | ||
88 | MUserFormattable & | ||
89 | Use<'Account', MAccountWithChannelsAndSpecialPlaylists> | ||
diff --git a/server/typings/models/video/index.ts b/server/typings/models/video/index.ts deleted file mode 100644 index bd69c8a4b..000000000 --- a/server/typings/models/video/index.ts +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | export * from './schedule-video-update' | ||
2 | export * from './tag' | ||
3 | export * from './thumbnail' | ||
4 | export * from './video' | ||
5 | export * from './video-abuse' | ||
6 | export * from './video-blacklist' | ||
7 | export * from './video-caption' | ||
8 | export * from './video-change-ownership' | ||
9 | export * from './video-channels' | ||
10 | export * from './video-comment' | ||
11 | export * from './video-file' | ||
12 | export * from './video-import' | ||
13 | export * from './video-playlist' | ||
14 | export * from './video-playlist-element' | ||
15 | export * from './video-rate' | ||
16 | export * from './video-redundancy' | ||
17 | export * from './video-share' | ||
18 | export * from './video-streaming-playlist' | ||
diff --git a/server/typings/models/video/schedule-video-update.ts b/server/typings/models/video/schedule-video-update.ts deleted file mode 100644 index 95a53d139..000000000 --- a/server/typings/models/video/schedule-video-update.ts +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update' | ||
2 | import { PickWith } from '@server/typings/utils' | ||
3 | import { MVideoAPWithoutCaption, MVideoWithBlacklistLight } from './video' | ||
4 | |||
5 | type Use<K extends keyof ScheduleVideoUpdateModel, M> = PickWith<ScheduleVideoUpdateModel, K, M> | ||
6 | |||
7 | // ############################################################################ | ||
8 | |||
9 | export type MScheduleVideoUpdate = Omit<ScheduleVideoUpdateModel, 'Video'> | ||
10 | |||
11 | // ############################################################################ | ||
12 | |||
13 | export type MScheduleVideoUpdateVideoAll = | ||
14 | MScheduleVideoUpdate & | ||
15 | Use<'Video', MVideoAPWithoutCaption & MVideoWithBlacklistLight> | ||
16 | |||
17 | // Format for API or AP object | ||
18 | |||
19 | export type MScheduleVideoUpdateFormattable = Pick<MScheduleVideoUpdate, 'updateAt' | 'privacy'> | ||
diff --git a/server/typings/models/video/tag.ts b/server/typings/models/video/tag.ts deleted file mode 100644 index 64a68873e..000000000 --- a/server/typings/models/video/tag.ts +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | import { TagModel } from '../../../models/video/tag' | ||
2 | |||
3 | export type MTag = Omit<TagModel, 'Videos'> | ||
diff --git a/server/typings/models/video/thumbnail.ts b/server/typings/models/video/thumbnail.ts deleted file mode 100644 index c03ba55ac..000000000 --- a/server/typings/models/video/thumbnail.ts +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | import { ThumbnailModel } from '../../../models/video/thumbnail' | ||
2 | |||
3 | export type MThumbnail = Omit<ThumbnailModel, 'Video' | 'VideoPlaylist'> | ||
diff --git a/server/typings/models/video/video-abuse.ts b/server/typings/models/video/video-abuse.ts deleted file mode 100644 index d60f05e4c..000000000 --- a/server/typings/models/video/video-abuse.ts +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | import { VideoAbuseModel } from '../../../models/video/video-abuse' | ||
2 | import { PickWith } from '../../utils' | ||
3 | import { MVideoAccountLightBlacklistAllFiles, MVideo } from './video' | ||
4 | import { MAccountDefault, MAccountFormattable } from '../account' | ||
5 | |||
6 | type Use<K extends keyof VideoAbuseModel, M> = PickWith<VideoAbuseModel, K, M> | ||
7 | |||
8 | // ############################################################################ | ||
9 | |||
10 | export type MVideoAbuse = Omit<VideoAbuseModel, 'Account' | 'Video' | 'toActivityPubObject'> | ||
11 | |||
12 | // ############################################################################ | ||
13 | |||
14 | export type MVideoAbuseId = Pick<VideoAbuseModel, 'id'> | ||
15 | |||
16 | export type MVideoAbuseVideo = | ||
17 | MVideoAbuse & | ||
18 | Pick<VideoAbuseModel, 'toActivityPubObject'> & | ||
19 | Use<'Video', MVideo> | ||
20 | |||
21 | export type MVideoAbuseAccountVideo = | ||
22 | MVideoAbuse & | ||
23 | Pick<VideoAbuseModel, 'toActivityPubObject'> & | ||
24 | Use<'Video', MVideoAccountLightBlacklistAllFiles> & | ||
25 | Use<'Account', MAccountDefault> | ||
26 | |||
27 | // ############################################################################ | ||
28 | |||
29 | // Format for API or AP object | ||
30 | |||
31 | export type MVideoAbuseFormattable = | ||
32 | MVideoAbuse & | ||
33 | Use<'Account', MAccountFormattable> & | ||
34 | Use<'Video', Pick<MVideoAccountLightBlacklistAllFiles, | ||
35 | 'id' | 'uuid' | 'name' | 'nsfw' | 'getMiniatureStaticPath' | 'isBlacklisted' | 'VideoChannel'>> | ||
diff --git a/server/typings/models/video/video-blacklist.ts b/server/typings/models/video/video-blacklist.ts deleted file mode 100644 index ddb4db832..000000000 --- a/server/typings/models/video/video-blacklist.ts +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | import { VideoBlacklistModel } from '../../../models/video/video-blacklist' | ||
2 | import { PickWith } from '@server/typings/utils' | ||
3 | import { MVideo, MVideoFormattable } from './video' | ||
4 | |||
5 | type Use<K extends keyof VideoBlacklistModel, M> = PickWith<VideoBlacklistModel, K, M> | ||
6 | |||
7 | // ############################################################################ | ||
8 | |||
9 | export type MVideoBlacklist = Omit<VideoBlacklistModel, 'Video'> | ||
10 | |||
11 | export type MVideoBlacklistLight = Pick<MVideoBlacklist, 'id' | 'reason' | 'unfederated'> | ||
12 | export type MVideoBlacklistUnfederated = Pick<MVideoBlacklist, 'unfederated'> | ||
13 | |||
14 | // ############################################################################ | ||
15 | |||
16 | export type MVideoBlacklistLightVideo = | ||
17 | MVideoBlacklistLight & | ||
18 | Use<'Video', MVideo> | ||
19 | |||
20 | export type MVideoBlacklistVideo = | ||
21 | MVideoBlacklist & | ||
22 | Use<'Video', MVideo> | ||
23 | |||
24 | // ############################################################################ | ||
25 | |||
26 | // Format for API or AP object | ||
27 | |||
28 | export type MVideoBlacklistFormattable = | ||
29 | MVideoBlacklist & | ||
30 | Use<'Video', MVideoFormattable> | ||
diff --git a/server/typings/models/video/video-caption.ts b/server/typings/models/video/video-caption.ts deleted file mode 100644 index e7aff6956..000000000 --- a/server/typings/models/video/video-caption.ts +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | import { VideoCaptionModel } from '../../../models/video/video-caption' | ||
2 | import { FunctionProperties, PickWith } from '@server/typings/utils' | ||
3 | import { MVideo, MVideoUUID } from './video' | ||
4 | |||
5 | type Use<K extends keyof VideoCaptionModel, M> = PickWith<VideoCaptionModel, K, M> | ||
6 | |||
7 | // ############################################################################ | ||
8 | |||
9 | export type MVideoCaption = Omit<VideoCaptionModel, 'Video'> | ||
10 | |||
11 | // ############################################################################ | ||
12 | |||
13 | export type MVideoCaptionLanguage = Pick<MVideoCaption, 'language'> | ||
14 | export type MVideoCaptionLanguageUrl = Pick<MVideoCaption, 'language' | 'fileUrl' | 'getFileUrl'> | ||
15 | |||
16 | export type MVideoCaptionVideo = | ||
17 | MVideoCaption & | ||
18 | Use<'Video', Pick<MVideo, 'id' | 'remote' | 'uuid'>> | ||
19 | |||
20 | // ############################################################################ | ||
21 | |||
22 | // Format for API or AP object | ||
23 | |||
24 | export type MVideoCaptionFormattable = | ||
25 | FunctionProperties<MVideoCaption> & | ||
26 | Pick<MVideoCaption, 'language'> & | ||
27 | Use<'Video', MVideoUUID> | ||
diff --git a/server/typings/models/video/video-change-ownership.ts b/server/typings/models/video/video-change-ownership.ts deleted file mode 100644 index 971dc3db5..000000000 --- a/server/typings/models/video/video-change-ownership.ts +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | import { VideoChangeOwnershipModel } from '@server/models/video/video-change-ownership' | ||
2 | import { PickWith } from '@server/typings/utils' | ||
3 | import { MAccountDefault, MAccountFormattable } from '../account/account' | ||
4 | import { MVideo, MVideoWithAllFiles } from './video' | ||
5 | |||
6 | type Use<K extends keyof VideoChangeOwnershipModel, M> = PickWith<VideoChangeOwnershipModel, K, M> | ||
7 | |||
8 | // ############################################################################ | ||
9 | |||
10 | export type MVideoChangeOwnership = Omit<VideoChangeOwnershipModel, 'Initiator' | 'NextOwner' | 'Video'> | ||
11 | |||
12 | export type MVideoChangeOwnershipFull = | ||
13 | MVideoChangeOwnership & | ||
14 | Use<'Initiator', MAccountDefault> & | ||
15 | Use<'NextOwner', MAccountDefault> & | ||
16 | Use<'Video', MVideoWithAllFiles> | ||
17 | |||
18 | // ############################################################################ | ||
19 | |||
20 | // Format for API or AP object | ||
21 | |||
22 | export type MVideoChangeOwnershipFormattable = | ||
23 | Pick<MVideoChangeOwnership, 'id' | 'status' | 'createdAt'> & | ||
24 | Use<'Initiator', MAccountFormattable> & | ||
25 | Use<'NextOwner', MAccountFormattable> & | ||
26 | Use<'Video', Pick<MVideo, 'id' | 'uuid' | 'url' | 'name'>> | ||
diff --git a/server/typings/models/video/video-channels.ts b/server/typings/models/video/video-channels.ts deleted file mode 100644 index 50f7c2d8a..000000000 --- a/server/typings/models/video/video-channels.ts +++ /dev/null | |||
@@ -1,145 +0,0 @@ | |||
1 | import { FunctionProperties, PickWith, PickWithOpt } from '../../utils' | ||
2 | import { VideoChannelModel } from '../../../models/video/video-channel' | ||
3 | import { | ||
4 | MAccountActor, | ||
5 | MAccountAPI, | ||
6 | MAccountDefault, | ||
7 | MAccountFormattable, | ||
8 | MAccountLight, | ||
9 | MAccountSummaryBlocks, | ||
10 | MAccountSummaryFormattable, | ||
11 | MAccountUrl, | ||
12 | MAccountUserId, | ||
13 | MActor, | ||
14 | MActorAccountChannelId, | ||
15 | MActorAP, | ||
16 | MActorAPI, | ||
17 | MActorDefault, | ||
18 | MActorDefaultLight, | ||
19 | MActorFormattable, | ||
20 | MActorLight, | ||
21 | MActorSummary, | ||
22 | MActorSummaryFormattable, MActorUrl | ||
23 | } from '../account' | ||
24 | import { MVideo } from './video' | ||
25 | |||
26 | type Use<K extends keyof VideoChannelModel, M> = PickWith<VideoChannelModel, K, M> | ||
27 | |||
28 | // ############################################################################ | ||
29 | |||
30 | export type MChannel = Omit<VideoChannelModel, 'Actor' | 'Account' | 'Videos' | 'VideoPlaylists'> | ||
31 | |||
32 | // ############################################################################ | ||
33 | |||
34 | export type MChannelId = Pick<MChannel, 'id'> | ||
35 | |||
36 | // ############################################################################ | ||
37 | |||
38 | export type MChannelIdActor = | ||
39 | MChannelId & | ||
40 | Use<'Actor', MActorAccountChannelId> | ||
41 | |||
42 | export type MChannelUserId = | ||
43 | Pick<MChannel, 'accountId'> & | ||
44 | Use<'Account', MAccountUserId> | ||
45 | |||
46 | export type MChannelActor = | ||
47 | MChannel & | ||
48 | Use<'Actor', MActor> | ||
49 | |||
50 | export type MChannelUrl = Use<'Actor', MActorUrl> | ||
51 | |||
52 | // Default scope | ||
53 | export type MChannelDefault = | ||
54 | MChannel & | ||
55 | Use<'Actor', MActorDefault> | ||
56 | |||
57 | // ############################################################################ | ||
58 | |||
59 | // Not all association attributes | ||
60 | |||
61 | export type MChannelLight = | ||
62 | MChannel & | ||
63 | Use<'Actor', MActorDefaultLight> | ||
64 | |||
65 | export type MChannelActorLight = | ||
66 | MChannel & | ||
67 | Use<'Actor', MActorLight> | ||
68 | |||
69 | export type MChannelAccountLight = | ||
70 | MChannel & | ||
71 | Use<'Actor', MActorDefaultLight> & | ||
72 | Use<'Account', MAccountLight> | ||
73 | |||
74 | // ############################################################################ | ||
75 | |||
76 | // Account associations | ||
77 | |||
78 | export type MChannelAccountActor = | ||
79 | MChannel & | ||
80 | Use<'Account', MAccountActor> | ||
81 | |||
82 | export type MChannelAccountDefault = | ||
83 | MChannel & | ||
84 | Use<'Actor', MActorDefault> & | ||
85 | Use<'Account', MAccountDefault> | ||
86 | |||
87 | export type MChannelActorAccountActor = | ||
88 | MChannel & | ||
89 | Use<'Account', MAccountActor> & | ||
90 | Use<'Actor', MActor> | ||
91 | |||
92 | // ############################################################################ | ||
93 | |||
94 | // Videos associations | ||
95 | export type MChannelVideos = | ||
96 | MChannel & | ||
97 | Use<'Videos', MVideo[]> | ||
98 | |||
99 | export type MChannelActorAccountDefaultVideos = | ||
100 | MChannel & | ||
101 | Use<'Actor', MActorDefault> & | ||
102 | Use<'Account', MAccountDefault> & | ||
103 | Use<'Videos', MVideo[]> | ||
104 | |||
105 | // ############################################################################ | ||
106 | |||
107 | // For API | ||
108 | |||
109 | export type MChannelSummary = | ||
110 | FunctionProperties<MChannel> & | ||
111 | Pick<MChannel, 'id' | 'name' | 'description' | 'actorId'> & | ||
112 | Use<'Actor', MActorSummary> | ||
113 | |||
114 | export type MChannelSummaryAccount = | ||
115 | MChannelSummary & | ||
116 | Use<'Account', MAccountSummaryBlocks> | ||
117 | |||
118 | export type MChannelAPI = | ||
119 | MChannel & | ||
120 | Use<'Actor', MActorAPI> & | ||
121 | Use<'Account', MAccountAPI> | ||
122 | |||
123 | // ############################################################################ | ||
124 | |||
125 | // Format for API or AP object | ||
126 | |||
127 | export type MChannelSummaryFormattable = | ||
128 | FunctionProperties<MChannel> & | ||
129 | Pick<MChannel, 'id' | 'name'> & | ||
130 | Use<'Actor', MActorSummaryFormattable> | ||
131 | |||
132 | export type MChannelAccountSummaryFormattable = | ||
133 | MChannelSummaryFormattable & | ||
134 | Use<'Account', MAccountSummaryFormattable> | ||
135 | |||
136 | export type MChannelFormattable = | ||
137 | FunctionProperties<MChannel> & | ||
138 | Pick<MChannel, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'support'> & | ||
139 | Use<'Actor', MActorFormattable> & | ||
140 | PickWithOpt<VideoChannelModel, 'Account', MAccountFormattable> | ||
141 | |||
142 | export type MChannelAP = | ||
143 | Pick<MChannel, 'name' | 'description' | 'support'> & | ||
144 | Use<'Actor', MActorAP> & | ||
145 | Use<'Account', MAccountUrl> | ||
diff --git a/server/typings/models/video/video-comment.ts b/server/typings/models/video/video-comment.ts deleted file mode 100644 index d6e0b66f5..000000000 --- a/server/typings/models/video/video-comment.ts +++ /dev/null | |||
@@ -1,66 +0,0 @@ | |||
1 | import { VideoCommentModel } from '../../../models/video/video-comment' | ||
2 | import { PickWith, PickWithOpt } from '../../utils' | ||
3 | import { MAccountDefault, MAccountFormattable, MAccountUrl } from '../account' | ||
4 | import { MVideoAccountLight, MVideoFeed, MVideoIdUrl, MVideoUrl } from './video' | ||
5 | |||
6 | type Use<K extends keyof VideoCommentModel, M> = PickWith<VideoCommentModel, K, M> | ||
7 | |||
8 | // ############################################################################ | ||
9 | |||
10 | export type MComment = Omit<VideoCommentModel, 'OriginVideoComment' | 'InReplyToVideoComment' | 'Video' | 'Account'> | ||
11 | export type MCommentTotalReplies = MComment & { totalReplies?: number } | ||
12 | export type MCommentId = Pick<MComment, 'id'> | ||
13 | export type MCommentUrl = Pick<MComment, 'url'> | ||
14 | |||
15 | // ############################################################################ | ||
16 | |||
17 | export type MCommentOwner = | ||
18 | MComment & | ||
19 | Use<'Account', MAccountDefault> | ||
20 | |||
21 | export type MCommentVideo = | ||
22 | MComment & | ||
23 | Use<'Video', MVideoAccountLight> | ||
24 | |||
25 | export type MCommentReply = | ||
26 | MComment & | ||
27 | Use<'InReplyToVideoComment', MComment> | ||
28 | |||
29 | export type MCommentOwnerVideo = | ||
30 | MComment & | ||
31 | Use<'Account', MAccountDefault> & | ||
32 | Use<'Video', MVideoAccountLight> | ||
33 | |||
34 | export type MCommentOwnerVideoReply = | ||
35 | MComment & | ||
36 | Use<'Account', MAccountDefault> & | ||
37 | Use<'Video', MVideoAccountLight> & | ||
38 | Use<'InReplyToVideoComment', MComment> | ||
39 | |||
40 | export type MCommentOwnerReplyVideoLight = | ||
41 | MComment & | ||
42 | Use<'Account', MAccountDefault> & | ||
43 | Use<'InReplyToVideoComment', MComment> & | ||
44 | Use<'Video', MVideoIdUrl> | ||
45 | |||
46 | export type MCommentOwnerVideoFeed = | ||
47 | MCommentOwner & | ||
48 | Use<'Video', MVideoFeed> | ||
49 | |||
50 | // ############################################################################ | ||
51 | |||
52 | export type MCommentAPI = MComment & { totalReplies: number } | ||
53 | |||
54 | // ############################################################################ | ||
55 | |||
56 | // Format for API or AP object | ||
57 | |||
58 | export type MCommentFormattable = | ||
59 | MCommentTotalReplies & | ||
60 | Use<'Account', MAccountFormattable> | ||
61 | |||
62 | export type MCommentAP = | ||
63 | MComment & | ||
64 | Use<'Account', MAccountUrl> & | ||
65 | PickWithOpt<VideoCommentModel, 'Video', MVideoUrl> & | ||
66 | PickWithOpt<VideoCommentModel, 'InReplyToVideoComment', MCommentUrl> | ||
diff --git a/server/typings/models/video/video-file.ts b/server/typings/models/video/video-file.ts deleted file mode 100644 index 3fcaca78f..000000000 --- a/server/typings/models/video/video-file.ts +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | import { VideoFileModel } from '../../../models/video/video-file' | ||
2 | import { PickWith, PickWithOpt } from '../../utils' | ||
3 | import { MVideo, MVideoUUID } from './video' | ||
4 | import { MVideoRedundancy, MVideoRedundancyFileUrl } from './video-redundancy' | ||
5 | import { MStreamingPlaylistVideo, MStreamingPlaylist } from './video-streaming-playlist' | ||
6 | |||
7 | type Use<K extends keyof VideoFileModel, M> = PickWith<VideoFileModel, K, M> | ||
8 | |||
9 | // ############################################################################ | ||
10 | |||
11 | export type MVideoFile = Omit<VideoFileModel, 'Video' | 'RedundancyVideos' | 'VideoStreamingPlaylist'> | ||
12 | |||
13 | export type MVideoFileVideo = | ||
14 | MVideoFile & | ||
15 | Use<'Video', MVideo> | ||
16 | |||
17 | export type MVideoFileStreamingPlaylist = | ||
18 | MVideoFile & | ||
19 | Use<'VideoStreamingPlaylist', MStreamingPlaylist> | ||
20 | |||
21 | export type MVideoFileStreamingPlaylistVideo = | ||
22 | MVideoFile & | ||
23 | Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo> | ||
24 | |||
25 | export type MVideoFileVideoUUID = | ||
26 | MVideoFile & | ||
27 | Use<'Video', MVideoUUID> | ||
28 | |||
29 | export type MVideoFileRedundanciesAll = | ||
30 | MVideoFile & | ||
31 | PickWithOpt<VideoFileModel, 'RedundancyVideos', MVideoRedundancy[]> | ||
32 | |||
33 | export type MVideoFileRedundanciesOpt = | ||
34 | MVideoFile & | ||
35 | PickWithOpt<VideoFileModel, 'RedundancyVideos', MVideoRedundancyFileUrl[]> | ||
36 | |||
37 | export function isStreamingPlaylistFile (file: any): file is MVideoFileStreamingPlaylist { | ||
38 | return !!file.videoStreamingPlaylistId | ||
39 | } | ||
40 | |||
41 | export function isWebtorrentFile (file: any): file is MVideoFileVideo { | ||
42 | return !!file.videoId | ||
43 | } | ||
diff --git a/server/typings/models/video/video-import.ts b/server/typings/models/video/video-import.ts deleted file mode 100644 index 4e5c2e4f0..000000000 --- a/server/typings/models/video/video-import.ts +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | import { VideoImportModel } from '@server/models/video/video-import' | ||
2 | import { PickWith, PickWithOpt } from '@server/typings/utils' | ||
3 | import { MVideo, MVideoAccountLight, MVideoFormattable, MVideoTag, MVideoThumbnail, MVideoWithFile } from './video' | ||
4 | import { MUser } from '../user/user' | ||
5 | |||
6 | type Use<K extends keyof VideoImportModel, M> = PickWith<VideoImportModel, K, M> | ||
7 | |||
8 | // ############################################################################ | ||
9 | |||
10 | export type MVideoImport = Omit<VideoImportModel, 'User' | 'Video'> | ||
11 | |||
12 | export type MVideoImportVideo = | ||
13 | MVideoImport & | ||
14 | Use<'Video', MVideo> | ||
15 | |||
16 | // ############################################################################ | ||
17 | |||
18 | type VideoAssociation = MVideoTag & MVideoAccountLight & MVideoThumbnail | ||
19 | |||
20 | export type MVideoImportDefault = | ||
21 | MVideoImport & | ||
22 | Use<'User', MUser> & | ||
23 | Use<'Video', VideoAssociation> | ||
24 | |||
25 | export type MVideoImportDefaultFiles = | ||
26 | MVideoImport & | ||
27 | Use<'User', MUser> & | ||
28 | Use<'Video', VideoAssociation & MVideoWithFile> | ||
29 | |||
30 | // ############################################################################ | ||
31 | |||
32 | // Format for API or AP object | ||
33 | |||
34 | export type MVideoImportFormattable = | ||
35 | MVideoImport & | ||
36 | PickWithOpt<VideoImportModel, 'Video', MVideoFormattable & MVideoTag> | ||
diff --git a/server/typings/models/video/video-playlist-element.ts b/server/typings/models/video/video-playlist-element.ts deleted file mode 100644 index f33c76594..000000000 --- a/server/typings/models/video/video-playlist-element.ts +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | import { VideoPlaylistElementModel } from '@server/models/video/video-playlist-element' | ||
2 | import { PickWith } from '@server/typings/utils' | ||
3 | import { MVideoFormattable, MVideoThumbnail, MVideoUrl } from './video' | ||
4 | import { MVideoPlaylistPrivacy } from './video-playlist' | ||
5 | |||
6 | type Use<K extends keyof VideoPlaylistElementModel, M> = PickWith<VideoPlaylistElementModel, K, M> | ||
7 | |||
8 | // ############################################################################ | ||
9 | |||
10 | export type MVideoPlaylistElement = Omit<VideoPlaylistElementModel, 'VideoPlaylist' | 'Video'> | ||
11 | |||
12 | // ############################################################################ | ||
13 | |||
14 | export type MVideoPlaylistElementId = Pick<MVideoPlaylistElement, 'id'> | ||
15 | |||
16 | export type MVideoPlaylistElementLight = Pick<MVideoPlaylistElement, 'id' | 'videoId' | 'startTimestamp' | 'stopTimestamp'> | ||
17 | |||
18 | // ############################################################################ | ||
19 | |||
20 | export type MVideoPlaylistVideoThumbnail = | ||
21 | MVideoPlaylistElement & | ||
22 | Use<'Video', MVideoThumbnail> | ||
23 | |||
24 | export type MVideoPlaylistElementVideoUrlPlaylistPrivacy = | ||
25 | MVideoPlaylistElement & | ||
26 | Use<'Video', MVideoUrl> & | ||
27 | Use<'VideoPlaylist', MVideoPlaylistPrivacy> | ||
28 | |||
29 | // ############################################################################ | ||
30 | |||
31 | // Format for API or AP object | ||
32 | |||
33 | export type MVideoPlaylistElementFormattable = | ||
34 | MVideoPlaylistElement & | ||
35 | Use<'Video', MVideoFormattable> | ||
36 | |||
37 | export type MVideoPlaylistElementAP = | ||
38 | MVideoPlaylistElement & | ||
39 | Use<'Video', MVideoUrl> | ||
diff --git a/server/typings/models/video/video-playlist.ts b/server/typings/models/video/video-playlist.ts deleted file mode 100644 index 49c27f4a7..000000000 --- a/server/typings/models/video/video-playlist.ts +++ /dev/null | |||
@@ -1,104 +0,0 @@ | |||
1 | import { VideoPlaylistModel } from '../../../models/video/video-playlist' | ||
2 | import { PickWith } from '../../utils' | ||
3 | import { MAccount, MAccountDefault, MAccountSummary, MAccountSummaryFormattable } from '../account' | ||
4 | import { MThumbnail } from './thumbnail' | ||
5 | import { MChannelDefault, MChannelSummary, MChannelSummaryFormattable, MChannelUrl } from './video-channels' | ||
6 | import { MVideoPlaylistElementLight } from '@server/typings/models/video/video-playlist-element' | ||
7 | |||
8 | type Use<K extends keyof VideoPlaylistModel, M> = PickWith<VideoPlaylistModel, K, M> | ||
9 | |||
10 | // ############################################################################ | ||
11 | |||
12 | export type MVideoPlaylist = Omit<VideoPlaylistModel, 'OwnerAccount' | 'VideoChannel' | 'VideoPlaylistElements' | 'Thumbnail'> | ||
13 | |||
14 | // ############################################################################ | ||
15 | |||
16 | export type MVideoPlaylistId = Pick<MVideoPlaylist, 'id'> | ||
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 | ||
24 | |||
25 | export type MVideoPlaylistWithElements = | ||
26 | MVideoPlaylist & | ||
27 | Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]> | ||
28 | |||
29 | export type MVideoPlaylistIdWithElements = | ||
30 | MVideoPlaylistId & | ||
31 | Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]> | ||
32 | |||
33 | // ############################################################################ | ||
34 | |||
35 | // With account | ||
36 | |||
37 | export type MVideoPlaylistOwner = | ||
38 | MVideoPlaylist & | ||
39 | Use<'OwnerAccount', MAccount> | ||
40 | |||
41 | export type MVideoPlaylistOwnerDefault = | ||
42 | MVideoPlaylist & | ||
43 | Use<'OwnerAccount', MAccountDefault> | ||
44 | |||
45 | // ############################################################################ | ||
46 | |||
47 | // With thumbnail | ||
48 | |||
49 | export type MVideoPlaylistThumbnail = | ||
50 | MVideoPlaylist & | ||
51 | Use<'Thumbnail', MThumbnail> | ||
52 | |||
53 | export type MVideoPlaylistAccountThumbnail = | ||
54 | MVideoPlaylist & | ||
55 | Use<'OwnerAccount', MAccountDefault> & | ||
56 | Use<'Thumbnail', MThumbnail> | ||
57 | |||
58 | // ############################################################################ | ||
59 | |||
60 | // With channel | ||
61 | |||
62 | export type MVideoPlaylistAccountChannelDefault = | ||
63 | MVideoPlaylist & | ||
64 | Use<'OwnerAccount', MAccountDefault> & | ||
65 | Use<'VideoChannel', MChannelDefault> | ||
66 | |||
67 | // ############################################################################ | ||
68 | |||
69 | // With all associations | ||
70 | |||
71 | export type MVideoPlaylistFull = | ||
72 | MVideoPlaylist & | ||
73 | Use<'OwnerAccount', MAccountDefault> & | ||
74 | Use<'VideoChannel', MChannelDefault> & | ||
75 | Use<'Thumbnail', MThumbnail> | ||
76 | |||
77 | // ############################################################################ | ||
78 | |||
79 | // For API | ||
80 | |||
81 | export type MVideoPlaylistAccountChannelSummary = | ||
82 | MVideoPlaylist & | ||
83 | Use<'OwnerAccount', MAccountSummary> & | ||
84 | Use<'VideoChannel', MChannelSummary> | ||
85 | |||
86 | export type MVideoPlaylistFullSummary = | ||
87 | MVideoPlaylist & | ||
88 | Use<'Thumbnail', MThumbnail> & | ||
89 | Use<'OwnerAccount', MAccountSummary> & | ||
90 | Use<'VideoChannel', MChannelSummary> | ||
91 | |||
92 | // ############################################################################ | ||
93 | |||
94 | // Format for API or AP object | ||
95 | |||
96 | export type MVideoPlaylistFormattable = | ||
97 | MVideoPlaylistVideosLength & | ||
98 | Use<'OwnerAccount', MAccountSummaryFormattable> & | ||
99 | Use<'VideoChannel', MChannelSummaryFormattable> | ||
100 | |||
101 | export type MVideoPlaylistAP = | ||
102 | MVideoPlaylist & | ||
103 | Use<'Thumbnail', MThumbnail> & | ||
104 | Use<'VideoChannel', MChannelUrl> | ||
diff --git a/server/typings/models/video/video-rate.ts b/server/typings/models/video/video-rate.ts deleted file mode 100644 index 64ce4965b..000000000 --- a/server/typings/models/video/video-rate.ts +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | import { AccountVideoRateModel } from '@server/models/account/account-video-rate' | ||
2 | import { PickWith } from '@server/typings/utils' | ||
3 | import { MAccountAudience, MAccountUrl } from '../account/account' | ||
4 | import { MVideo, MVideoFormattable } from './video' | ||
5 | |||
6 | type Use<K extends keyof AccountVideoRateModel, M> = PickWith<AccountVideoRateModel, K, M> | ||
7 | |||
8 | // ############################################################################ | ||
9 | |||
10 | export type MAccountVideoRate = Omit<AccountVideoRateModel, 'Video' | 'Account'> | ||
11 | |||
12 | export type MAccountVideoRateAccountUrl = | ||
13 | MAccountVideoRate & | ||
14 | Use<'Account', MAccountUrl> | ||
15 | |||
16 | export type MAccountVideoRateAccountVideo = | ||
17 | MAccountVideoRate & | ||
18 | Use<'Account', MAccountAudience> & | ||
19 | Use<'Video', MVideo> | ||
20 | |||
21 | // ############################################################################ | ||
22 | |||
23 | // Format for API or AP object | ||
24 | |||
25 | export type MAccountVideoRateFormattable = | ||
26 | Pick<MAccountVideoRate, 'type'> & | ||
27 | Use<'Video', MVideoFormattable> | ||
diff --git a/server/typings/models/video/video-redundancy.ts b/server/typings/models/video/video-redundancy.ts deleted file mode 100644 index 5107aa7f4..000000000 --- a/server/typings/models/video/video-redundancy.ts +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy' | ||
2 | import { PickWith, PickWithOpt } from '@server/typings/utils' | ||
3 | import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist' | ||
4 | import { VideoFileModel } from '@server/models/video/video-file' | ||
5 | import { MVideoFile, MVideoFileVideo } from './video-file' | ||
6 | import { MStreamingPlaylistVideo } from './video-streaming-playlist' | ||
7 | import { MVideoUrl } from './video' | ||
8 | |||
9 | type Use<K extends keyof VideoRedundancyModel, M> = PickWith<VideoRedundancyModel, K, M> | ||
10 | |||
11 | // ############################################################################ | ||
12 | |||
13 | export type MVideoRedundancy = Omit<VideoRedundancyModel, 'VideoFile' | 'VideoStreamingPlaylist' | 'Actor'> | ||
14 | |||
15 | export type MVideoRedundancyFileUrl = Pick<MVideoRedundancy, 'fileUrl'> | ||
16 | |||
17 | // ############################################################################ | ||
18 | |||
19 | export type MVideoRedundancyFile = | ||
20 | MVideoRedundancy & | ||
21 | Use<'VideoFile', MVideoFile> | ||
22 | |||
23 | export type MVideoRedundancyFileVideo = | ||
24 | MVideoRedundancy & | ||
25 | Use<'VideoFile', MVideoFileVideo> | ||
26 | |||
27 | export type MVideoRedundancyStreamingPlaylistVideo = | ||
28 | MVideoRedundancy & | ||
29 | Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo> | ||
30 | |||
31 | export type MVideoRedundancyVideo = | ||
32 | MVideoRedundancy & | ||
33 | Use<'VideoFile', MVideoFileVideo> & | ||
34 | Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo> | ||
35 | |||
36 | // ############################################################################ | ||
37 | |||
38 | // Format for API or AP object | ||
39 | |||
40 | export type MVideoRedundancyAP = | ||
41 | MVideoRedundancy & | ||
42 | PickWithOpt<VideoRedundancyModel, 'VideoFile', MVideoFile & PickWith<VideoFileModel, 'Video', MVideoUrl>> & | ||
43 | PickWithOpt<VideoRedundancyModel, 'VideoStreamingPlaylist', PickWith<VideoStreamingPlaylistModel, 'Video', MVideoUrl>> | ||
diff --git a/server/typings/models/video/video-share.ts b/server/typings/models/video/video-share.ts deleted file mode 100644 index 50ca75d26..000000000 --- a/server/typings/models/video/video-share.ts +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | import { VideoShareModel } from '../../../models/video/video-share' | ||
2 | import { PickWith } from '../../utils' | ||
3 | import { MActorDefault } from '../account' | ||
4 | import { MVideo } from './video' | ||
5 | |||
6 | type Use<K extends keyof VideoShareModel, M> = PickWith<VideoShareModel, K, M> | ||
7 | |||
8 | // ############################################################################ | ||
9 | |||
10 | export type MVideoShare = Omit<VideoShareModel, 'Actor' | 'Video'> | ||
11 | |||
12 | export type MVideoShareActor = | ||
13 | MVideoShare & | ||
14 | Use<'Actor', MActorDefault> | ||
15 | |||
16 | export type MVideoShareFull = | ||
17 | MVideoShare & | ||
18 | Use<'Actor', MActorDefault> & | ||
19 | Use<'Video', MVideo> | ||
diff --git a/server/typings/models/video/video-streaming-playlist.ts b/server/typings/models/video/video-streaming-playlist.ts deleted file mode 100644 index 3f54aa560..000000000 --- a/server/typings/models/video/video-streaming-playlist.ts +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | import { VideoStreamingPlaylistModel } from '../../../models/video/video-streaming-playlist' | ||
2 | import { PickWith, PickWithOpt } from '../../utils' | ||
3 | import { MVideoRedundancyFileUrl, MVideoRedundancy } from './video-redundancy' | ||
4 | import { MVideo } from './video' | ||
5 | import { MVideoFile } from './video-file' | ||
6 | |||
7 | type Use<K extends keyof VideoStreamingPlaylistModel, M> = PickWith<VideoStreamingPlaylistModel, K, M> | ||
8 | |||
9 | // ############################################################################ | ||
10 | |||
11 | export type MStreamingPlaylist = Omit<VideoStreamingPlaylistModel, 'Video' | 'RedundancyVideos' | 'VideoFiles'> | ||
12 | |||
13 | export type MStreamingPlaylistFiles = | ||
14 | MStreamingPlaylist & | ||
15 | Use<'VideoFiles', MVideoFile[]> | ||
16 | |||
17 | export type MStreamingPlaylistVideo = | ||
18 | MStreamingPlaylist & | ||
19 | Use<'Video', MVideo> | ||
20 | |||
21 | export type MStreamingPlaylistFilesVideo = | ||
22 | MStreamingPlaylist & | ||
23 | Use<'VideoFiles', MVideoFile[]> & | ||
24 | Use<'Video', MVideo> | ||
25 | |||
26 | export type MStreamingPlaylistRedundanciesAll = | ||
27 | MStreamingPlaylist & | ||
28 | Use<'VideoFiles', MVideoFile[]> & | ||
29 | Use<'RedundancyVideos', MVideoRedundancy[]> | ||
30 | |||
31 | export type MStreamingPlaylistRedundancies = | ||
32 | MStreamingPlaylist & | ||
33 | Use<'VideoFiles', MVideoFile[]> & | ||
34 | Use<'RedundancyVideos', MVideoRedundancyFileUrl[]> | ||
35 | |||
36 | export type MStreamingPlaylistRedundanciesOpt = | ||
37 | MStreamingPlaylist & | ||
38 | Use<'VideoFiles', MVideoFile[]> & | ||
39 | PickWithOpt<VideoStreamingPlaylistModel, 'RedundancyVideos', MVideoRedundancyFileUrl[]> | ||
40 | |||
41 | export function isStreamingPlaylist (value: MVideo | MStreamingPlaylistVideo): value is MStreamingPlaylistVideo { | ||
42 | return !!(value as MStreamingPlaylist).playlistUrl | ||
43 | } | ||
diff --git a/server/typings/models/video/video.ts b/server/typings/models/video/video.ts deleted file mode 100644 index 022a9566d..000000000 --- a/server/typings/models/video/video.ts +++ /dev/null | |||
@@ -1,211 +0,0 @@ | |||
1 | import { VideoModel } from '../../../models/video/video' | ||
2 | import { PickWith, PickWithOpt } from '../../utils' | ||
3 | import { | ||
4 | MChannelAccountDefault, | ||
5 | MChannelAccountLight, | ||
6 | MChannelAccountSummaryFormattable, | ||
7 | MChannelActor, | ||
8 | MChannelFormattable, | ||
9 | MChannelUserId | ||
10 | } from './video-channels' | ||
11 | import { MTag } from './tag' | ||
12 | import { MVideoCaptionLanguage, MVideoCaptionLanguageUrl } from './video-caption' | ||
13 | import { | ||
14 | MStreamingPlaylistFiles, | ||
15 | MStreamingPlaylistRedundancies, | ||
16 | MStreamingPlaylistRedundanciesAll, | ||
17 | MStreamingPlaylistRedundanciesOpt | ||
18 | } from './video-streaming-playlist' | ||
19 | import { MVideoFile, MVideoFileRedundanciesAll, MVideoFileRedundanciesOpt } from './video-file' | ||
20 | import { MThumbnail } from './thumbnail' | ||
21 | import { MVideoBlacklist, MVideoBlacklistLight, MVideoBlacklistUnfederated } from './video-blacklist' | ||
22 | import { MScheduleVideoUpdate } from './schedule-video-update' | ||
23 | import { MUserVideoHistoryTime } from '../user/user-video-history' | ||
24 | |||
25 | type Use<K extends keyof VideoModel, M> = PickWith<VideoModel, K, M> | ||
26 | |||
27 | // ############################################################################ | ||
28 | |||
29 | export type MVideo = | ||
30 | Omit<VideoModel, 'VideoChannel' | 'Tags' | 'Thumbnails' | 'VideoPlaylistElements' | 'VideoAbuses' | | ||
31 | 'VideoFiles' | 'VideoStreamingPlaylists' | 'VideoShares' | 'AccountVideoRates' | 'VideoComments' | 'VideoViews' | 'UserVideoHistories' | | ||
32 | 'ScheduleVideoUpdate' | 'VideoBlacklist' | 'VideoImport' | 'VideoCaptions'> | ||
33 | |||
34 | // ############################################################################ | ||
35 | |||
36 | export type MVideoId = Pick<MVideo, 'id'> | ||
37 | export type MVideoUrl = Pick<MVideo, 'url'> | ||
38 | export type MVideoUUID = Pick<MVideo, 'uuid'> | ||
39 | |||
40 | export type MVideoImmutable = Pick<MVideo, 'id' | 'url' | 'uuid' | 'remote' | 'isOwned'> | ||
41 | export type MVideoIdUrl = MVideoId & MVideoUrl | ||
42 | export type MVideoFeed = Pick<MVideo, 'name' | 'uuid'> | ||
43 | |||
44 | // ############################################################################ | ||
45 | |||
46 | // Video raw associations: schedules, video files, tags, thumbnails, captions, streaming playlists | ||
47 | |||
48 | // "With" to not confuse with the VideoFile model | ||
49 | export type MVideoWithFile = | ||
50 | MVideo & | ||
51 | Use<'VideoFiles', MVideoFile[]> & | ||
52 | Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> | ||
53 | |||
54 | export type MVideoThumbnail = | ||
55 | MVideo & | ||
56 | Use<'Thumbnails', MThumbnail[]> | ||
57 | |||
58 | export type MVideoIdThumbnail = | ||
59 | MVideoId & | ||
60 | Use<'Thumbnails', MThumbnail[]> | ||
61 | |||
62 | export type MVideoWithFileThumbnail = | ||
63 | MVideo & | ||
64 | Use<'VideoFiles', MVideoFile[]> & | ||
65 | Use<'Thumbnails', MThumbnail[]> | ||
66 | |||
67 | export type MVideoThumbnailBlacklist = | ||
68 | MVideo & | ||
69 | Use<'Thumbnails', MThumbnail[]> & | ||
70 | Use<'VideoBlacklist', MVideoBlacklistLight> | ||
71 | |||
72 | export type MVideoTag = | ||
73 | MVideo & | ||
74 | Use<'Tags', MTag[]> | ||
75 | |||
76 | export type MVideoWithSchedule = | ||
77 | MVideo & | ||
78 | PickWithOpt<VideoModel, 'ScheduleVideoUpdate', MScheduleVideoUpdate> | ||
79 | |||
80 | export type MVideoWithCaptions = | ||
81 | MVideo & | ||
82 | Use<'VideoCaptions', MVideoCaptionLanguage[]> | ||
83 | |||
84 | export type MVideoWithStreamingPlaylist = | ||
85 | MVideo & | ||
86 | Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> | ||
87 | |||
88 | // ############################################################################ | ||
89 | |||
90 | // Associations with not all their attributes | ||
91 | |||
92 | export type MVideoUserHistory = | ||
93 | MVideo & | ||
94 | Use<'UserVideoHistories', MUserVideoHistoryTime[]> | ||
95 | |||
96 | export type MVideoWithBlacklistLight = | ||
97 | MVideo & | ||
98 | Use<'VideoBlacklist', MVideoBlacklistLight> | ||
99 | |||
100 | export type MVideoAccountLight = | ||
101 | MVideo & | ||
102 | Use<'VideoChannel', MChannelAccountLight> | ||
103 | |||
104 | export type MVideoWithRights = | ||
105 | MVideo & | ||
106 | Use<'VideoBlacklist', MVideoBlacklistLight> & | ||
107 | Use<'Thumbnails', MThumbnail[]> & | ||
108 | Use<'VideoChannel', MChannelUserId> | ||
109 | |||
110 | // ############################################################################ | ||
111 | |||
112 | // All files with some additional associations | ||
113 | |||
114 | export type MVideoWithAllFiles = | ||
115 | MVideo & | ||
116 | Use<'VideoFiles', MVideoFile[]> & | ||
117 | Use<'Thumbnails', MThumbnail[]> & | ||
118 | Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> | ||
119 | |||
120 | export type MVideoAccountLightBlacklistAllFiles = | ||
121 | MVideo & | ||
122 | Use<'VideoFiles', MVideoFile[]> & | ||
123 | Use<'Thumbnails', MThumbnail[]> & | ||
124 | Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> & | ||
125 | Use<'VideoChannel', MChannelAccountLight> & | ||
126 | Use<'VideoBlacklist', MVideoBlacklistLight> | ||
127 | |||
128 | // ############################################################################ | ||
129 | |||
130 | // With account | ||
131 | |||
132 | export type MVideoAccountDefault = | ||
133 | MVideo & | ||
134 | Use<'VideoChannel', MChannelAccountDefault> | ||
135 | |||
136 | export type MVideoThumbnailAccountDefault = | ||
137 | MVideo & | ||
138 | Use<'Thumbnails', MThumbnail[]> & | ||
139 | Use<'VideoChannel', MChannelAccountDefault> | ||
140 | |||
141 | export type MVideoWithChannelActor = | ||
142 | MVideo & | ||
143 | Use<'VideoChannel', MChannelActor> | ||
144 | |||
145 | export type MVideoFullLight = | ||
146 | MVideo & | ||
147 | Use<'Thumbnails', MThumbnail[]> & | ||
148 | Use<'VideoBlacklist', MVideoBlacklistLight> & | ||
149 | Use<'Tags', MTag[]> & | ||
150 | Use<'VideoChannel', MChannelAccountLight> & | ||
151 | Use<'UserVideoHistories', MUserVideoHistoryTime[]> & | ||
152 | Use<'VideoFiles', MVideoFile[]> & | ||
153 | Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> & | ||
154 | Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> | ||
155 | |||
156 | // ############################################################################ | ||
157 | |||
158 | // API | ||
159 | |||
160 | export type MVideoAP = | ||
161 | MVideo & | ||
162 | Use<'Tags', MTag[]> & | ||
163 | Use<'VideoChannel', MChannelAccountLight> & | ||
164 | Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> & | ||
165 | Use<'VideoCaptions', MVideoCaptionLanguageUrl[]> & | ||
166 | Use<'VideoBlacklist', MVideoBlacklistUnfederated> & | ||
167 | Use<'VideoFiles', MVideoFileRedundanciesOpt[]> & | ||
168 | Use<'Thumbnails', MThumbnail[]> | ||
169 | |||
170 | export type MVideoAPWithoutCaption = Omit<MVideoAP, 'VideoCaptions'> | ||
171 | |||
172 | export type MVideoDetails = | ||
173 | MVideo & | ||
174 | Use<'VideoBlacklist', MVideoBlacklistLight> & | ||
175 | Use<'Tags', MTag[]> & | ||
176 | Use<'VideoChannel', MChannelAccountLight> & | ||
177 | Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> & | ||
178 | Use<'Thumbnails', MThumbnail[]> & | ||
179 | Use<'UserVideoHistories', MUserVideoHistoryTime[]> & | ||
180 | Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundancies[]> & | ||
181 | Use<'VideoFiles', MVideoFileRedundanciesOpt[]> | ||
182 | |||
183 | export type MVideoForUser = | ||
184 | MVideo & | ||
185 | Use<'VideoChannel', MChannelAccountDefault> & | ||
186 | Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> & | ||
187 | Use<'VideoBlacklist', MVideoBlacklistLight> & | ||
188 | Use<'Thumbnails', MThumbnail[]> | ||
189 | |||
190 | export type MVideoForRedundancyAPI = | ||
191 | MVideo & | ||
192 | Use<'VideoFiles', MVideoFileRedundanciesAll[]> & | ||
193 | Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesAll[]> | ||
194 | |||
195 | // ############################################################################ | ||
196 | |||
197 | // Format for API or AP object | ||
198 | |||
199 | export type MVideoFormattable = | ||
200 | MVideo & | ||
201 | PickWithOpt<VideoModel, 'UserVideoHistories', MUserVideoHistoryTime[]> & | ||
202 | Use<'VideoChannel', MChannelAccountSummaryFormattable> & | ||
203 | PickWithOpt<VideoModel, 'ScheduleVideoUpdate', Pick<MScheduleVideoUpdate, 'updateAt' | 'privacy'>> & | ||
204 | PickWithOpt<VideoModel, 'VideoBlacklist', Pick<MVideoBlacklist, 'reason'>> | ||
205 | |||
206 | export type MVideoFormattableDetails = | ||
207 | MVideoFormattable & | ||
208 | Use<'VideoChannel', MChannelFormattable> & | ||
209 | Use<'Tags', MTag[]> & | ||
210 | Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesOpt[]> & | ||
211 | Use<'VideoFiles', MVideoFileRedundanciesOpt[]> | ||
diff --git a/server/typings/plugins/register-server-option.model.ts b/server/typings/plugins/register-server-option.model.ts index 8f1d66007..b4594c6cd 100644 --- a/server/typings/plugins/register-server-option.model.ts +++ b/server/typings/plugins/register-server-option.model.ts | |||
@@ -17,7 +17,7 @@ import { PluginVideoLanguageManager } from '../../../shared/models/plugins/plugi | |||
17 | import { PluginVideoLicenceManager } from '../../../shared/models/plugins/plugin-video-licence-manager.model' | 17 | import { PluginVideoLicenceManager } from '../../../shared/models/plugins/plugin-video-licence-manager.model' |
18 | import { RegisterServerHookOptions } from '../../../shared/models/plugins/register-server-hook.model' | 18 | import { RegisterServerHookOptions } from '../../../shared/models/plugins/register-server-hook.model' |
19 | import { RegisterServerSettingOptions } from '../../../shared/models/plugins/register-server-setting.model' | 19 | import { RegisterServerSettingOptions } from '../../../shared/models/plugins/register-server-setting.model' |
20 | import { MVideoThumbnail } from '../models' | 20 | import { MVideoThumbnail } from '../../types/models' |
21 | 21 | ||
22 | export type PeerTubeHelpers = { | 22 | export type PeerTubeHelpers = { |
23 | logger: Logger | 23 | logger: Logger |
diff --git a/server/typings/sequelize.ts b/server/typings/sequelize.ts deleted file mode 100644 index 9cd83612d..000000000 --- a/server/typings/sequelize.ts +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | import { Model } from 'sequelize-typescript' | ||
2 | |||
3 | // Thanks to sequelize-typescript: https://github.com/RobinBuschmann/sequelize-typescript | ||
4 | |||
5 | export type Diff<T extends string | symbol | number, U extends string | symbol | number> = | ||
6 | ({ [P in T]: P } & { [P in U]: never } & { [ x: string ]: never })[T] | ||
7 | |||
8 | export type Omit<T, K extends keyof T> = { [P in Diff<keyof T, K>]: T[P] } | ||
9 | |||
10 | export type RecursivePartial<T> = { [P in keyof T]?: RecursivePartial<T[P]> } | ||
11 | |||
12 | export type FilteredModelAttributes<T extends Model<T>> = RecursivePartial<Omit<T, keyof Model<any>>> & { | ||
13 | id?: number | any | ||
14 | createdAt?: Date | any | ||
15 | updatedAt?: Date | any | ||
16 | deletedAt?: Date | any | ||
17 | version?: number | any | ||
18 | } | ||
diff --git a/server/typings/utils.ts b/server/typings/utils.ts deleted file mode 100644 index 55500d8c4..000000000 --- a/server/typings/utils.ts +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | /* eslint-disable @typescript-eslint/array-type */ | ||
2 | |||
3 | export type FunctionPropertyNames<T> = { | ||
4 | [K in keyof T]: T[K] extends Function ? K : never | ||
5 | }[keyof T] | ||
6 | |||
7 | export type FunctionProperties<T> = Pick<T, FunctionPropertyNames<T>> | ||
8 | |||
9 | export type PickWith<T, KT extends keyof T, V> = { | ||
10 | [P in KT]: T[P] extends V ? V : never | ||
11 | } | ||
12 | |||
13 | export type PickWithOpt<T, KT extends keyof T, V> = { | ||
14 | [P in KT]?: T[P] extends V ? V : never | ||
15 | } | ||
16 | |||
17 | // https://github.com/krzkaczor/ts-essentials Rocks! | ||
18 | export type DeepPartial<T> = { | ||
19 | [P in keyof T]?: T[P] extends Array<infer U> | ||
20 | ? Array<DeepPartial<U>> | ||
21 | : T[P] extends ReadonlyArray<infer U> | ||
22 | ? ReadonlyArray<DeepPartial<U>> | ||
23 | : DeepPartial<T[P]> | ||
24 | } | ||