]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - server/typings/models/video/video-comment.ts
Merge branch 'release/1.4.0' into develop
[github/Chocobozzz/PeerTube.git] / server / typings / models / video / video-comment.ts
... / ...
CommitLineData
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>