]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - 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
6b5f72be 1import { PickWith, PickWithOpt } from '@shared/typescript-utils'
0f8d00e3 2import { VideoCommentModel } from '../../../models/video/video-comment'
d7a25329 3import { MAccountDefault, MAccountFormattable, MAccountUrl } from '../account'
0f8d00e3 4import { MVideo, MVideoAccountLight, MVideoFeed, MVideoIdUrl, MVideoUrl } from './video'
0283eaac
C
5
6type Use<K extends keyof VideoCommentModel, M> = PickWith<VideoCommentModel, K, M>
7
8// ############################################################################
453e83ea
C
9
10export type MComment = Omit<VideoCommentModel, 'OriginVideoComment' | 'InReplyToVideoComment' | 'Video' | 'Account'>
1ca9f7c3 11export type MCommentTotalReplies = MComment & { totalReplies?: number }
453e83ea 12export type MCommentId = Pick<MComment, 'id'>
b5fecbf4 13export type MCommentUrl = Pick<MComment, 'url'>
453e83ea 14
0283eaac 15// ############################################################################
453e83ea 16
a1587156
C
17export type MCommentOwner =
18 MComment &
0283eaac 19 Use<'Account', MAccountDefault>
453e83ea 20
a1587156
C
21export type MCommentVideo =
22 MComment &
0283eaac 23 Use<'Video', MVideoAccountLight>
453e83ea 24
a1587156
C
25export type MCommentReply =
26 MComment &
0283eaac
C
27 Use<'InReplyToVideoComment', MComment>
28
a1587156
C
29export type MCommentOwnerVideo =
30 MComment &
0283eaac
C
31 Use<'Account', MAccountDefault> &
32 Use<'Video', MVideoAccountLight>
453e83ea 33
a1587156
C
34export type MCommentOwnerVideoReply =
35 MComment &
0283eaac
C
36 Use<'Account', MAccountDefault> &
37 Use<'Video', MVideoAccountLight> &
38 Use<'InReplyToVideoComment', MComment>
453e83ea 39
a1587156
C
40export type MCommentOwnerReplyVideoLight =
41 MComment &
0283eaac
C
42 Use<'Account', MAccountDefault> &
43 Use<'InReplyToVideoComment', MComment> &
44 Use<'Video', MVideoIdUrl>
453e83ea 45
a1587156
C
46export type MCommentOwnerVideoFeed =
47 MCommentOwner &
0283eaac
C
48 Use<'Video', MVideoFeed>
49
50// ############################################################################
51
52export type MCommentAPI = MComment & { totalReplies: number }
1ca9f7c3
C
53
54// ############################################################################
55
56// Format for API or AP object
57
a1587156
C
58export type MCommentFormattable =
59 MCommentTotalReplies &
1ca9f7c3 60 Use<'Account', MAccountFormattable>
b5fecbf4 61
0f8d00e3
C
62export type MCommentAdminFormattable =
63 MComment &
64 Use<'Account', MAccountFormattable> &
65 Use<'Video', MVideo>
66
a1587156
C
67export type MCommentAP =
68 MComment &
b5fecbf4
C
69 Use<'Account', MAccountUrl> &
70 PickWithOpt<VideoCommentModel, 'Video', MVideoUrl> &
71 PickWithOpt<VideoCommentModel, 'InReplyToVideoComment', MCommentUrl>