]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/typings/models/video/video-comment.ts
Merge branch 'release/2.1.0' into develop
[github/Chocobozzz/PeerTube.git] / server / typings / models / video / video-comment.ts
1 import { VideoCommentModel } from '../../../models/video/video-comment'
2 import { PickWith, PickWithOpt } from '../../utils'
3 import { MAccountDefault, MAccountFormattable, MAccountUrl } from '../account'
4 import { MVideoAccountLight, MVideoFeed, MVideoIdUrl, MVideoUrl } from './video'
5
6 type Use<K extends keyof VideoCommentModel, M> = PickWith<VideoCommentModel, K, M>
7
8 // ############################################################################
9
10 export type MComment = Omit<VideoCommentModel, 'OriginVideoComment' | 'InReplyToVideoComment' | 'Video' | 'Account'>
11 export type MCommentTotalReplies = MComment & { totalReplies?: number }
12 export type MCommentId = Pick<MComment, 'id'>
13 export type MCommentUrl = Pick<MComment, 'url'>
14
15 // ############################################################################
16
17 export type MCommentOwner =
18 MComment &
19 Use<'Account', MAccountDefault>
20
21 export type MCommentVideo =
22 MComment &
23 Use<'Video', MVideoAccountLight>
24
25 export type MCommentReply =
26 MComment &
27 Use<'InReplyToVideoComment', MComment>
28
29 export type MCommentOwnerVideo =
30 MComment &
31 Use<'Account', MAccountDefault> &
32 Use<'Video', MVideoAccountLight>
33
34 export type MCommentOwnerVideoReply =
35 MComment &
36 Use<'Account', MAccountDefault> &
37 Use<'Video', MVideoAccountLight> &
38 Use<'InReplyToVideoComment', MComment>
39
40 export type MCommentOwnerReplyVideoLight =
41 MComment &
42 Use<'Account', MAccountDefault> &
43 Use<'InReplyToVideoComment', MComment> &
44 Use<'Video', MVideoIdUrl>
45
46 export type MCommentOwnerVideoFeed =
47 MCommentOwner &
48 Use<'Video', MVideoFeed>
49
50 // ############################################################################
51
52 export type MCommentAPI = MComment & { totalReplies: number }
53
54 // ############################################################################
55
56 // Format for API or AP object
57
58 export type MCommentFormattable =
59 MCommentTotalReplies &
60 Use<'Account', MAccountFormattable>
61
62 export type MCommentAP =
63 MComment &
64 Use<'Account', MAccountUrl> &
65 PickWithOpt<VideoCommentModel, 'Video', MVideoUrl> &
66 PickWithOpt<VideoCommentModel, 'InReplyToVideoComment', MCommentUrl>