diff options
author | Chocobozzz <me@florianbigard.com> | 2019-08-20 19:05:31 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-08-20 19:23:10 +0200 |
commit | 1ca9f7c3f7afac2af4c4c25b98426731f7e789c6 (patch) | |
tree | 27fe65c4ea5e9250d2523033d5c65b315bfca23d /server/typings/models/video | |
parent | 0283eaac2a8e73006c66df3cf5bb9012e37450e5 (diff) | |
download | PeerTube-1ca9f7c3f7afac2af4c4c25b98426731f7e789c6.tar.gz PeerTube-1ca9f7c3f7afac2af4c4c25b98426731f7e789c6.tar.zst PeerTube-1ca9f7c3f7afac2af4c4c25b98426731f7e789c6.zip |
Type toFormattedJSON
Diffstat (limited to 'server/typings/models/video')
-rw-r--r-- | server/typings/models/video/schedule-video-update.ts | 6 | ||||
-rw-r--r-- | server/typings/models/video/video-abuse.ts | 10 | ||||
-rw-r--r-- | server/typings/models/video/video-blacklist.ts | 9 | ||||
-rw-r--r-- | server/typings/models/video/video-caption.ts | 14 | ||||
-rw-r--r-- | server/typings/models/video/video-change-ownership.ts | 11 | ||||
-rw-r--r-- | server/typings/models/video/video-channels.ts | 27 | ||||
-rw-r--r-- | server/typings/models/video/video-comment.ts | 10 | ||||
-rw-r--r-- | server/typings/models/video/video-import.ts | 11 | ||||
-rw-r--r-- | server/typings/models/video/video-playlist-element.ts | 11 | ||||
-rw-r--r-- | server/typings/models/video/video-playlist.ts | 14 | ||||
-rw-r--r-- | server/typings/models/video/video-rate.ts | 9 | ||||
-rw-r--r-- | server/typings/models/video/video.ts | 27 |
12 files changed, 139 insertions, 20 deletions
diff --git a/server/typings/models/video/schedule-video-update.ts b/server/typings/models/video/schedule-video-update.ts index 069705536..ada9af06e 100644 --- a/server/typings/models/video/schedule-video-update.ts +++ b/server/typings/models/video/schedule-video-update.ts | |||
@@ -1,3 +1,9 @@ | |||
1 | import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update' | 1 | import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update' |
2 | 2 | ||
3 | export type MScheduleVideoUpdate = Omit<ScheduleVideoUpdateModel, 'Video'> | 3 | export type MScheduleVideoUpdate = Omit<ScheduleVideoUpdateModel, 'Video'> |
4 | |||
5 | // ############################################################################ | ||
6 | |||
7 | // Format for API or AP object | ||
8 | |||
9 | export type MScheduleVideoUpdateFormattable = Pick<MScheduleVideoUpdate, 'updateAt' | 'privacy'> | ||
diff --git a/server/typings/models/video/video-abuse.ts b/server/typings/models/video/video-abuse.ts index 0474cac5b..e38c3f586 100644 --- a/server/typings/models/video/video-abuse.ts +++ b/server/typings/models/video/video-abuse.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { VideoAbuseModel } from '../../../models/video/video-abuse' | 1 | import { VideoAbuseModel } from '../../../models/video/video-abuse' |
2 | import { PickWith } from '../../utils' | 2 | import { PickWith } from '../../utils' |
3 | import { MVideo } from './video' | 3 | import { MVideo } from './video' |
4 | import { MAccountDefault } from '../account' | 4 | import { MAccountDefault, MAccountFormattable } from '../account' |
5 | 5 | ||
6 | type Use<K extends keyof VideoAbuseModel, M> = PickWith<VideoAbuseModel, K, M> | 6 | type Use<K extends keyof VideoAbuseModel, M> = PickWith<VideoAbuseModel, K, M> |
7 | 7 | ||
@@ -21,3 +21,11 @@ export type MVideoAbuseAccountVideo = MVideoAbuse & | |||
21 | Pick<VideoAbuseModel, 'toActivityPubObject'> & | 21 | Pick<VideoAbuseModel, 'toActivityPubObject'> & |
22 | Use<'Video', MVideo> & | 22 | Use<'Video', MVideo> & |
23 | Use<'Account', MAccountDefault> | 23 | Use<'Account', MAccountDefault> |
24 | |||
25 | // ############################################################################ | ||
26 | |||
27 | // Format for API or AP object | ||
28 | |||
29 | export 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 index cc539f95c..1dedfa37f 100644 --- a/server/typings/models/video/video-blacklist.ts +++ b/server/typings/models/video/video-blacklist.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { VideoBlacklistModel } from '../../../models/video/video-blacklist' | 1 | import { VideoBlacklistModel } from '../../../models/video/video-blacklist' |
2 | import { PickWith } from '@server/typings/utils' | 2 | import { PickWith } from '@server/typings/utils' |
3 | import { MVideo } from '@server/typings/models' | 3 | import { MVideo, MVideoFormattable } from '@server/typings/models' |
4 | 4 | ||
5 | type Use<K extends keyof VideoBlacklistModel, M> = PickWith<VideoBlacklistModel, K, M> | 5 | type Use<K extends keyof VideoBlacklistModel, M> = PickWith<VideoBlacklistModel, K, M> |
6 | 6 | ||
@@ -15,3 +15,10 @@ export type MVideoBlacklistUnfederated = Pick<MVideoBlacklist, 'unfederated'> | |||
15 | 15 | ||
16 | export type MVideoBlacklistVideo = MVideoBlacklist & | 16 | export type MVideoBlacklistVideo = MVideoBlacklist & |
17 | Use<'Video', MVideo> | 17 | Use<'Video', MVideo> |
18 | |||
19 | // ############################################################################ | ||
20 | |||
21 | // Format for API or AP object | ||
22 | |||
23 | export 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 index fe0e664c2..7cb2a2ad3 100644 --- a/server/typings/models/video/video-caption.ts +++ b/server/typings/models/video/video-caption.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { VideoCaptionModel } from '../../../models/video/video-caption' | 1 | import { VideoCaptionModel } from '../../../models/video/video-caption' |
2 | import { PickWith } from '@server/typings/utils' | 2 | import { FunctionProperties, PickWith } from '@server/typings/utils' |
3 | import { VideoModel } from '@server/models/video/video' | 3 | import { MVideo, MVideoUUID } from '@server/typings/models' |
4 | 4 | ||
5 | type Use<K extends keyof VideoCaptionModel, M> = PickWith<VideoCaptionModel, K, M> | 5 | type Use<K extends keyof VideoCaptionModel, M> = PickWith<VideoCaptionModel, K, M> |
6 | 6 | ||
@@ -13,4 +13,12 @@ export type MVideoCaption = Omit<VideoCaptionModel, 'Video'> | |||
13 | export type MVideoCaptionLanguage = Pick<MVideoCaption, 'language'> | 13 | export type MVideoCaptionLanguage = Pick<MVideoCaption, 'language'> |
14 | 14 | ||
15 | export type MVideoCaptionVideo = MVideoCaption & | 15 | export type MVideoCaptionVideo = MVideoCaption & |
16 | Use<'Video', Pick<VideoModel, 'id' | 'remote' | 'uuid'>> | 16 | Use<'Video', Pick<MVideo, 'id' | 'remote' | 'uuid'>> |
17 | |||
18 | // ############################################################################ | ||
19 | |||
20 | // Format for API or AP object | ||
21 | |||
22 | export 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 index 0410115c6..72634cdb2 100644 --- a/server/typings/models/video/video-change-ownership.ts +++ b/server/typings/models/video/video-change-ownership.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { VideoChangeOwnershipModel } from '@server/models/video/video-change-ownership' | 1 | import { VideoChangeOwnershipModel } from '@server/models/video/video-change-ownership' |
2 | import { PickWith } from '@server/typings/utils' | 2 | import { PickWith } from '@server/typings/utils' |
3 | import { MAccountDefault, MVideoWithFileThumbnail } from '@server/typings/models' | 3 | import { MAccountDefault, MAccountFormattable, MVideo, MVideoWithFileThumbnail } from '@server/typings/models' |
4 | 4 | ||
5 | type Use<K extends keyof VideoChangeOwnershipModel, M> = PickWith<VideoChangeOwnershipModel, K, M> | 5 | type Use<K extends keyof VideoChangeOwnershipModel, M> = PickWith<VideoChangeOwnershipModel, K, M> |
6 | 6 | ||
@@ -12,3 +12,12 @@ export type MVideoChangeOwnershipFull = MVideoChangeOwnership & | |||
12 | Use<'Initiator', MAccountDefault> & | 12 | Use<'Initiator', MAccountDefault> & |
13 | Use<'NextOwner', MAccountDefault> & | 13 | Use<'NextOwner', MAccountDefault> & |
14 | Use<'Video', MVideoWithFileThumbnail> | 14 | Use<'Video', MVideoWithFileThumbnail> |
15 | |||
16 | // ############################################################################ | ||
17 | |||
18 | // Format for API or AP object | ||
19 | |||
20 | export 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 index b6506ed9f..2be7dd7ed 100644 --- a/server/typings/models/video/video-channels.ts +++ b/server/typings/models/video/video-channels.ts | |||
@@ -1,19 +1,23 @@ | |||
1 | import { PickWith } from '../../utils' | 1 | import { FunctionProperties, PickWith, PickWithOpt } from '../../utils' |
2 | import { VideoChannelModel } from '../../../models/video/video-channel' | 2 | import { VideoChannelModel } from '../../../models/video/video-channel' |
3 | import { | 3 | import { |
4 | MAccountActor, | 4 | MAccountActor, |
5 | MAccountAPI, | 5 | MAccountAPI, |
6 | MAccountDefault, | 6 | MAccountDefault, |
7 | MAccountFormattable, | ||
7 | MAccountLight, | 8 | MAccountLight, |
8 | MAccountSummaryBlocks, | 9 | MAccountSummaryBlocks, |
10 | MAccountSummaryFormattable, | ||
9 | MAccountUserId, | 11 | MAccountUserId, |
10 | MActor, | 12 | MActor, |
11 | MActorAccountChannelId, | 13 | MActorAccountChannelId, |
12 | MActorAPI, | 14 | MActorAPI, |
13 | MActorDefault, | 15 | MActorDefault, |
14 | MActorDefaultLight, | 16 | MActorDefaultLight, |
17 | MActorFormattable, | ||
15 | MActorLight, | 18 | MActorLight, |
16 | MActorSummary | 19 | MActorSummary, |
20 | MActorSummaryFormattable | ||
17 | } from '../account' | 21 | } from '../account' |
18 | import { MVideo } from './video' | 22 | import { MVideo } from './video' |
19 | 23 | ||
@@ -86,7 +90,8 @@ export type MChannelActorAccountDefaultVideos = MChannel & | |||
86 | 90 | ||
87 | // For API | 91 | // For API |
88 | 92 | ||
89 | export type MChannelSummary = Pick<MChannel, 'id' | 'name' | 'description' | 'actorId'> & | 93 | export type MChannelSummary = FunctionProperties<MChannel> & |
94 | Pick<MChannel, 'id' | 'name' | 'description' | 'actorId'> & | ||
90 | Use<'Actor', MActorSummary> | 95 | Use<'Actor', MActorSummary> |
91 | 96 | ||
92 | export type MChannelSummaryAccount = MChannelSummary & | 97 | export type MChannelSummaryAccount = MChannelSummary & |
@@ -95,3 +100,19 @@ export type MChannelSummaryAccount = MChannelSummary & | |||
95 | export type MChannelAPI = MChannel & | 100 | export type MChannelAPI = MChannel & |
96 | Use<'Actor', MActorAPI> & | 101 | Use<'Actor', MActorAPI> & |
97 | Use<'Account', MAccountAPI> | 102 | Use<'Account', MAccountAPI> |
103 | |||
104 | // ############################################################################ | ||
105 | |||
106 | // Format for API or AP object | ||
107 | |||
108 | export type MChannelSummaryFormattable = FunctionProperties<MChannel> & | ||
109 | Pick<MChannel, 'id' | 'name'> & | ||
110 | Use<'Actor', MActorSummaryFormattable> | ||
111 | |||
112 | export type MChannelAccountSummaryFormattable = MChannelSummaryFormattable & | ||
113 | Use<'Account', MAccountSummaryFormattable> | ||
114 | |||
115 | export type MChannelFormattable = FunctionProperties<MChannel> & | ||
116 | Pick<MChannel, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'support'> & | ||
117 | Use<'Actor', MActorFormattable> & | ||
118 | PickWithOpt<VideoChannelModel, 'Account', MAccountFormattable> | ||
diff --git a/server/typings/models/video/video-comment.ts b/server/typings/models/video/video-comment.ts index 187461213..e8bccba0f 100644 --- a/server/typings/models/video/video-comment.ts +++ b/server/typings/models/video/video-comment.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { VideoCommentModel } from '../../../models/video/video-comment' | 1 | import { VideoCommentModel } from '../../../models/video/video-comment' |
2 | import { PickWith } from '../../utils' | 2 | import { PickWith } from '../../utils' |
3 | import { MAccountDefault } from '../account' | 3 | import { MAccountDefault, MAccountFormattable } from '../account' |
4 | import { MVideoAccountLight, MVideoFeed, MVideoIdUrl } from './video' | 4 | import { MVideoAccountLight, MVideoFeed, MVideoIdUrl } from './video' |
5 | 5 | ||
6 | type Use<K extends keyof VideoCommentModel, M> = PickWith<VideoCommentModel, K, M> | 6 | type Use<K extends keyof VideoCommentModel, M> = PickWith<VideoCommentModel, K, M> |
@@ -8,6 +8,7 @@ type Use<K extends keyof VideoCommentModel, M> = PickWith<VideoCommentModel, K, | |||
8 | // ############################################################################ | 8 | // ############################################################################ |
9 | 9 | ||
10 | export type MComment = Omit<VideoCommentModel, 'OriginVideoComment' | 'InReplyToVideoComment' | 'Video' | 'Account'> | 10 | export type MComment = Omit<VideoCommentModel, 'OriginVideoComment' | 'InReplyToVideoComment' | 'Video' | 'Account'> |
11 | export type MCommentTotalReplies = MComment & { totalReplies?: number } | ||
11 | export type MCommentId = Pick<MComment, 'id'> | 12 | export type MCommentId = Pick<MComment, 'id'> |
12 | 13 | ||
13 | // ############################################################################ | 14 | // ############################################################################ |
@@ -41,3 +42,10 @@ export type MCommentOwnerVideoFeed = MCommentOwner & | |||
41 | // ############################################################################ | 42 | // ############################################################################ |
42 | 43 | ||
43 | export type MCommentAPI = MComment & { totalReplies: number } | 44 | export type MCommentAPI = MComment & { totalReplies: number } |
45 | |||
46 | // ############################################################################ | ||
47 | |||
48 | // Format for API or AP object | ||
49 | |||
50 | export type MCommentFormattable = MCommentTotalReplies & | ||
51 | Use<'Account', MAccountFormattable> | ||
diff --git a/server/typings/models/video/video-import.ts b/server/typings/models/video/video-import.ts index ada723713..c6a1c5b66 100644 --- a/server/typings/models/video/video-import.ts +++ b/server/typings/models/video/video-import.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { VideoImportModel } from '@server/models/video/video-import' | 1 | import { VideoImportModel } from '@server/models/video/video-import' |
2 | import { PickWith } from '@server/typings/utils' | 2 | import { PickWith, PickWithOpt } from '@server/typings/utils' |
3 | import { MUser, MVideo, MVideoAccountLight, MVideoTag, MVideoThumbnail, MVideoWithFile } from '@server/typings/models' | 3 | import { MUser, MVideo, MVideoAccountLight, MVideoFormattable, MVideoTag, MVideoThumbnail, MVideoWithFile } from '@server/typings/models' |
4 | 4 | ||
5 | type Use<K extends keyof VideoImportModel, M> = PickWith<VideoImportModel, K, M> | 5 | type Use<K extends keyof VideoImportModel, M> = PickWith<VideoImportModel, K, M> |
6 | 6 | ||
@@ -22,3 +22,10 @@ export type MVideoImportDefault = MVideoImport & | |||
22 | export type MVideoImportDefaultFiles = MVideoImport & | 22 | export type MVideoImportDefaultFiles = MVideoImport & |
23 | Use<'User', MUser> & | 23 | Use<'User', MUser> & |
24 | Use<'Video', VideoAssociation & MVideoWithFile> | 24 | Use<'Video', VideoAssociation & MVideoWithFile> |
25 | |||
26 | // ############################################################################ | ||
27 | |||
28 | // Format for API or AP object | ||
29 | |||
30 | export 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 index 5a039d7b1..1c256fd25 100644 --- a/server/typings/models/video/video-playlist-element.ts +++ b/server/typings/models/video/video-playlist-element.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { VideoPlaylistElementModel } from '@server/models/video/video-playlist-element' | 1 | import { VideoPlaylistElementModel } from '@server/models/video/video-playlist-element' |
2 | import { PickWith } from '@server/typings/utils' | 2 | import { PickWith } from '@server/typings/utils' |
3 | import { MVideoPlaylistPrivacy, MVideoThumbnail, MVideoUrl } from '@server/typings/models' | 3 | import { MVideoFormattable, MVideoPlaylistPrivacy, MVideoThumbnail, MVideoUrl } from '@server/typings/models' |
4 | 4 | ||
5 | type Use<K extends keyof VideoPlaylistElementModel, M> = PickWith<VideoPlaylistElementModel, K, M> | 5 | type Use<K extends keyof VideoPlaylistElementModel, M> = PickWith<VideoPlaylistElementModel, K, M> |
6 | 6 | ||
@@ -23,6 +23,13 @@ export type MVideoPlaylistVideoThumbnail = MVideoPlaylistElement & | |||
23 | 23 | ||
24 | // For API | 24 | // For API |
25 | 25 | ||
26 | export type MVideoPlaylistAP = MVideoPlaylistElement & | 26 | export type MVideoPlaylistElementAP = MVideoPlaylistElement & |
27 | Use<'Video', MVideoUrl> & | 27 | Use<'Video', MVideoUrl> & |
28 | Use<'VideoPlaylist', MVideoPlaylistPrivacy> | 28 | Use<'VideoPlaylist', MVideoPlaylistPrivacy> |
29 | |||
30 | // ############################################################################ | ||
31 | |||
32 | // Format for API or AP object | ||
33 | |||
34 | export type MVideoPlaylistElementFormattable = MVideoPlaylistElement & | ||
35 | Use<'Video', MVideoFormattable> | ||
diff --git a/server/typings/models/video/video-playlist.ts b/server/typings/models/video/video-playlist.ts index 633818405..a926106c5 100644 --- a/server/typings/models/video/video-playlist.ts +++ b/server/typings/models/video/video-playlist.ts | |||
@@ -1,8 +1,8 @@ | |||
1 | import { VideoPlaylistModel } from '../../../models/video/video-playlist' | 1 | import { VideoPlaylistModel } from '../../../models/video/video-playlist' |
2 | import { PickWith } from '../../utils' | 2 | import { PickWith } from '../../utils' |
3 | import { MAccount, MAccountDefault, MAccountSummary } from '../account' | 3 | import { MAccount, MAccountDefault, MAccountSummary, MAccountSummaryFormattable } from '../account' |
4 | import { MThumbnail } from './thumbnail' | 4 | import { MThumbnail } from './thumbnail' |
5 | import { MChannelDefault, MChannelSummary } from './video-channels' | 5 | import { MChannelDefault, MChannelSummary, MChannelSummaryFormattable } from './video-channels' |
6 | import { MVideoPlaylistElementLight } from '@server/typings/models/video/video-playlist-element' | 6 | import { MVideoPlaylistElementLight } from '@server/typings/models/video/video-playlist-element' |
7 | 7 | ||
8 | type Use<K extends keyof VideoPlaylistModel, M> = PickWith<VideoPlaylistModel, K, M> | 8 | type Use<K extends keyof VideoPlaylistModel, M> = PickWith<VideoPlaylistModel, K, M> |
@@ -16,7 +16,7 @@ export type MVideoPlaylist = Omit<VideoPlaylistModel, 'OwnerAccount' | 'VideoCha | |||
16 | export type MVideoPlaylistId = Pick<MVideoPlaylist, 'id'> | 16 | export type MVideoPlaylistId = Pick<MVideoPlaylist, 'id'> |
17 | export type MVideoPlaylistPrivacy = Pick<MVideoPlaylist, 'privacy'> | 17 | export type MVideoPlaylistPrivacy = Pick<MVideoPlaylist, 'privacy'> |
18 | export type MVideoPlaylistUUID = Pick<MVideoPlaylist, 'uuid'> | 18 | export type MVideoPlaylistUUID = Pick<MVideoPlaylist, 'uuid'> |
19 | export type MVideoPlaylistVideosLength = MVideoPlaylist & { videosLength: number } | 19 | export type MVideoPlaylistVideosLength = MVideoPlaylist & { videosLength?: number } |
20 | 20 | ||
21 | // ############################################################################ | 21 | // ############################################################################ |
22 | 22 | ||
@@ -78,3 +78,11 @@ export type MVideoPlaylistFullSummary = MVideoPlaylist & | |||
78 | Use<'Thumbnail', MThumbnail> & | 78 | Use<'Thumbnail', MThumbnail> & |
79 | Use<'OwnerAccount', MAccountSummary> & | 79 | Use<'OwnerAccount', MAccountSummary> & |
80 | Use<'VideoChannel', MChannelSummary> | 80 | Use<'VideoChannel', MChannelSummary> |
81 | |||
82 | // ############################################################################ | ||
83 | |||
84 | // Format for API or AP object | ||
85 | |||
86 | export type MVideoPlaylistFormattable = MVideoPlaylistVideosLength & | ||
87 | Use<'OwnerAccount', MAccountSummaryFormattable> & | ||
88 | Use<'VideoChannel', MChannelSummaryFormattable> | ||
diff --git a/server/typings/models/video/video-rate.ts b/server/typings/models/video/video-rate.ts index fc9329993..2ff8a625b 100644 --- a/server/typings/models/video/video-rate.ts +++ b/server/typings/models/video/video-rate.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { AccountVideoRateModel } from '@server/models/account/account-video-rate' | 1 | import { AccountVideoRateModel } from '@server/models/account/account-video-rate' |
2 | import { PickWith } from '@server/typings/utils' | 2 | import { PickWith } from '@server/typings/utils' |
3 | import { MAccountAudience, MAccountUrl, MVideo } from '..' | 3 | import { MAccountAudience, MAccountUrl, MVideo, MVideoFormattable } from '..' |
4 | 4 | ||
5 | type Use<K extends keyof AccountVideoRateModel, M> = PickWith<AccountVideoRateModel, K, M> | 5 | type Use<K extends keyof AccountVideoRateModel, M> = PickWith<AccountVideoRateModel, K, M> |
6 | 6 | ||
@@ -14,3 +14,10 @@ export type MAccountVideoRateAccountUrl = MAccountVideoRate & | |||
14 | export type MAccountVideoRateAccountVideo = MAccountVideoRate & | 14 | export type MAccountVideoRateAccountVideo = MAccountVideoRate & |
15 | Use<'Account', MAccountAudience> & | 15 | Use<'Account', MAccountAudience> & |
16 | Use<'Video', MVideo> | 16 | Use<'Video', MVideo> |
17 | |||
18 | // ############################################################################ | ||
19 | |||
20 | // Format for API or AP object | ||
21 | |||
22 | export type MAccountVideoRateFormattable = Pick<MAccountVideoRate, 'type'> & | ||
23 | Use<'Video', MVideoFormattable> | ||
diff --git a/server/typings/models/video/video.ts b/server/typings/models/video/video.ts index 914eb7f57..bc6d56607 100644 --- a/server/typings/models/video/video.ts +++ b/server/typings/models/video/video.ts | |||
@@ -1,12 +1,19 @@ | |||
1 | import { VideoModel } from '../../../models/video/video' | 1 | import { VideoModel } from '../../../models/video/video' |
2 | import { PickWith, PickWithOpt } from '../../utils' | 2 | import { PickWith, PickWithOpt } from '../../utils' |
3 | import { MChannelAccountDefault, MChannelAccountLight, MChannelActor, MChannelUserId } from './video-channels' | 3 | import { |
4 | MChannelAccountDefault, | ||
5 | MChannelAccountLight, | ||
6 | MChannelAccountSummaryFormattable, | ||
7 | MChannelActor, | ||
8 | MChannelFormattable, | ||
9 | MChannelUserId | ||
10 | } from './video-channels' | ||
4 | import { MTag } from './tag' | 11 | import { MTag } from './tag' |
5 | import { MVideoCaptionLanguage } from './video-caption' | 12 | import { MVideoCaptionLanguage } from './video-caption' |
6 | import { MStreamingPlaylist, MStreamingPlaylistRedundancies } from './video-streaming-playlist' | 13 | import { MStreamingPlaylist, MStreamingPlaylistRedundancies } from './video-streaming-playlist' |
7 | import { MVideoFile, MVideoFileRedundanciesOpt } from './video-file' | 14 | import { MVideoFile, MVideoFileRedundanciesOpt } from './video-file' |
8 | import { MThumbnail } from './thumbnail' | 15 | import { MThumbnail } from './thumbnail' |
9 | import { MVideoBlacklistLight, MVideoBlacklistUnfederated } from './video-blacklist' | 16 | import { MVideoBlacklist, MVideoBlacklistLight, MVideoBlacklistUnfederated } from './video-blacklist' |
10 | import { MScheduleVideoUpdate } from './schedule-video-update' | 17 | import { MScheduleVideoUpdate } from './schedule-video-update' |
11 | import { MUserVideoHistoryTime } from '../user/user-video-history' | 18 | import { MUserVideoHistoryTime } from '../user/user-video-history' |
12 | 19 | ||
@@ -144,3 +151,19 @@ export type MVideoForUser = MVideo & | |||
144 | Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> & | 151 | Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> & |
145 | Use<'VideoBlacklist', MVideoBlacklistLight> & | 152 | Use<'VideoBlacklist', MVideoBlacklistLight> & |
146 | Use<'Thumbnails', MThumbnail[]> | 153 | Use<'Thumbnails', MThumbnail[]> |
154 | |||
155 | // ############################################################################ | ||
156 | |||
157 | // Format for API or AP object | ||
158 | |||
159 | export 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 | |||
165 | export type MVideoFormattableDetails = MVideoFormattable & | ||
166 | Use<'VideoChannel', MChannelFormattable> & | ||
167 | Use<'Tags', MTag[]> & | ||
168 | Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundancies[]> & | ||
169 | Use<'VideoFiles', MVideoFileRedundanciesOpt[]> | ||