aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/typings/models/video
diff options
context:
space:
mode:
Diffstat (limited to 'server/typings/models/video')
-rw-r--r--server/typings/models/video/index.d.ts18
-rw-r--r--server/typings/models/video/schedule-video-update.ts9
-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.ts31
-rw-r--r--server/typings/models/video/video-blacklist.ts24
-rw-r--r--server/typings/models/video/video-caption.ts24
-rw-r--r--server/typings/models/video/video-change-ownership.ts23
-rw-r--r--server/typings/models/video/video-channels.ts126
-rw-r--r--server/typings/models/video/video-comment.ts57
-rw-r--r--server/typings/models/video/video-file.ts19
-rw-r--r--server/typings/models/video/video-import.ts31
-rw-r--r--server/typings/models/video/video-playlist-element.ts34
-rw-r--r--server/typings/models/video/video-playlist.ts92
-rw-r--r--server/typings/models/video/video-rate.ts23
-rw-r--r--server/typings/models/video/video-redundancy.ts38
-rw-r--r--server/typings/models/video/video-share.ts17
-rw-r--r--server/typings/models/video/video-streaming-playlist.ts19
-rw-r--r--server/typings/models/video/video.ts169
19 files changed, 760 insertions, 0 deletions
diff --git a/server/typings/models/video/index.d.ts b/server/typings/models/video/index.d.ts
new file mode 100644
index 000000000..bd69c8a4b
--- /dev/null
+++ b/server/typings/models/video/index.d.ts
@@ -0,0 +1,18 @@
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
new file mode 100644
index 000000000..ada9af06e
--- /dev/null
+++ b/server/typings/models/video/schedule-video-update.ts
@@ -0,0 +1,9 @@
1import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update'
2
3export type MScheduleVideoUpdate = Omit<ScheduleVideoUpdateModel, 'Video'>
4
5// ############################################################################
6
7// Format for API or AP object
8
9export type MScheduleVideoUpdateFormattable = Pick<MScheduleVideoUpdate, 'updateAt' | 'privacy'>
diff --git a/server/typings/models/video/tag.ts b/server/typings/models/video/tag.ts
new file mode 100644
index 000000000..64a68873e
--- /dev/null
+++ b/server/typings/models/video/tag.ts
@@ -0,0 +1,3 @@
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
new file mode 100644
index 000000000..c03ba55ac
--- /dev/null
+++ b/server/typings/models/video/thumbnail.ts
@@ -0,0 +1,3 @@
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
new file mode 100644
index 000000000..e38c3f586
--- /dev/null
+++ b/server/typings/models/video/video-abuse.ts
@@ -0,0 +1,31 @@
1import { VideoAbuseModel } from '../../../models/video/video-abuse'
2import { PickWith } from '../../utils'
3import { 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 = MVideoAbuse &
17 Pick<VideoAbuseModel, 'toActivityPubObject'> &
18 Use<'Video', MVideo>
19
20export type MVideoAbuseAccountVideo = MVideoAbuse &
21 Pick<VideoAbuseModel, 'toActivityPubObject'> &
22 Use<'Video', MVideo> &
23 Use<'Account', MAccountDefault>
24
25// ############################################################################
26
27// Format for API or AP object
28
29export type MVideoAbuseFormattable = MVideoAbuse &
30 Use<'Account', MAccountFormattable> &
31 Use<'Video', Pick<MVideo, 'id' | 'uuid' | 'name'>>
diff --git a/server/typings/models/video/video-blacklist.ts b/server/typings/models/video/video-blacklist.ts
new file mode 100644
index 000000000..1dedfa37f
--- /dev/null
+++ b/server/typings/models/video/video-blacklist.ts
@@ -0,0 +1,24 @@
1import { VideoBlacklistModel } from '../../../models/video/video-blacklist'
2import { PickWith } from '@server/typings/utils'
3import { MVideo, MVideoFormattable } from '@server/typings/models'
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 MVideoBlacklistVideo = MVideoBlacklist &
17 Use<'Video', MVideo>
18
19// ############################################################################
20
21// Format for API or AP object
22
23export type MVideoBlacklistFormattable = MVideoBlacklist &
24 Use<'Video', MVideoFormattable>
diff --git a/server/typings/models/video/video-caption.ts b/server/typings/models/video/video-caption.ts
new file mode 100644
index 000000000..7cb2a2ad3
--- /dev/null
+++ b/server/typings/models/video/video-caption.ts
@@ -0,0 +1,24 @@
1import { VideoCaptionModel } from '../../../models/video/video-caption'
2import { FunctionProperties, PickWith } from '@server/typings/utils'
3import { MVideo, MVideoUUID } from '@server/typings/models'
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'>
14
15export type MVideoCaptionVideo = MVideoCaption &
16 Use<'Video', Pick<MVideo, 'id' | 'remote' | 'uuid'>>
17
18// ############################################################################
19
20// Format for API or AP object
21
22export type MVideoCaptionFormattable = FunctionProperties<MVideoCaption> &
23 Pick<MVideoCaption, 'language'> &
24 Use<'Video', MVideoUUID>
diff --git a/server/typings/models/video/video-change-ownership.ts b/server/typings/models/video/video-change-ownership.ts
new file mode 100644
index 000000000..72634cdb2
--- /dev/null
+++ b/server/typings/models/video/video-change-ownership.ts
@@ -0,0 +1,23 @@
1import { VideoChangeOwnershipModel } from '@server/models/video/video-change-ownership'
2import { PickWith } from '@server/typings/utils'
3import { MAccountDefault, MAccountFormattable, MVideo, MVideoWithFileThumbnail } from '@server/typings/models'
4
5type Use<K extends keyof VideoChangeOwnershipModel, M> = PickWith<VideoChangeOwnershipModel, K, M>
6
7// ############################################################################
8
9export type MVideoChangeOwnership = Omit<VideoChangeOwnershipModel, 'Initiator' | 'NextOwner' | 'Video'>
10
11export type MVideoChangeOwnershipFull = MVideoChangeOwnership &
12 Use<'Initiator', MAccountDefault> &
13 Use<'NextOwner', MAccountDefault> &
14 Use<'Video', MVideoWithFileThumbnail>
15
16// ############################################################################
17
18// Format for API or AP object
19
20export type MVideoChangeOwnershipFormattable = Pick<MVideoChangeOwnership, 'id' | 'status' | 'createdAt'> &
21 Use<'Initiator', MAccountFormattable> &
22 Use<'NextOwner', MAccountFormattable> &
23 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
new file mode 100644
index 000000000..292d0ac95
--- /dev/null
+++ b/server/typings/models/video/video-channels.ts
@@ -0,0 +1,126 @@
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 = MChannelId &
39 Use<'Actor', MActorAccountChannelId>
40
41export type MChannelUserId = Pick<MChannel, 'accountId'> &
42 Use<'Account', MAccountUserId>
43
44export type MChannelActor = MChannel &
45 Use<'Actor', MActor>
46
47export type MChannelUrl = Use<'Actor', MActorUrl>
48
49// Default scope
50export type MChannelDefault = MChannel &
51 Use<'Actor', MActorDefault>
52
53// ############################################################################
54
55// Not all association attributes
56
57export type MChannelLight = MChannel &
58 Use<'Actor', MActorDefaultLight>
59
60export type MChannelActorLight = MChannel &
61 Use<'Actor', MActorLight>
62
63export type MChannelAccountLight = MChannel &
64 Use<'Actor', MActorDefaultLight> &
65 Use<'Account', MAccountLight>
66
67// ############################################################################
68
69// Account associations
70
71export type MChannelAccountActor = MChannel &
72 Use<'Account', MAccountActor>
73
74export type MChannelAccountDefault = MChannel &
75 Use<'Actor', MActorDefault> &
76 Use<'Account', MAccountDefault>
77
78export type MChannelActorAccountActor = MChannel &
79 Use<'Account', MAccountActor> &
80 Use<'Actor', MActor>
81
82// ############################################################################
83
84// Videos associations
85export type MChannelVideos = MChannel &
86 Use<'Videos', MVideo[]>
87
88export type MChannelActorAccountDefaultVideos = MChannel &
89 Use<'Actor', MActorDefault> &
90 Use<'Account', MAccountDefault> &
91 Use<'Videos', MVideo[]>
92
93// ############################################################################
94
95// For API
96
97export type MChannelSummary = FunctionProperties<MChannel> &
98 Pick<MChannel, 'id' | 'name' | 'description' | 'actorId'> &
99 Use<'Actor', MActorSummary>
100
101export type MChannelSummaryAccount = MChannelSummary &
102 Use<'Account', MAccountSummaryBlocks>
103
104export type MChannelAPI = MChannel &
105 Use<'Actor', MActorAPI> &
106 Use<'Account', MAccountAPI>
107
108// ############################################################################
109
110// Format for API or AP object
111
112export type MChannelSummaryFormattable = FunctionProperties<MChannel> &
113 Pick<MChannel, 'id' | 'name'> &
114 Use<'Actor', MActorSummaryFormattable>
115
116export type MChannelAccountSummaryFormattable = MChannelSummaryFormattable &
117 Use<'Account', MAccountSummaryFormattable>
118
119export type MChannelFormattable = FunctionProperties<MChannel> &
120 Pick<MChannel, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'support'> &
121 Use<'Actor', MActorFormattable> &
122 PickWithOpt<VideoChannelModel, 'Account', MAccountFormattable>
123
124export type MChannelAP = Pick<MChannel, 'name' | 'description' | 'support'> &
125 Use<'Actor', MActorAP> &
126 Use<'Account', MAccountUrl>
diff --git a/server/typings/models/video/video-comment.ts b/server/typings/models/video/video-comment.ts
new file mode 100644
index 000000000..4fd1c29e8
--- /dev/null
+++ b/server/typings/models/video/video-comment.ts
@@ -0,0 +1,57 @@
1import { VideoCommentModel } from '../../../models/video/video-comment'
2import { PickWith, PickWithOpt } from '../../utils'
3import { MAccountDefault, MAccountFormattable, MAccountUrl, MActorUrl } 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 = MComment &
18 Use<'Account', MAccountDefault>
19
20export type MCommentVideo = MComment &
21 Use<'Video', MVideoAccountLight>
22
23export type MCommentReply = MComment &
24 Use<'InReplyToVideoComment', MComment>
25
26export type MCommentOwnerVideo = MComment &
27 Use<'Account', MAccountDefault> &
28 Use<'Video', MVideoAccountLight>
29
30export type MCommentOwnerVideoReply = MComment &
31 Use<'Account', MAccountDefault> &
32 Use<'Video', MVideoAccountLight> &
33 Use<'InReplyToVideoComment', MComment>
34
35export type MCommentOwnerReplyVideoLight = MComment &
36 Use<'Account', MAccountDefault> &
37 Use<'InReplyToVideoComment', MComment> &
38 Use<'Video', MVideoIdUrl>
39
40export type MCommentOwnerVideoFeed = MCommentOwner &
41 Use<'Video', MVideoFeed>
42
43// ############################################################################
44
45export type MCommentAPI = MComment & { totalReplies: number }
46
47// ############################################################################
48
49// Format for API or AP object
50
51export type MCommentFormattable = MCommentTotalReplies &
52 Use<'Account', MAccountFormattable>
53
54export type MCommentAP = MComment &
55 Use<'Account', MAccountUrl> &
56 PickWithOpt<VideoCommentModel, 'Video', MVideoUrl> &
57 PickWithOpt<VideoCommentModel, 'InReplyToVideoComment', MCommentUrl>
diff --git a/server/typings/models/video/video-file.ts b/server/typings/models/video/video-file.ts
new file mode 100644
index 000000000..484351a8d
--- /dev/null
+++ b/server/typings/models/video/video-file.ts
@@ -0,0 +1,19 @@
1import { VideoFileModel } from '../../../models/video/video-file'
2import { PickWith, PickWithOpt } from '../../utils'
3import { MVideo, MVideoUUID } from './video'
4import { MVideoRedundancyFileUrl } from './video-redundancy'
5
6type Use<K extends keyof VideoFileModel, M> = PickWith<VideoFileModel, K, M>
7
8// ############################################################################
9
10export type MVideoFile = Omit<VideoFileModel, 'Video' | 'RedundancyVideos'>
11
12export type MVideoFileVideo = MVideoFile &
13 Use<'Video', MVideo>
14
15export type MVideoFileVideoUUID = MVideoFile &
16 Use<'Video', MVideoUUID>
17
18export type MVideoFileRedundanciesOpt = MVideoFile &
19 PickWithOpt<VideoFileModel, 'RedundancyVideos', MVideoRedundancyFileUrl[]>
diff --git a/server/typings/models/video/video-import.ts b/server/typings/models/video/video-import.ts
new file mode 100644
index 000000000..c6a1c5b66
--- /dev/null
+++ b/server/typings/models/video/video-import.ts
@@ -0,0 +1,31 @@
1import { VideoImportModel } from '@server/models/video/video-import'
2import { PickWith, PickWithOpt } from '@server/typings/utils'
3import { MUser, MVideo, MVideoAccountLight, MVideoFormattable, MVideoTag, MVideoThumbnail, MVideoWithFile } from '@server/typings/models'
4
5type Use<K extends keyof VideoImportModel, M> = PickWith<VideoImportModel, K, M>
6
7// ############################################################################
8
9export type MVideoImport = Omit<VideoImportModel, 'User' | 'Video'>
10
11export type MVideoImportVideo = MVideoImport &
12 Use<'Video', MVideo>
13
14// ############################################################################
15
16type VideoAssociation = MVideoTag & MVideoAccountLight & MVideoThumbnail
17
18export type MVideoImportDefault = MVideoImport &
19 Use<'User', MUser> &
20 Use<'Video', VideoAssociation>
21
22export type MVideoImportDefaultFiles = MVideoImport &
23 Use<'User', MUser> &
24 Use<'Video', VideoAssociation & MVideoWithFile>
25
26// ############################################################################
27
28// Format for API or AP object
29
30export type MVideoImportFormattable = MVideoImport &
31 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
new file mode 100644
index 000000000..7b1b993ce
--- /dev/null
+++ b/server/typings/models/video/video-playlist-element.ts
@@ -0,0 +1,34 @@
1import { VideoPlaylistElementModel } from '@server/models/video/video-playlist-element'
2import { PickWith } from '@server/typings/utils'
3import { MVideoFormattable, MVideoPlaylistPrivacy, MVideoThumbnail, MVideoUrl } from '@server/typings/models'
4
5type Use<K extends keyof VideoPlaylistElementModel, M> = PickWith<VideoPlaylistElementModel, K, M>
6
7// ############################################################################
8
9export type MVideoPlaylistElement = Omit<VideoPlaylistElementModel, 'VideoPlaylist' | 'Video'>
10
11// ############################################################################
12
13export type MVideoPlaylistElementId = Pick<MVideoPlaylistElement, 'id'>
14
15export type MVideoPlaylistElementLight = Pick<MVideoPlaylistElement, 'id' | 'videoId' | 'startTimestamp' | 'stopTimestamp'>
16
17// ############################################################################
18
19export type MVideoPlaylistVideoThumbnail = MVideoPlaylistElement &
20 Use<'Video', MVideoThumbnail>
21
22export type MVideoPlaylistElementVideoUrlPlaylistPrivacy = MVideoPlaylistElement &
23 Use<'Video', MVideoUrl> &
24 Use<'VideoPlaylist', MVideoPlaylistPrivacy>
25
26// ############################################################################
27
28// Format for API or AP object
29
30export type MVideoPlaylistElementFormattable = MVideoPlaylistElement &
31 Use<'Video', MVideoFormattable>
32
33export type MVideoPlaylistElementAP = MVideoPlaylistElement &
34 Use<'Video', MVideoUrl>
diff --git a/server/typings/models/video/video-playlist.ts b/server/typings/models/video/video-playlist.ts
new file mode 100644
index 000000000..a40c7aca9
--- /dev/null
+++ b/server/typings/models/video/video-playlist.ts
@@ -0,0 +1,92 @@
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 = MVideoPlaylist &
26 Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]>
27
28export type MVideoPlaylistIdWithElements = MVideoPlaylistId &
29 Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]>
30
31// ############################################################################
32
33// With account
34
35export type MVideoPlaylistOwner = MVideoPlaylist &
36 Use<'OwnerAccount', MAccount>
37
38export type MVideoPlaylistOwnerDefault = MVideoPlaylist &
39 Use<'OwnerAccount', MAccountDefault>
40
41// ############################################################################
42
43// With thumbnail
44
45export type MVideoPlaylistThumbnail = MVideoPlaylist &
46 Use<'Thumbnail', MThumbnail>
47
48export type MVideoPlaylistAccountThumbnail = MVideoPlaylist &
49 Use<'OwnerAccount', MAccountDefault> &
50 Use<'Thumbnail', MThumbnail>
51
52// ############################################################################
53
54// With channel
55
56export type MVideoPlaylistAccountChannelDefault = MVideoPlaylist &
57 Use<'OwnerAccount', MAccountDefault> &
58 Use<'VideoChannel', MChannelDefault>
59
60// ############################################################################
61
62// With all associations
63
64export type MVideoPlaylistFull = MVideoPlaylist &
65 Use<'OwnerAccount', MAccountDefault> &
66 Use<'VideoChannel', MChannelDefault> &
67 Use<'Thumbnail', MThumbnail>
68
69// ############################################################################
70
71// For API
72
73export type MVideoPlaylistAccountChannelSummary = MVideoPlaylist &
74 Use<'OwnerAccount', MAccountSummary> &
75 Use<'VideoChannel', MChannelSummary>
76
77export type MVideoPlaylistFullSummary = MVideoPlaylist &
78 Use<'Thumbnail', MThumbnail> &
79 Use<'OwnerAccount', MAccountSummary> &
80 Use<'VideoChannel', MChannelSummary>
81
82// ############################################################################
83
84// Format for API or AP object
85
86export type MVideoPlaylistFormattable = MVideoPlaylistVideosLength &
87 Use<'OwnerAccount', MAccountSummaryFormattable> &
88 Use<'VideoChannel', MChannelSummaryFormattable>
89
90export type MVideoPlaylistAP = MVideoPlaylist &
91 Use<'Thumbnail', MThumbnail> &
92 Use<'VideoChannel', MChannelUrl>
diff --git a/server/typings/models/video/video-rate.ts b/server/typings/models/video/video-rate.ts
new file mode 100644
index 000000000..2ff8a625b
--- /dev/null
+++ b/server/typings/models/video/video-rate.ts
@@ -0,0 +1,23 @@
1import { AccountVideoRateModel } from '@server/models/account/account-video-rate'
2import { PickWith } from '@server/typings/utils'
3import { MAccountAudience, MAccountUrl, MVideo, MVideoFormattable } from '..'
4
5type Use<K extends keyof AccountVideoRateModel, M> = PickWith<AccountVideoRateModel, K, M>
6
7// ############################################################################
8
9export type MAccountVideoRate = Omit<AccountVideoRateModel, 'Video' | 'Account'>
10
11export type MAccountVideoRateAccountUrl = MAccountVideoRate &
12 Use<'Account', MAccountUrl>
13
14export type MAccountVideoRateAccountVideo = MAccountVideoRate &
15 Use<'Account', MAccountAudience> &
16 Use<'Video', MVideo>
17
18// ############################################################################
19
20// Format for API or AP object
21
22export type MAccountVideoRateFormattable = Pick<MAccountVideoRate, 'type'> &
23 Use<'Video', MVideoFormattable>
diff --git a/server/typings/models/video/video-redundancy.ts b/server/typings/models/video/video-redundancy.ts
new file mode 100644
index 000000000..f3846afd7
--- /dev/null
+++ b/server/typings/models/video/video-redundancy.ts
@@ -0,0 +1,38 @@
1import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy'
2import { PickWith, PickWithOpt } from '@server/typings/utils'
3import { MStreamingPlaylistVideo, MVideoFile, MVideoFileVideo, MVideoUrl } from '@server/typings/models'
4import { VideoStreamingPlaylist } from '../../../../shared/models/videos/video-streaming-playlist.model'
5import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist'
6import { VideoFile } from '../../../../shared/models/videos'
7import { VideoFileModel } from '@server/models/video/video-file'
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 = MVideoRedundancy &
20 Use<'VideoFile', MVideoFile>
21
22export type MVideoRedundancyFileVideo = MVideoRedundancy &
23 Use<'VideoFile', MVideoFileVideo>
24
25export type MVideoRedundancyStreamingPlaylistVideo = MVideoRedundancy &
26 Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo>
27
28export type MVideoRedundancyVideo = MVideoRedundancy &
29 Use<'VideoFile', MVideoFileVideo> &
30 Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo>
31
32// ############################################################################
33
34// Format for API or AP object
35
36export type MVideoRedundancyAP = MVideoRedundancy &
37 PickWithOpt<VideoRedundancyModel, 'VideoFile', MVideoFile & PickWith<VideoFileModel, 'Video', MVideoUrl>> &
38 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
new file mode 100644
index 000000000..a7a90beeb
--- /dev/null
+++ b/server/typings/models/video/video-share.ts
@@ -0,0 +1,17 @@
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 = MVideoShare &
13 Use<'Actor', MActorDefault>
14
15export type MVideoShareFull = MVideoShare &
16 Use<'Actor', MActorDefault> &
17 Use<'Video', MVideo>
diff --git a/server/typings/models/video/video-streaming-playlist.ts b/server/typings/models/video/video-streaming-playlist.ts
new file mode 100644
index 000000000..79696bcff
--- /dev/null
+++ b/server/typings/models/video/video-streaming-playlist.ts
@@ -0,0 +1,19 @@
1import { VideoStreamingPlaylistModel } from '../../../models/video/video-streaming-playlist'
2import { PickWith, PickWithOpt } from '../../utils'
3import { MVideoRedundancyFileUrl } from './video-redundancy'
4import { MVideo, MVideoUrl } from '@server/typings/models'
5
6type Use<K extends keyof VideoStreamingPlaylistModel, M> = PickWith<VideoStreamingPlaylistModel, K, M>
7
8// ############################################################################
9
10export type MStreamingPlaylist = Omit<VideoStreamingPlaylistModel, 'Video' | 'RedundancyVideos'>
11
12export type MStreamingPlaylistVideo = MStreamingPlaylist &
13 Use<'Video', MVideo>
14
15export type MStreamingPlaylistRedundancies = MStreamingPlaylist &
16 Use<'RedundancyVideos', MVideoRedundancyFileUrl[]>
17
18export type MStreamingPlaylistRedundanciesOpt = MStreamingPlaylist &
19 PickWithOpt<VideoStreamingPlaylistModel, 'RedundancyVideos', MVideoRedundancyFileUrl[]>
diff --git a/server/typings/models/video/video.ts b/server/typings/models/video/video.ts
new file mode 100644
index 000000000..be32d4617
--- /dev/null
+++ b/server/typings/models/video/video.ts
@@ -0,0 +1,169 @@
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 } from './video-caption'
13import { MStreamingPlaylist, MStreamingPlaylistRedundancies, MStreamingPlaylistRedundanciesOpt } from './video-streaming-playlist'
14import { MVideoFile, MVideoFileRedundanciesOpt } from './video-file'
15import { MThumbnail } from './thumbnail'
16import { MVideoBlacklist, MVideoBlacklistLight, MVideoBlacklistUnfederated } from './video-blacklist'
17import { MScheduleVideoUpdate } from './schedule-video-update'
18import { MUserVideoHistoryTime } from '../user/user-video-history'
19
20type Use<K extends keyof VideoModel, M> = PickWith<VideoModel, K, M>
21
22// ############################################################################
23
24export type MVideo = Omit<VideoModel, 'VideoChannel' | 'Tags' | 'Thumbnails' | 'VideoPlaylistElements' | 'VideoAbuses' |
25 'VideoFiles' | 'VideoStreamingPlaylists' | 'VideoShares' | 'AccountVideoRates' | 'VideoComments' | 'VideoViews' | 'UserVideoHistories' |
26 'ScheduleVideoUpdate' | 'VideoBlacklist' | 'VideoImport' | 'VideoCaptions'>
27
28// ############################################################################
29
30export type MVideoId = Pick<MVideo, 'id'>
31export type MVideoUrl = Pick<MVideo, 'url'>
32export type MVideoUUID = Pick<MVideo, 'uuid'>
33
34export type MVideoIdUrl = MVideoId & MVideoUrl
35export type MVideoFeed = Pick<MVideo, 'name' | 'uuid'>
36
37// ############################################################################
38
39// Video raw associations: schedules, video files, tags, thumbnails, captions, streaming playlists
40
41// "With" to not confuse with the VideoFile model
42export type MVideoWithFile = MVideo &
43 Use<'VideoFiles', MVideoFile[]>
44
45export type MVideoThumbnail = MVideo &
46 Use<'Thumbnails', MThumbnail[]>
47
48export type MVideoIdThumbnail = MVideoId &
49 Use<'Thumbnails', MThumbnail[]>
50
51export type MVideoWithFileThumbnail = MVideo &
52 Use<'VideoFiles', MVideoFile[]> &
53 Use<'Thumbnails', MThumbnail[]>
54
55export type MVideoTag = MVideo &
56 Use<'Tags', MTag[]>
57
58export type MVideoWithSchedule = MVideo &
59 PickWithOpt<VideoModel, 'ScheduleVideoUpdate', MScheduleVideoUpdate>
60
61export type MVideoWithCaptions = MVideo &
62 Use<'VideoCaptions', MVideoCaptionLanguage[]>
63
64export type MVideoWithStreamingPlaylist = MVideo &
65 Use<'VideoStreamingPlaylists', MStreamingPlaylist[]>
66
67// ############################################################################
68
69// Associations with not all their attributes
70
71export type MVideoUserHistory = MVideo &
72 Use<'UserVideoHistories', MUserVideoHistoryTime[]>
73
74export type MVideoWithBlacklistLight = MVideo &
75 Use<'VideoBlacklist', MVideoBlacklistLight>
76
77export type MVideoAccountLight = MVideo &
78 Use<'VideoChannel', MChannelAccountLight>
79
80export type MVideoWithRights = MVideo &
81 Use<'VideoBlacklist', MVideoBlacklistLight> &
82 Use<'Thumbnails', MThumbnail[]> &
83 Use<'VideoChannel', MChannelUserId>
84
85// ############################################################################
86
87// All files with some additional associations
88
89export type MVideoWithAllFiles = MVideo &
90 Use<'VideoFiles', MVideoFile[]> &
91 Use<'Thumbnails', MThumbnail[]> &
92 Use<'VideoStreamingPlaylists', MStreamingPlaylist[]>
93
94export type MVideoAccountLightBlacklistAllFiles = MVideo &
95 Use<'VideoFiles', MVideoFile[]> &
96 Use<'Thumbnails', MThumbnail[]> &
97 Use<'VideoStreamingPlaylists', MStreamingPlaylist[]> &
98 Use<'VideoChannel', MChannelAccountLight> &
99 Use<'VideoBlacklist', MVideoBlacklistLight>
100
101// ############################################################################
102
103// With account
104
105export type MVideoAccountDefault = MVideo &
106 Use<'VideoChannel', MChannelAccountDefault>
107
108export type MVideoThumbnailAccountDefault = MVideo &
109 Use<'Thumbnails', MThumbnail[]> &
110 Use<'VideoChannel', MChannelAccountDefault>
111
112export type MVideoWithChannelActor = MVideo &
113 Use<'VideoChannel', MChannelActor>
114
115export type MVideoFullLight = MVideo &
116 Use<'Thumbnails', MThumbnail[]> &
117 Use<'VideoBlacklist', MVideoBlacklistLight> &
118 Use<'Tags', MTag[]> &
119 Use<'VideoChannel', MChannelAccountLight> &
120 Use<'UserVideoHistories', MUserVideoHistoryTime[]> &
121 Use<'VideoFiles', MVideoFile[]> &
122 Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> &
123 Use<'VideoStreamingPlaylists', MStreamingPlaylist[]>
124
125// ############################################################################
126
127// API
128
129export type MVideoAP = MVideo &
130 Use<'Tags', MTag[]> &
131 Use<'VideoChannel', MChannelAccountLight> &
132 Use<'VideoStreamingPlaylists', MStreamingPlaylist[]> &
133 Use<'VideoCaptions', MVideoCaptionLanguage[]> &
134 Use<'VideoBlacklist', MVideoBlacklistUnfederated> &
135 Use<'VideoFiles', MVideoFileRedundanciesOpt[]>
136
137export type MVideoAPWithoutCaption = Omit<MVideoAP, 'VideoCaptions'>
138
139export type MVideoDetails = MVideo &
140 Use<'VideoBlacklist', MVideoBlacklistLight> &
141 Use<'Tags', MTag[]> &
142 Use<'VideoChannel', MChannelAccountLight> &
143 Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> &
144 Use<'Thumbnails', MThumbnail[]> &
145 Use<'UserVideoHistories', MUserVideoHistoryTime[]> &
146 Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundancies[]> &
147 Use<'VideoFiles', MVideoFileRedundanciesOpt[]>
148
149export type MVideoForUser = MVideo &
150 Use<'VideoChannel', MChannelAccountDefault> &
151 Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> &
152 Use<'VideoBlacklist', MVideoBlacklistLight> &
153 Use<'Thumbnails', MThumbnail[]>
154
155// ############################################################################
156
157// Format for API or AP object
158
159export type MVideoFormattable = MVideo &
160 PickWithOpt<VideoModel, 'UserVideoHistories', MUserVideoHistoryTime[]> &
161 Use<'VideoChannel', MChannelAccountSummaryFormattable> &
162 PickWithOpt<VideoModel, 'ScheduleVideoUpdate', Pick<MScheduleVideoUpdate, 'updateAt' | 'privacy'>> &
163 PickWithOpt<VideoModel, 'VideoBlacklist', Pick<MVideoBlacklist, 'reason'>>
164
165export type MVideoFormattableDetails = MVideoFormattable &
166 Use<'VideoChannel', MChannelFormattable> &
167 Use<'Tags', MTag[]> &
168 Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesOpt[]> &
169 Use<'VideoFiles', MVideoFileRedundanciesOpt[]>