aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/types/models/video/video-comment.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/types/models/video/video-comment.ts')
-rw-r--r--server/types/models/video/video-comment.ts66
1 files changed, 66 insertions, 0 deletions
diff --git a/server/types/models/video/video-comment.ts b/server/types/models/video/video-comment.ts
new file mode 100644
index 000000000..d6e0b66f5
--- /dev/null
+++ b/server/types/models/video/video-comment.ts
@@ -0,0 +1,66 @@
1import { VideoCommentModel } from '../../../models/video/video-comment'
2import { PickWith, PickWithOpt } from '../../utils'
3import { MAccountDefault, MAccountFormattable, MAccountUrl } 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 =
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 MCommentAP =
63 MComment &
64 Use<'Account', MAccountUrl> &
65 PickWithOpt<VideoCommentModel, 'Video', MVideoUrl> &
66 PickWithOpt<VideoCommentModel, 'InReplyToVideoComment', MCommentUrl>