]>
Commit | Line | Data |
---|---|---|
453e83ea | 1 | import { VideoCommentModel } from '../../../models/video/video-comment' |
b5fecbf4 C |
2 | import { PickWith, PickWithOpt } from '../../utils' |
3 | import { MAccountDefault, MAccountFormattable, MAccountUrl, MActorUrl } from '../account' | |
4 | import { MVideoAccountLight, MVideoFeed, MVideoIdUrl, MVideoUrl } from './video' | |
0283eaac C |
5 | |
6 | type Use<K extends keyof VideoCommentModel, M> = PickWith<VideoCommentModel, K, M> | |
7 | ||
8 | // ############################################################################ | |
453e83ea C |
9 | |
10 | export type MComment = Omit<VideoCommentModel, 'OriginVideoComment' | 'InReplyToVideoComment' | 'Video' | 'Account'> | |
1ca9f7c3 | 11 | export type MCommentTotalReplies = MComment & { totalReplies?: number } |
453e83ea | 12 | export type MCommentId = Pick<MComment, 'id'> |
b5fecbf4 | 13 | export type MCommentUrl = Pick<MComment, 'url'> |
453e83ea | 14 | |
0283eaac | 15 | // ############################################################################ |
453e83ea C |
16 | |
17 | export type MCommentOwner = MComment & | |
0283eaac | 18 | Use<'Account', MAccountDefault> |
453e83ea C |
19 | |
20 | export type MCommentVideo = MComment & | |
0283eaac | 21 | Use<'Video', MVideoAccountLight> |
453e83ea C |
22 | |
23 | export type MCommentReply = MComment & | |
0283eaac C |
24 | Use<'InReplyToVideoComment', MComment> |
25 | ||
26 | export type MCommentOwnerVideo = MComment & | |
27 | Use<'Account', MAccountDefault> & | |
28 | Use<'Video', MVideoAccountLight> | |
453e83ea | 29 | |
0283eaac C |
30 | export type MCommentOwnerVideoReply = MComment & |
31 | Use<'Account', MAccountDefault> & | |
32 | Use<'Video', MVideoAccountLight> & | |
33 | Use<'InReplyToVideoComment', MComment> | |
453e83ea | 34 | |
0283eaac C |
35 | export type MCommentOwnerReplyVideoLight = MComment & |
36 | Use<'Account', MAccountDefault> & | |
37 | Use<'InReplyToVideoComment', MComment> & | |
38 | Use<'Video', MVideoIdUrl> | |
453e83ea C |
39 | |
40 | export type MCommentOwnerVideoFeed = MCommentOwner & | |
0283eaac C |
41 | Use<'Video', MVideoFeed> |
42 | ||
43 | // ############################################################################ | |
44 | ||
45 | export type MCommentAPI = MComment & { totalReplies: number } | |
1ca9f7c3 C |
46 | |
47 | // ############################################################################ | |
48 | ||
49 | // Format for API or AP object | |
50 | ||
51 | export type MCommentFormattable = MCommentTotalReplies & | |
52 | Use<'Account', MAccountFormattable> | |
b5fecbf4 C |
53 | |
54 | export type MCommentAP = MComment & | |
55 | Use<'Account', MAccountUrl> & | |
56 | PickWithOpt<VideoCommentModel, 'Video', MVideoUrl> & | |
57 | PickWithOpt<VideoCommentModel, 'InReplyToVideoComment', MCommentUrl> |