]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/typings/models/video/video-comment.ts
Cleanup model types
[github/Chocobozzz/PeerTube.git] / server / typings / models / video / video-comment.ts
1 import { VideoCommentModel } from '../../../models/video/video-comment'
2 import { PickWith } from '../../utils'
3 import { MAccountDefault } from '../account'
4 import { MVideoAccountLight, MVideoFeed, MVideoIdUrl } 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 MCommentId = Pick<MComment, 'id'>
12
13 // ############################################################################
14
15 export type MCommentOwner = MComment &
16 Use<'Account', MAccountDefault>
17
18 export type MCommentVideo = MComment &
19 Use<'Video', MVideoAccountLight>
20
21 export type MCommentReply = MComment &
22 Use<'InReplyToVideoComment', MComment>
23
24 export type MCommentOwnerVideo = MComment &
25 Use<'Account', MAccountDefault> &
26 Use<'Video', MVideoAccountLight>
27
28 export type MCommentOwnerVideoReply = MComment &
29 Use<'Account', MAccountDefault> &
30 Use<'Video', MVideoAccountLight> &
31 Use<'InReplyToVideoComment', MComment>
32
33 export type MCommentOwnerReplyVideoLight = MComment &
34 Use<'Account', MAccountDefault> &
35 Use<'InReplyToVideoComment', MComment> &
36 Use<'Video', MVideoIdUrl>
37
38 export type MCommentOwnerVideoFeed = MCommentOwner &
39 Use<'Video', MVideoFeed>
40
41 // ############################################################################
42
43 export type MCommentAPI = MComment & { totalReplies: number }