aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/typings/models/video
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-06-18 10:45:25 +0200
committerChocobozzz <me@florianbigard.com>2020-06-18 10:46:27 +0200
commit26d6bf6533023326fa017812cf31bbe20c752d36 (patch)
tree9c4e3ecdc344420190f17d429bdf05d78fae7a8c /server/typings/models/video
parentd6d951ddc0c492f3261065b5dcb4df0534d252fc (diff)
downloadPeerTube-26d6bf6533023326fa017812cf31bbe20c752d36.tar.gz
PeerTube-26d6bf6533023326fa017812cf31bbe20c752d36.tar.zst
PeerTube-26d6bf6533023326fa017812cf31bbe20c752d36.zip
Split types and typings
Diffstat (limited to 'server/typings/models/video')
-rw-r--r--server/typings/models/video/index.ts18
-rw-r--r--server/typings/models/video/schedule-video-update.ts19
-rw-r--r--server/typings/models/video/tag.ts3
-rw-r--r--server/typings/models/video/thumbnail.ts3
-rw-r--r--server/typings/models/video/video-abuse.ts35
-rw-r--r--server/typings/models/video/video-blacklist.ts30
-rw-r--r--server/typings/models/video/video-caption.ts27
-rw-r--r--server/typings/models/video/video-change-ownership.ts26
-rw-r--r--server/typings/models/video/video-channels.ts145
-rw-r--r--server/typings/models/video/video-comment.ts66
-rw-r--r--server/typings/models/video/video-file.ts43
-rw-r--r--server/typings/models/video/video-import.ts36
-rw-r--r--server/typings/models/video/video-playlist-element.ts39
-rw-r--r--server/typings/models/video/video-playlist.ts104
-rw-r--r--server/typings/models/video/video-rate.ts27
-rw-r--r--server/typings/models/video/video-redundancy.ts43
-rw-r--r--server/typings/models/video/video-share.ts19
-rw-r--r--server/typings/models/video/video-streaming-playlist.ts43
-rw-r--r--server/typings/models/video/video.ts211
19 files changed, 0 insertions, 937 deletions
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 @@
1export * from './schedule-video-update'
2export * from './tag'
3export * from './thumbnail'
4export * from './video'
5export * from './video-abuse'
6export * from './video-blacklist'
7export * from './video-caption'
8export * from './video-change-ownership'
9export * from './video-channels'
10export * from './video-comment'
11export * from './video-file'
12export * from './video-import'
13export * from './video-playlist'
14export * from './video-playlist-element'
15export * from './video-rate'
16export * from './video-redundancy'
17export * from './video-share'
18export * 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 @@
1import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update'
2import { PickWith } from '@server/typings/utils'
3import { MVideoAPWithoutCaption, MVideoWithBlacklistLight } from './video'
4
5type Use<K extends keyof ScheduleVideoUpdateModel, M> = PickWith<ScheduleVideoUpdateModel, K, M>
6
7// ############################################################################
8
9export type MScheduleVideoUpdate = Omit<ScheduleVideoUpdateModel, 'Video'>
10
11// ############################################################################
12
13export type MScheduleVideoUpdateVideoAll =
14 MScheduleVideoUpdate &
15 Use<'Video', MVideoAPWithoutCaption & MVideoWithBlacklistLight>
16
17// Format for API or AP object
18
19export 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 @@
1import { TagModel } from '../../../models/video/tag'
2
3export 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 @@
1import { ThumbnailModel } from '../../../models/video/thumbnail'
2
3export 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 @@
1import { VideoAbuseModel } from '../../../models/video/video-abuse'
2import { PickWith } from '../../utils'
3import { MVideoAccountLightBlacklistAllFiles, MVideo } from './video'
4import { MAccountDefault, MAccountFormattable } from '../account'
5
6type Use<K extends keyof VideoAbuseModel, M> = PickWith<VideoAbuseModel, K, M>
7
8// ############################################################################
9
10export type MVideoAbuse = Omit<VideoAbuseModel, 'Account' | 'Video' | 'toActivityPubObject'>
11
12// ############################################################################
13
14export type MVideoAbuseId = Pick<VideoAbuseModel, 'id'>
15
16export type MVideoAbuseVideo =
17 MVideoAbuse &
18 Pick<VideoAbuseModel, 'toActivityPubObject'> &
19 Use<'Video', MVideo>
20
21export 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
31export 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 @@
1import { VideoBlacklistModel } from '../../../models/video/video-blacklist'
2import { PickWith } from '@server/typings/utils'
3import { MVideo, MVideoFormattable } from './video'
4
5type Use<K extends keyof VideoBlacklistModel, M> = PickWith<VideoBlacklistModel, K, M>
6
7// ############################################################################
8
9export type MVideoBlacklist = Omit<VideoBlacklistModel, 'Video'>
10
11export type MVideoBlacklistLight = Pick<MVideoBlacklist, 'id' | 'reason' | 'unfederated'>
12export type MVideoBlacklistUnfederated = Pick<MVideoBlacklist, 'unfederated'>
13
14// ############################################################################
15
16export type MVideoBlacklistLightVideo =
17 MVideoBlacklistLight &
18 Use<'Video', MVideo>
19
20export type MVideoBlacklistVideo =
21 MVideoBlacklist &
22 Use<'Video', MVideo>
23
24// ############################################################################
25
26// Format for API or AP object
27
28export 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 @@
1import { VideoCaptionModel } from '../../../models/video/video-caption'
2import { FunctionProperties, PickWith } from '@server/typings/utils'
3import { MVideo, MVideoUUID } from './video'
4
5type Use<K extends keyof VideoCaptionModel, M> = PickWith<VideoCaptionModel, K, M>
6
7// ############################################################################
8
9export type MVideoCaption = Omit<VideoCaptionModel, 'Video'>
10
11// ############################################################################
12
13export type MVideoCaptionLanguage = Pick<MVideoCaption, 'language'>
14export type MVideoCaptionLanguageUrl = Pick<MVideoCaption, 'language' | 'fileUrl' | 'getFileUrl'>
15
16export type MVideoCaptionVideo =
17 MVideoCaption &
18 Use<'Video', Pick<MVideo, 'id' | 'remote' | 'uuid'>>
19
20// ############################################################################
21
22// Format for API or AP object
23
24export 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 @@
1import { VideoChangeOwnershipModel } from '@server/models/video/video-change-ownership'
2import { PickWith } from '@server/typings/utils'
3import { MAccountDefault, MAccountFormattable } from '../account/account'
4import { MVideo, MVideoWithAllFiles } from './video'
5
6type Use<K extends keyof VideoChangeOwnershipModel, M> = PickWith<VideoChangeOwnershipModel, K, M>
7
8// ############################################################################
9
10export type MVideoChangeOwnership = Omit<VideoChangeOwnershipModel, 'Initiator' | 'NextOwner' | 'Video'>
11
12export 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
22export 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 @@
1import { FunctionProperties, PickWith, PickWithOpt } from '../../utils'
2import { VideoChannelModel } from '../../../models/video/video-channel'
3import {
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'
24import { MVideo } from './video'
25
26type Use<K extends keyof VideoChannelModel, M> = PickWith<VideoChannelModel, K, M>
27
28// ############################################################################
29
30export type MChannel = Omit<VideoChannelModel, 'Actor' | 'Account' | 'Videos' | 'VideoPlaylists'>
31
32// ############################################################################
33
34export type MChannelId = Pick<MChannel, 'id'>
35
36// ############################################################################
37
38export type MChannelIdActor =
39 MChannelId &
40 Use<'Actor', MActorAccountChannelId>
41
42export type MChannelUserId =
43 Pick<MChannel, 'accountId'> &
44 Use<'Account', MAccountUserId>
45
46export type MChannelActor =
47 MChannel &
48 Use<'Actor', MActor>
49
50export type MChannelUrl = Use<'Actor', MActorUrl>
51
52// Default scope
53export type MChannelDefault =
54 MChannel &
55 Use<'Actor', MActorDefault>
56
57// ############################################################################
58
59// Not all association attributes
60
61export type MChannelLight =
62 MChannel &
63 Use<'Actor', MActorDefaultLight>
64
65export type MChannelActorLight =
66 MChannel &
67 Use<'Actor', MActorLight>
68
69export type MChannelAccountLight =
70 MChannel &
71 Use<'Actor', MActorDefaultLight> &
72 Use<'Account', MAccountLight>
73
74// ############################################################################
75
76// Account associations
77
78export type MChannelAccountActor =
79 MChannel &
80 Use<'Account', MAccountActor>
81
82export type MChannelAccountDefault =
83 MChannel &
84 Use<'Actor', MActorDefault> &
85 Use<'Account', MAccountDefault>
86
87export type MChannelActorAccountActor =
88 MChannel &
89 Use<'Account', MAccountActor> &
90 Use<'Actor', MActor>
91
92// ############################################################################
93
94// Videos associations
95export type MChannelVideos =
96 MChannel &
97 Use<'Videos', MVideo[]>
98
99export type MChannelActorAccountDefaultVideos =
100 MChannel &
101 Use<'Actor', MActorDefault> &
102 Use<'Account', MAccountDefault> &
103 Use<'Videos', MVideo[]>
104
105// ############################################################################
106
107// For API
108
109export type MChannelSummary =
110 FunctionProperties<MChannel> &
111 Pick<MChannel, 'id' | 'name' | 'description' | 'actorId'> &
112 Use<'Actor', MActorSummary>
113
114export type MChannelSummaryAccount =
115 MChannelSummary &
116 Use<'Account', MAccountSummaryBlocks>
117
118export type MChannelAPI =
119 MChannel &
120 Use<'Actor', MActorAPI> &
121 Use<'Account', MAccountAPI>
122
123// ############################################################################
124
125// Format for API or AP object
126
127export type MChannelSummaryFormattable =
128 FunctionProperties<MChannel> &
129 Pick<MChannel, 'id' | 'name'> &
130 Use<'Actor', MActorSummaryFormattable>
131
132export type MChannelAccountSummaryFormattable =
133 MChannelSummaryFormattable &
134 Use<'Account', MAccountSummaryFormattable>
135
136export type MChannelFormattable =
137 FunctionProperties<MChannel> &
138 Pick<MChannel, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'support'> &
139 Use<'Actor', MActorFormattable> &
140 PickWithOpt<VideoChannelModel, 'Account', MAccountFormattable>
141
142export 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 @@
1import { VideoCommentModel } from '../../../models/video/video-comment'
2import { PickWith, PickWithOpt } from '../../utils'
3import { MAccountDefault, MAccountFormattable, MAccountUrl } from '../account'
4import { MVideoAccountLight, MVideoFeed, MVideoIdUrl, MVideoUrl } from './video'
5
6type Use<K extends keyof VideoCommentModel, M> = PickWith<VideoCommentModel, K, M>
7
8// ############################################################################
9
10export type MComment = Omit<VideoCommentModel, 'OriginVideoComment' | 'InReplyToVideoComment' | 'Video' | 'Account'>
11export type MCommentTotalReplies = MComment & { totalReplies?: number }
12export type MCommentId = Pick<MComment, 'id'>
13export type MCommentUrl = Pick<MComment, 'url'>
14
15// ############################################################################
16
17export type MCommentOwner =
18 MComment &
19 Use<'Account', MAccountDefault>
20
21export type MCommentVideo =
22 MComment &
23 Use<'Video', MVideoAccountLight>
24
25export type MCommentReply =
26 MComment &
27 Use<'InReplyToVideoComment', MComment>
28
29export type MCommentOwnerVideo =
30 MComment &
31 Use<'Account', MAccountDefault> &
32 Use<'Video', MVideoAccountLight>
33
34export type MCommentOwnerVideoReply =
35 MComment &
36 Use<'Account', MAccountDefault> &
37 Use<'Video', MVideoAccountLight> &
38 Use<'InReplyToVideoComment', MComment>
39
40export type MCommentOwnerReplyVideoLight =
41 MComment &
42 Use<'Account', MAccountDefault> &
43 Use<'InReplyToVideoComment', MComment> &
44 Use<'Video', MVideoIdUrl>
45
46export type MCommentOwnerVideoFeed =
47 MCommentOwner &
48 Use<'Video', MVideoFeed>
49
50// ############################################################################
51
52export type MCommentAPI = MComment & { totalReplies: number }
53
54// ############################################################################
55
56// Format for API or AP object
57
58export type MCommentFormattable =
59 MCommentTotalReplies &
60 Use<'Account', MAccountFormattable>
61
62export 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 @@
1import { VideoFileModel } from '../../../models/video/video-file'
2import { PickWith, PickWithOpt } from '../../utils'
3import { MVideo, MVideoUUID } from './video'
4import { MVideoRedundancy, MVideoRedundancyFileUrl } from './video-redundancy'
5import { MStreamingPlaylistVideo, MStreamingPlaylist } from './video-streaming-playlist'
6
7type Use<K extends keyof VideoFileModel, M> = PickWith<VideoFileModel, K, M>
8
9// ############################################################################
10
11export type MVideoFile = Omit<VideoFileModel, 'Video' | 'RedundancyVideos' | 'VideoStreamingPlaylist'>
12
13export type MVideoFileVideo =
14 MVideoFile &
15 Use<'Video', MVideo>
16
17export type MVideoFileStreamingPlaylist =
18 MVideoFile &
19 Use<'VideoStreamingPlaylist', MStreamingPlaylist>
20
21export type MVideoFileStreamingPlaylistVideo =
22 MVideoFile &
23 Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo>
24
25export type MVideoFileVideoUUID =
26 MVideoFile &
27 Use<'Video', MVideoUUID>
28
29export type MVideoFileRedundanciesAll =
30 MVideoFile &
31 PickWithOpt<VideoFileModel, 'RedundancyVideos', MVideoRedundancy[]>
32
33export type MVideoFileRedundanciesOpt =
34 MVideoFile &
35 PickWithOpt<VideoFileModel, 'RedundancyVideos', MVideoRedundancyFileUrl[]>
36
37export function isStreamingPlaylistFile (file: any): file is MVideoFileStreamingPlaylist {
38 return !!file.videoStreamingPlaylistId
39}
40
41export 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 @@
1import { VideoImportModel } from '@server/models/video/video-import'
2import { PickWith, PickWithOpt } from '@server/typings/utils'
3import { MVideo, MVideoAccountLight, MVideoFormattable, MVideoTag, MVideoThumbnail, MVideoWithFile } from './video'
4import { MUser } from '../user/user'
5
6type Use<K extends keyof VideoImportModel, M> = PickWith<VideoImportModel, K, M>
7
8// ############################################################################
9
10export type MVideoImport = Omit<VideoImportModel, 'User' | 'Video'>
11
12export type MVideoImportVideo =
13 MVideoImport &
14 Use<'Video', MVideo>
15
16// ############################################################################
17
18type VideoAssociation = MVideoTag & MVideoAccountLight & MVideoThumbnail
19
20export type MVideoImportDefault =
21 MVideoImport &
22 Use<'User', MUser> &
23 Use<'Video', VideoAssociation>
24
25export type MVideoImportDefaultFiles =
26 MVideoImport &
27 Use<'User', MUser> &
28 Use<'Video', VideoAssociation & MVideoWithFile>
29
30// ############################################################################
31
32// Format for API or AP object
33
34export 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 @@
1import { VideoPlaylistElementModel } from '@server/models/video/video-playlist-element'
2import { PickWith } from '@server/typings/utils'
3import { MVideoFormattable, MVideoThumbnail, MVideoUrl } from './video'
4import { MVideoPlaylistPrivacy } from './video-playlist'
5
6type Use<K extends keyof VideoPlaylistElementModel, M> = PickWith<VideoPlaylistElementModel, K, M>
7
8// ############################################################################
9
10export type MVideoPlaylistElement = Omit<VideoPlaylistElementModel, 'VideoPlaylist' | 'Video'>
11
12// ############################################################################
13
14export type MVideoPlaylistElementId = Pick<MVideoPlaylistElement, 'id'>
15
16export type MVideoPlaylistElementLight = Pick<MVideoPlaylistElement, 'id' | 'videoId' | 'startTimestamp' | 'stopTimestamp'>
17
18// ############################################################################
19
20export type MVideoPlaylistVideoThumbnail =
21 MVideoPlaylistElement &
22 Use<'Video', MVideoThumbnail>
23
24export type MVideoPlaylistElementVideoUrlPlaylistPrivacy =
25 MVideoPlaylistElement &
26 Use<'Video', MVideoUrl> &
27 Use<'VideoPlaylist', MVideoPlaylistPrivacy>
28
29// ############################################################################
30
31// Format for API or AP object
32
33export type MVideoPlaylistElementFormattable =
34 MVideoPlaylistElement &
35 Use<'Video', MVideoFormattable>
36
37export 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 @@
1import { VideoPlaylistModel } from '../../../models/video/video-playlist'
2import { PickWith } from '../../utils'
3import { MAccount, MAccountDefault, MAccountSummary, MAccountSummaryFormattable } from '../account'
4import { MThumbnail } from './thumbnail'
5import { MChannelDefault, MChannelSummary, MChannelSummaryFormattable, MChannelUrl } from './video-channels'
6import { MVideoPlaylistElementLight } from '@server/typings/models/video/video-playlist-element'
7
8type Use<K extends keyof VideoPlaylistModel, M> = PickWith<VideoPlaylistModel, K, M>
9
10// ############################################################################
11
12export type MVideoPlaylist = Omit<VideoPlaylistModel, 'OwnerAccount' | 'VideoChannel' | 'VideoPlaylistElements' | 'Thumbnail'>
13
14// ############################################################################
15
16export type MVideoPlaylistId = Pick<MVideoPlaylist, 'id'>
17export type MVideoPlaylistPrivacy = Pick<MVideoPlaylist, 'privacy'>
18export type MVideoPlaylistUUID = Pick<MVideoPlaylist, 'uuid'>
19export type MVideoPlaylistVideosLength = MVideoPlaylist & { videosLength?: number }
20
21// ############################################################################
22
23// With elements
24
25export type MVideoPlaylistWithElements =
26 MVideoPlaylist &
27 Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]>
28
29export type MVideoPlaylistIdWithElements =
30 MVideoPlaylistId &
31 Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]>
32
33// ############################################################################
34
35// With account
36
37export type MVideoPlaylistOwner =
38 MVideoPlaylist &
39 Use<'OwnerAccount', MAccount>
40
41export type MVideoPlaylistOwnerDefault =
42 MVideoPlaylist &
43 Use<'OwnerAccount', MAccountDefault>
44
45// ############################################################################
46
47// With thumbnail
48
49export type MVideoPlaylistThumbnail =
50 MVideoPlaylist &
51 Use<'Thumbnail', MThumbnail>
52
53export type MVideoPlaylistAccountThumbnail =
54 MVideoPlaylist &
55 Use<'OwnerAccount', MAccountDefault> &
56 Use<'Thumbnail', MThumbnail>
57
58// ############################################################################
59
60// With channel
61
62export type MVideoPlaylistAccountChannelDefault =
63 MVideoPlaylist &
64 Use<'OwnerAccount', MAccountDefault> &
65 Use<'VideoChannel', MChannelDefault>
66
67// ############################################################################
68
69// With all associations
70
71export type MVideoPlaylistFull =
72 MVideoPlaylist &
73 Use<'OwnerAccount', MAccountDefault> &
74 Use<'VideoChannel', MChannelDefault> &
75 Use<'Thumbnail', MThumbnail>
76
77// ############################################################################
78
79// For API
80
81export type MVideoPlaylistAccountChannelSummary =
82 MVideoPlaylist &
83 Use<'OwnerAccount', MAccountSummary> &
84 Use<'VideoChannel', MChannelSummary>
85
86export 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
96export type MVideoPlaylistFormattable =
97 MVideoPlaylistVideosLength &
98 Use<'OwnerAccount', MAccountSummaryFormattable> &
99 Use<'VideoChannel', MChannelSummaryFormattable>
100
101export 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 @@
1import { AccountVideoRateModel } from '@server/models/account/account-video-rate'
2import { PickWith } from '@server/typings/utils'
3import { MAccountAudience, MAccountUrl } from '../account/account'
4import { MVideo, MVideoFormattable } from './video'
5
6type Use<K extends keyof AccountVideoRateModel, M> = PickWith<AccountVideoRateModel, K, M>
7
8// ############################################################################
9
10export type MAccountVideoRate = Omit<AccountVideoRateModel, 'Video' | 'Account'>
11
12export type MAccountVideoRateAccountUrl =
13 MAccountVideoRate &
14 Use<'Account', MAccountUrl>
15
16export type MAccountVideoRateAccountVideo =
17 MAccountVideoRate &
18 Use<'Account', MAccountAudience> &
19 Use<'Video', MVideo>
20
21// ############################################################################
22
23// Format for API or AP object
24
25export 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 @@
1import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy'
2import { PickWith, PickWithOpt } from '@server/typings/utils'
3import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist'
4import { VideoFileModel } from '@server/models/video/video-file'
5import { MVideoFile, MVideoFileVideo } from './video-file'
6import { MStreamingPlaylistVideo } from './video-streaming-playlist'
7import { MVideoUrl } from './video'
8
9type Use<K extends keyof VideoRedundancyModel, M> = PickWith<VideoRedundancyModel, K, M>
10
11// ############################################################################
12
13export type MVideoRedundancy = Omit<VideoRedundancyModel, 'VideoFile' | 'VideoStreamingPlaylist' | 'Actor'>
14
15export type MVideoRedundancyFileUrl = Pick<MVideoRedundancy, 'fileUrl'>
16
17// ############################################################################
18
19export type MVideoRedundancyFile =
20 MVideoRedundancy &
21 Use<'VideoFile', MVideoFile>
22
23export type MVideoRedundancyFileVideo =
24 MVideoRedundancy &
25 Use<'VideoFile', MVideoFileVideo>
26
27export type MVideoRedundancyStreamingPlaylistVideo =
28 MVideoRedundancy &
29 Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo>
30
31export type MVideoRedundancyVideo =
32 MVideoRedundancy &
33 Use<'VideoFile', MVideoFileVideo> &
34 Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo>
35
36// ############################################################################
37
38// Format for API or AP object
39
40export 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 @@
1import { VideoShareModel } from '../../../models/video/video-share'
2import { PickWith } from '../../utils'
3import { MActorDefault } from '../account'
4import { MVideo } from './video'
5
6type Use<K extends keyof VideoShareModel, M> = PickWith<VideoShareModel, K, M>
7
8// ############################################################################
9
10export type MVideoShare = Omit<VideoShareModel, 'Actor' | 'Video'>
11
12export type MVideoShareActor =
13 MVideoShare &
14 Use<'Actor', MActorDefault>
15
16export 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 @@
1import { VideoStreamingPlaylistModel } from '../../../models/video/video-streaming-playlist'
2import { PickWith, PickWithOpt } from '../../utils'
3import { MVideoRedundancyFileUrl, MVideoRedundancy } from './video-redundancy'
4import { MVideo } from './video'
5import { MVideoFile } from './video-file'
6
7type Use<K extends keyof VideoStreamingPlaylistModel, M> = PickWith<VideoStreamingPlaylistModel, K, M>
8
9// ############################################################################
10
11export type MStreamingPlaylist = Omit<VideoStreamingPlaylistModel, 'Video' | 'RedundancyVideos' | 'VideoFiles'>
12
13export type MStreamingPlaylistFiles =
14 MStreamingPlaylist &
15 Use<'VideoFiles', MVideoFile[]>
16
17export type MStreamingPlaylistVideo =
18 MStreamingPlaylist &
19 Use<'Video', MVideo>
20
21export type MStreamingPlaylistFilesVideo =
22 MStreamingPlaylist &
23 Use<'VideoFiles', MVideoFile[]> &
24 Use<'Video', MVideo>
25
26export type MStreamingPlaylistRedundanciesAll =
27 MStreamingPlaylist &
28 Use<'VideoFiles', MVideoFile[]> &
29 Use<'RedundancyVideos', MVideoRedundancy[]>
30
31export type MStreamingPlaylistRedundancies =
32 MStreamingPlaylist &
33 Use<'VideoFiles', MVideoFile[]> &
34 Use<'RedundancyVideos', MVideoRedundancyFileUrl[]>
35
36export type MStreamingPlaylistRedundanciesOpt =
37 MStreamingPlaylist &
38 Use<'VideoFiles', MVideoFile[]> &
39 PickWithOpt<VideoStreamingPlaylistModel, 'RedundancyVideos', MVideoRedundancyFileUrl[]>
40
41export 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 @@
1import { VideoModel } from '../../../models/video/video'
2import { PickWith, PickWithOpt } from '../../utils'
3import {
4 MChannelAccountDefault,
5 MChannelAccountLight,
6 MChannelAccountSummaryFormattable,
7 MChannelActor,
8 MChannelFormattable,
9 MChannelUserId
10} from './video-channels'
11import { MTag } from './tag'
12import { MVideoCaptionLanguage, MVideoCaptionLanguageUrl } from './video-caption'
13import {
14 MStreamingPlaylistFiles,
15 MStreamingPlaylistRedundancies,
16 MStreamingPlaylistRedundanciesAll,
17 MStreamingPlaylistRedundanciesOpt
18} from './video-streaming-playlist'
19import { MVideoFile, MVideoFileRedundanciesAll, MVideoFileRedundanciesOpt } from './video-file'
20import { MThumbnail } from './thumbnail'
21import { MVideoBlacklist, MVideoBlacklistLight, MVideoBlacklistUnfederated } from './video-blacklist'
22import { MScheduleVideoUpdate } from './schedule-video-update'
23import { MUserVideoHistoryTime } from '../user/user-video-history'
24
25type Use<K extends keyof VideoModel, M> = PickWith<VideoModel, K, M>
26
27// ############################################################################
28
29export 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
36export type MVideoId = Pick<MVideo, 'id'>
37export type MVideoUrl = Pick<MVideo, 'url'>
38export type MVideoUUID = Pick<MVideo, 'uuid'>
39
40export type MVideoImmutable = Pick<MVideo, 'id' | 'url' | 'uuid' | 'remote' | 'isOwned'>
41export type MVideoIdUrl = MVideoId & MVideoUrl
42export 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
49export type MVideoWithFile =
50 MVideo &
51 Use<'VideoFiles', MVideoFile[]> &
52 Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]>
53
54export type MVideoThumbnail =
55 MVideo &
56 Use<'Thumbnails', MThumbnail[]>
57
58export type MVideoIdThumbnail =
59 MVideoId &
60 Use<'Thumbnails', MThumbnail[]>
61
62export type MVideoWithFileThumbnail =
63 MVideo &
64 Use<'VideoFiles', MVideoFile[]> &
65 Use<'Thumbnails', MThumbnail[]>
66
67export type MVideoThumbnailBlacklist =
68 MVideo &
69 Use<'Thumbnails', MThumbnail[]> &
70 Use<'VideoBlacklist', MVideoBlacklistLight>
71
72export type MVideoTag =
73 MVideo &
74 Use<'Tags', MTag[]>
75
76export type MVideoWithSchedule =
77 MVideo &
78 PickWithOpt<VideoModel, 'ScheduleVideoUpdate', MScheduleVideoUpdate>
79
80export type MVideoWithCaptions =
81 MVideo &
82 Use<'VideoCaptions', MVideoCaptionLanguage[]>
83
84export type MVideoWithStreamingPlaylist =
85 MVideo &
86 Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]>
87
88// ############################################################################
89
90// Associations with not all their attributes
91
92export type MVideoUserHistory =
93 MVideo &
94 Use<'UserVideoHistories', MUserVideoHistoryTime[]>
95
96export type MVideoWithBlacklistLight =
97 MVideo &
98 Use<'VideoBlacklist', MVideoBlacklistLight>
99
100export type MVideoAccountLight =
101 MVideo &
102 Use<'VideoChannel', MChannelAccountLight>
103
104export 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
114export type MVideoWithAllFiles =
115 MVideo &
116 Use<'VideoFiles', MVideoFile[]> &
117 Use<'Thumbnails', MThumbnail[]> &
118 Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]>
119
120export 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
132export type MVideoAccountDefault =
133 MVideo &
134 Use<'VideoChannel', MChannelAccountDefault>
135
136export type MVideoThumbnailAccountDefault =
137 MVideo &
138 Use<'Thumbnails', MThumbnail[]> &
139 Use<'VideoChannel', MChannelAccountDefault>
140
141export type MVideoWithChannelActor =
142 MVideo &
143 Use<'VideoChannel', MChannelActor>
144
145export 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
160export 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
170export type MVideoAPWithoutCaption = Omit<MVideoAP, 'VideoCaptions'>
171
172export 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
183export type MVideoForUser =
184 MVideo &
185 Use<'VideoChannel', MChannelAccountDefault> &
186 Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> &
187 Use<'VideoBlacklist', MVideoBlacklistLight> &
188 Use<'Thumbnails', MThumbnail[]>
189
190export type MVideoForRedundancyAPI =
191 MVideo &
192 Use<'VideoFiles', MVideoFileRedundanciesAll[]> &
193 Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesAll[]>
194
195// ############################################################################
196
197// Format for API or AP object
198
199export 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
206export type MVideoFormattableDetails =
207 MVideoFormattable &
208 Use<'VideoChannel', MChannelFormattable> &
209 Use<'Tags', MTag[]> &
210 Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesOpt[]> &
211 Use<'VideoFiles', MVideoFileRedundanciesOpt[]>