aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/typings/models/video/video-comment.ts
blob: e8bccba0f097a89cbe6f8af9174456a5d8c1d965 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { VideoCommentModel } from '../../../models/video/video-comment'
import { PickWith } from '../../utils'
import { MAccountDefault, MAccountFormattable } from '../account'
import { MVideoAccountLight, MVideoFeed, MVideoIdUrl } from './video'

type Use<K extends keyof VideoCommentModel, M> = PickWith<VideoCommentModel, K, M>

// ############################################################################

export type MComment = Omit<VideoCommentModel, 'OriginVideoComment' | 'InReplyToVideoComment' | 'Video' | 'Account'>
export type MCommentTotalReplies = MComment & { totalReplies?: number }
export type MCommentId = Pick<MComment, 'id'>

// ############################################################################

export type MCommentOwner = MComment &
  Use<'Account', MAccountDefault>

export type MCommentVideo = MComment &
  Use<'Video', MVideoAccountLight>

export type MCommentReply = MComment &
  Use<'InReplyToVideoComment', MComment>

export type MCommentOwnerVideo = MComment &
  Use<'Account', MAccountDefault> &
  Use<'Video', MVideoAccountLight>

export type MCommentOwnerVideoReply = MComment &
  Use<'Account', MAccountDefault> &
  Use<'Video', MVideoAccountLight> &
  Use<'InReplyToVideoComment', MComment>

export type MCommentOwnerReplyVideoLight = MComment &
  Use<'Account', MAccountDefault> &
  Use<'InReplyToVideoComment', MComment> &
  Use<'Video', MVideoIdUrl>

export type MCommentOwnerVideoFeed = MCommentOwner &
  Use<'Video', MVideoFeed>

// ############################################################################

export type MCommentAPI = MComment & { totalReplies: number }

// ############################################################################

// Format for API or AP object

export type MCommentFormattable = MCommentTotalReplies &
  Use<'Account', MAccountFormattable>