]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - server/types/models/video/video-comment.ts
Support video views/viewers stats in server
[github/Chocobozzz/PeerTube.git] / server / types / models / video / video-comment.ts
... / ...
CommitLineData
1import { PickWith, PickWithOpt } from '@shared/typescript-utils'
2import { VideoCommentModel } from '../../../models/video/video-comment'
3import { MAccountDefault, MAccountFormattable, MAccountUrl } from '../account'
4import { MVideo, 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 =
18 MComment &
19 Use<'Account', MAccountDefault>
20
21export type MCommentVideo =
22 MComment &
23 Use<'Video', MVideoAccountLight>
24
25export type MCommentReply =
26 MComment &
27 Use<'InReplyToVideoComment', MComment>
28
29export type MCommentOwnerVideo =
30 MComment &
31 Use<'Account', MAccountDefault> &
32 Use<'Video', MVideoAccountLight>
33
34export type MCommentOwnerVideoReply =
35 MComment &
36 Use<'Account', MAccountDefault> &
37 Use<'Video', MVideoAccountLight> &
38 Use<'InReplyToVideoComment', MComment>
39
40export type MCommentOwnerReplyVideoLight =
41 MComment &
42 Use<'Account', MAccountDefault> &
43 Use<'InReplyToVideoComment', MComment> &
44 Use<'Video', MVideoIdUrl>
45
46export type MCommentOwnerVideoFeed =
47 MCommentOwner &
48 Use<'Video', MVideoFeed>
49
50// ############################################################################
51
52export type MCommentAPI = MComment & { totalReplies: number }
53
54// ############################################################################
55
56// Format for API or AP object
57
58export type MCommentFormattable =
59 MCommentTotalReplies &
60 Use<'Account', MAccountFormattable>
61
62export type MCommentAdminFormattable =
63 MComment &
64 Use<'Account', MAccountFormattable> &
65 Use<'Video', MVideo>
66
67export type MCommentAP =
68 MComment &
69 Use<'Account', MAccountUrl> &
70 PickWithOpt<VideoCommentModel, 'Video', MVideoUrl> &
71 PickWithOpt<VideoCommentModel, 'InReplyToVideoComment', MCommentUrl>