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