aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/typings/models
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-08-21 14:31:57 +0200
committerChocobozzz <me@florianbigard.com>2019-08-21 15:23:04 +0200
commitb5fecbf44192144d1ca27c23a0b53922de288c10 (patch)
tree03e4f1048273e6de60b8eb642fb52b2a4c68e60c /server/typings/models
parentf92e7f76d43cbad173be87f47105b9a02032318a (diff)
downloadPeerTube-b5fecbf44192144d1ca27c23a0b53922de288c10.tar.gz
PeerTube-b5fecbf44192144d1ca27c23a0b53922de288c10.tar.zst
PeerTube-b5fecbf44192144d1ca27c23a0b53922de288c10.zip
Type toActivityPubObject functions
Diffstat (limited to 'server/typings/models')
-rw-r--r--server/typings/models/account/account.ts4
-rw-r--r--server/typings/models/account/actor.ts9
-rw-r--r--server/typings/models/video/video-channels.ts10
-rw-r--r--server/typings/models/video/video-comment.ts12
-rw-r--r--server/typings/models/video/video-playlist-element.ts9
-rw-r--r--server/typings/models/video/video-playlist.ts6
-rw-r--r--server/typings/models/video/video-redundancy.ts16
-rw-r--r--server/typings/models/video/video-streaming-playlist.ts7
-rw-r--r--server/typings/models/video/video.ts4
9 files changed, 58 insertions, 19 deletions
diff --git a/server/typings/models/account/account.ts b/server/typings/models/account/account.ts
index cd20fe81b..ec78fece8 100644
--- a/server/typings/models/account/account.ts
+++ b/server/typings/models/account/account.ts
@@ -1,6 +1,7 @@
1import { AccountModel } from '../../../models/account/account' 1import { AccountModel } from '../../../models/account/account'
2import { 2import {
3 MActor, 3 MActor,
4 MActorAP,
4 MActorAPI, 5 MActorAPI,
5 MActorAudience, 6 MActorAudience,
6 MActorDefault, 7 MActorDefault,
@@ -89,3 +90,6 @@ export type MAccountSummaryFormattable = FunctionProperties<MAccount> &
89export type MAccountFormattable = FunctionProperties<MAccount> & 90export type MAccountFormattable = FunctionProperties<MAccount> &
90 Pick<MAccount, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'userId'> & 91 Pick<MAccount, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'userId'> &
91 Use<'Actor', MActorFormattable> 92 Use<'Actor', MActorFormattable>
93
94export type MAccountAP = Pick<MAccount, 'name' | 'description'> &
95 Use<'Actor', MActorAP>
diff --git a/server/typings/models/account/actor.ts b/server/typings/models/account/actor.ts
index 14ab2cd5b..d4bcac4a3 100644
--- a/server/typings/models/account/actor.ts
+++ b/server/typings/models/account/actor.ts
@@ -1,5 +1,5 @@
1import { ActorModel } from '../../../models/activitypub/actor' 1import { ActorModel } from '../../../models/activitypub/actor'
2import { FunctionProperties, PickWith } from '../../utils' 2import { FunctionProperties, PickWith, PickWithOpt } from '../../utils'
3import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from './account' 3import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from './account'
4import { MServer, MServerHost, MServerHostBlocks, MServerRedundancyAllowed } from '../server' 4import { MServer, MServerHost, MServerHostBlocks, MServerRedundancyAllowed } from '../server'
5import { MAvatar, MAvatarFormattable } from './avatar' 5import { MAvatar, MAvatarFormattable } from './avatar'
@@ -29,7 +29,7 @@ export type MActorLight = Omit<MActor, 'privateKey' | 'privateKey'>
29// Some association attributes 29// Some association attributes
30 30
31export type MActorHost = Use<'Server', MServerHost> 31export type MActorHost = Use<'Server', MServerHost>
32export type MActorRedundancyAllowed = Use<'Server', MServerRedundancyAllowed> 32export type MActorRedundancyAllowedOpt = PickWithOpt<ActorModel, 'Server', MServerRedundancyAllowed>
33 33
34export type MActorDefaultLight = MActorLight & 34export type MActorDefaultLight = MActorLight &
35 Use<'Server', MServerHost> & 35 Use<'Server', MServerHost> &
@@ -115,4 +115,7 @@ export type MActorSummaryFormattable = FunctionProperties<MActor> &
115 115
116export type MActorFormattable = MActorSummaryFormattable & 116export type MActorFormattable = MActorSummaryFormattable &
117 Pick<MActor, 'id' | 'followingCount' | 'followersCount' | 'createdAt' | 'updatedAt'> & 117 Pick<MActor, 'id' | 'followingCount' | 'followersCount' | 'createdAt' | 'updatedAt'> &
118 Use<'Server', MServer> 118 Use<'Server', MServerHost & Partial<Pick<MServer, 'redundancyAllowed'>>>
119
120export type MActorAP = MActor &
121 Use<'Avatar', MAvatar>
diff --git a/server/typings/models/video/video-channels.ts b/server/typings/models/video/video-channels.ts
index 2be7dd7ed..292d0ac95 100644
--- a/server/typings/models/video/video-channels.ts
+++ b/server/typings/models/video/video-channels.ts
@@ -8,16 +8,18 @@ import {
8 MAccountLight, 8 MAccountLight,
9 MAccountSummaryBlocks, 9 MAccountSummaryBlocks,
10 MAccountSummaryFormattable, 10 MAccountSummaryFormattable,
11 MAccountUrl,
11 MAccountUserId, 12 MAccountUserId,
12 MActor, 13 MActor,
13 MActorAccountChannelId, 14 MActorAccountChannelId,
15 MActorAP,
14 MActorAPI, 16 MActorAPI,
15 MActorDefault, 17 MActorDefault,
16 MActorDefaultLight, 18 MActorDefaultLight,
17 MActorFormattable, 19 MActorFormattable,
18 MActorLight, 20 MActorLight,
19 MActorSummary, 21 MActorSummary,
20 MActorSummaryFormattable 22 MActorSummaryFormattable, MActorUrl
21} from '../account' 23} from '../account'
22import { MVideo } from './video' 24import { MVideo } from './video'
23 25
@@ -42,6 +44,8 @@ export type MChannelUserId = Pick<MChannel, 'accountId'> &
42export type MChannelActor = MChannel & 44export type MChannelActor = MChannel &
43 Use<'Actor', MActor> 45 Use<'Actor', MActor>
44 46
47export type MChannelUrl = Use<'Actor', MActorUrl>
48
45// Default scope 49// Default scope
46export type MChannelDefault = MChannel & 50export type MChannelDefault = MChannel &
47 Use<'Actor', MActorDefault> 51 Use<'Actor', MActorDefault>
@@ -116,3 +120,7 @@ export type MChannelFormattable = FunctionProperties<MChannel> &
116 Pick<MChannel, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'support'> & 120 Pick<MChannel, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'support'> &
117 Use<'Actor', MActorFormattable> & 121 Use<'Actor', MActorFormattable> &
118 PickWithOpt<VideoChannelModel, 'Account', MAccountFormattable> 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
index e8bccba0f..4fd1c29e8 100644
--- a/server/typings/models/video/video-comment.ts
+++ b/server/typings/models/video/video-comment.ts
@@ -1,7 +1,7 @@
1import { VideoCommentModel } from '../../../models/video/video-comment' 1import { VideoCommentModel } from '../../../models/video/video-comment'
2import { PickWith } from '../../utils' 2import { PickWith, PickWithOpt } from '../../utils'
3import { MAccountDefault, MAccountFormattable } from '../account' 3import { MAccountDefault, MAccountFormattable, MAccountUrl, MActorUrl } from '../account'
4import { MVideoAccountLight, MVideoFeed, MVideoIdUrl } from './video' 4import { MVideoAccountLight, MVideoFeed, MVideoIdUrl, MVideoUrl } from './video'
5 5
6type Use<K extends keyof VideoCommentModel, M> = PickWith<VideoCommentModel, K, M> 6type Use<K extends keyof VideoCommentModel, M> = PickWith<VideoCommentModel, K, M>
7 7
@@ -10,6 +10,7 @@ type Use<K extends keyof VideoCommentModel, M> = PickWith<VideoCommentModel, K,
10export type MComment = Omit<VideoCommentModel, 'OriginVideoComment' | 'InReplyToVideoComment' | 'Video' | 'Account'> 10export type MComment = Omit<VideoCommentModel, 'OriginVideoComment' | 'InReplyToVideoComment' | 'Video' | 'Account'>
11export type MCommentTotalReplies = MComment & { totalReplies?: number } 11export type MCommentTotalReplies = MComment & { totalReplies?: number }
12export type MCommentId = Pick<MComment, 'id'> 12export type MCommentId = Pick<MComment, 'id'>
13export type MCommentUrl = Pick<MComment, 'url'>
13 14
14// ############################################################################ 15// ############################################################################
15 16
@@ -49,3 +50,8 @@ export type MCommentAPI = MComment & { totalReplies: number }
49 50
50export type MCommentFormattable = MCommentTotalReplies & 51export type MCommentFormattable = MCommentTotalReplies &
51 Use<'Account', MAccountFormattable> 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-playlist-element.ts b/server/typings/models/video/video-playlist-element.ts
index 1c256fd25..7b1b993ce 100644
--- a/server/typings/models/video/video-playlist-element.ts
+++ b/server/typings/models/video/video-playlist-element.ts
@@ -19,11 +19,7 @@ export type MVideoPlaylistElementLight = Pick<MVideoPlaylistElement, 'id' | 'vid
19export type MVideoPlaylistVideoThumbnail = MVideoPlaylistElement & 19export type MVideoPlaylistVideoThumbnail = MVideoPlaylistElement &
20 Use<'Video', MVideoThumbnail> 20 Use<'Video', MVideoThumbnail>
21 21
22// ############################################################################ 22export type MVideoPlaylistElementVideoUrlPlaylistPrivacy = MVideoPlaylistElement &
23
24// For API
25
26export type MVideoPlaylistElementAP = MVideoPlaylistElement &
27 Use<'Video', MVideoUrl> & 23 Use<'Video', MVideoUrl> &
28 Use<'VideoPlaylist', MVideoPlaylistPrivacy> 24 Use<'VideoPlaylist', MVideoPlaylistPrivacy>
29 25
@@ -33,3 +29,6 @@ export type MVideoPlaylistElementAP = MVideoPlaylistElement &
33 29
34export type MVideoPlaylistElementFormattable = MVideoPlaylistElement & 30export type MVideoPlaylistElementFormattable = MVideoPlaylistElement &
35 Use<'Video', MVideoFormattable> 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
index a926106c5..a40c7aca9 100644
--- a/server/typings/models/video/video-playlist.ts
+++ b/server/typings/models/video/video-playlist.ts
@@ -2,7 +2,7 @@ import { VideoPlaylistModel } from '../../../models/video/video-playlist'
2import { PickWith } from '../../utils' 2import { PickWith } from '../../utils'
3import { MAccount, MAccountDefault, MAccountSummary, MAccountSummaryFormattable } from '../account' 3import { MAccount, MAccountDefault, MAccountSummary, MAccountSummaryFormattable } from '../account'
4import { MThumbnail } from './thumbnail' 4import { MThumbnail } from './thumbnail'
5import { MChannelDefault, MChannelSummary, MChannelSummaryFormattable } from './video-channels' 5import { MChannelDefault, MChannelSummary, MChannelSummaryFormattable, MChannelUrl } from './video-channels'
6import { MVideoPlaylistElementLight } from '@server/typings/models/video/video-playlist-element' 6import { MVideoPlaylistElementLight } from '@server/typings/models/video/video-playlist-element'
7 7
8type Use<K extends keyof VideoPlaylistModel, M> = PickWith<VideoPlaylistModel, K, M> 8type Use<K extends keyof VideoPlaylistModel, M> = PickWith<VideoPlaylistModel, K, M>
@@ -86,3 +86,7 @@ export type MVideoPlaylistFullSummary = MVideoPlaylist &
86export type MVideoPlaylistFormattable = MVideoPlaylistVideosLength & 86export type MVideoPlaylistFormattable = MVideoPlaylistVideosLength &
87 Use<'OwnerAccount', MAccountSummaryFormattable> & 87 Use<'OwnerAccount', MAccountSummaryFormattable> &
88 Use<'VideoChannel', MChannelSummaryFormattable> 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-redundancy.ts b/server/typings/models/video/video-redundancy.ts
index c25eb9c09..f3846afd7 100644
--- a/server/typings/models/video/video-redundancy.ts
+++ b/server/typings/models/video/video-redundancy.ts
@@ -1,6 +1,10 @@
1import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy' 1import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy'
2import { PickWith } from '@server/typings/utils' 2import { PickWith, PickWithOpt } from '@server/typings/utils'
3import { MStreamingPlaylistVideo, MVideoFile, MVideoFileVideo } from '@server/typings/models' 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'
4 8
5type Use<K extends keyof VideoRedundancyModel, M> = PickWith<VideoRedundancyModel, K, M> 9type Use<K extends keyof VideoRedundancyModel, M> = PickWith<VideoRedundancyModel, K, M>
6 10
@@ -24,3 +28,11 @@ export type MVideoRedundancyStreamingPlaylistVideo = MVideoRedundancy &
24export type MVideoRedundancyVideo = MVideoRedundancy & 28export type MVideoRedundancyVideo = MVideoRedundancy &
25 Use<'VideoFile', MVideoFileVideo> & 29 Use<'VideoFile', MVideoFileVideo> &
26 Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo> 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-streaming-playlist.ts b/server/typings/models/video/video-streaming-playlist.ts
index f1b3438b6..79696bcff 100644
--- a/server/typings/models/video/video-streaming-playlist.ts
+++ b/server/typings/models/video/video-streaming-playlist.ts
@@ -1,7 +1,7 @@
1import { VideoStreamingPlaylistModel } from '../../../models/video/video-streaming-playlist' 1import { VideoStreamingPlaylistModel } from '../../../models/video/video-streaming-playlist'
2import { PickWith } from '../../utils' 2import { PickWith, PickWithOpt } from '../../utils'
3import { MVideoRedundancyFileUrl } from './video-redundancy' 3import { MVideoRedundancyFileUrl } from './video-redundancy'
4import { MVideo } from '@server/typings/models' 4import { MVideo, MVideoUrl } from '@server/typings/models'
5 5
6type Use<K extends keyof VideoStreamingPlaylistModel, M> = PickWith<VideoStreamingPlaylistModel, K, M> 6type Use<K extends keyof VideoStreamingPlaylistModel, M> = PickWith<VideoStreamingPlaylistModel, K, M>
7 7
@@ -14,3 +14,6 @@ export type MStreamingPlaylistVideo = MStreamingPlaylist &
14 14
15export type MStreamingPlaylistRedundancies = MStreamingPlaylist & 15export type MStreamingPlaylistRedundancies = MStreamingPlaylist &
16 Use<'RedundancyVideos', MVideoRedundancyFileUrl[]> 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
index bc6d56607..be32d4617 100644
--- a/server/typings/models/video/video.ts
+++ b/server/typings/models/video/video.ts
@@ -10,7 +10,7 @@ import {
10} from './video-channels' 10} from './video-channels'
11import { MTag } from './tag' 11import { MTag } from './tag'
12import { MVideoCaptionLanguage } from './video-caption' 12import { MVideoCaptionLanguage } from './video-caption'
13import { MStreamingPlaylist, MStreamingPlaylistRedundancies } from './video-streaming-playlist' 13import { MStreamingPlaylist, MStreamingPlaylistRedundancies, MStreamingPlaylistRedundanciesOpt } from './video-streaming-playlist'
14import { MVideoFile, MVideoFileRedundanciesOpt } from './video-file' 14import { MVideoFile, MVideoFileRedundanciesOpt } from './video-file'
15import { MThumbnail } from './thumbnail' 15import { MThumbnail } from './thumbnail'
16import { MVideoBlacklist, MVideoBlacklistLight, MVideoBlacklistUnfederated } from './video-blacklist' 16import { MVideoBlacklist, MVideoBlacklistLight, MVideoBlacklistUnfederated } from './video-blacklist'
@@ -165,5 +165,5 @@ export type MVideoFormattable = MVideo &
165export type MVideoFormattableDetails = MVideoFormattable & 165export type MVideoFormattableDetails = MVideoFormattable &
166 Use<'VideoChannel', MChannelFormattable> & 166 Use<'VideoChannel', MChannelFormattable> &
167 Use<'Tags', MTag[]> & 167 Use<'Tags', MTag[]> &
168 Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundancies[]> & 168 Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesOpt[]> &
169 Use<'VideoFiles', MVideoFileRedundanciesOpt[]> 169 Use<'VideoFiles', MVideoFileRedundanciesOpt[]>