]>
Commit | Line | Data |
---|---|---|
d95d1559 C |
1 | import { VideoAbuseModel } from '@server/models/abuse/video-abuse' |
2 | import { VideoCommentAbuseModel } from '@server/models/abuse/video-comment-abuse' | |
668b7f09 | 3 | import { VideoCommentModel } from '@server/models/video/video-comment' |
6b5f72be | 4 | import { PickWith } from '@shared/typescript-utils' |
d95d1559 | 5 | import { AbuseModel } from '../../../models/abuse/abuse' |
668b7f09 C |
6 | import { MAccountDefault, MAccountFormattable, MAccountLight, MAccountUrl } from '../account' |
7 | import { MComment, MCommentOwner, MCommentUrl, MCommentVideo, MVideoUrl } from '../video' | |
d95d1559 C |
8 | import { MVideo, MVideoAccountLightBlacklistAllFiles } from '../video/video' |
9 | ||
10 | type Use<K extends keyof AbuseModel, M> = PickWith<AbuseModel, K, M> | |
11 | type UseVideoAbuse<K extends keyof VideoAbuseModel, M> = PickWith<VideoAbuseModel, K, M> | |
12 | type UseCommentAbuse<K extends keyof VideoCommentAbuseModel, M> = PickWith<VideoCommentAbuseModel, K, M> | |
13 | ||
14 | // ############################################################################ | |
15 | ||
16 | export type MAbuse = Omit<AbuseModel, 'VideoCommentAbuse' | 'VideoAbuse' | 'ReporterAccount' | 'FlaggedAccount' | 'toActivityPubObject'> | |
17 | ||
18 | export type MVideoAbuse = Omit<VideoAbuseModel, 'Abuse' | 'Video'> | |
19 | ||
20 | export type MCommentAbuse = Omit<VideoCommentAbuseModel, 'Abuse' | 'VideoComment'> | |
21 | ||
94148c90 C |
22 | export type MAbuseReporter = |
23 | MAbuse & | |
24 | Use<'ReporterAccount', MAccountDefault> | |
25 | ||
d95d1559 C |
26 | // ############################################################################ |
27 | ||
28 | export type MVideoAbuseVideo = | |
29 | MVideoAbuse & | |
30 | UseVideoAbuse<'Video', MVideo> | |
31 | ||
32 | export type MVideoAbuseVideoUrl = | |
33 | MVideoAbuse & | |
34 | UseVideoAbuse<'Video', MVideoUrl> | |
35 | ||
36 | export type MVideoAbuseVideoFull = | |
37 | MVideoAbuse & | |
594d3e48 | 38 | UseVideoAbuse<'Video', Omit<MVideoAccountLightBlacklistAllFiles, 'VideoFiles' | 'VideoStreamingPlaylists'>> |
d95d1559 C |
39 | |
40 | export type MVideoAbuseFormattable = | |
41 | MVideoAbuse & | |
42 | UseVideoAbuse<'Video', Pick<MVideoAccountLightBlacklistAllFiles, | |
43 | 'id' | 'uuid' | 'name' | 'nsfw' | 'getMiniatureStaticPath' | 'isBlacklisted' | 'VideoChannel'>> | |
44 | ||
45 | // ############################################################################ | |
46 | ||
47 | export type MCommentAbuseAccount = | |
48 | MCommentAbuse & | |
49 | UseCommentAbuse<'VideoComment', MCommentOwner> | |
50 | ||
51 | export type MCommentAbuseAccountVideo = | |
52 | MCommentAbuse & | |
594d3e48 | 53 | UseCommentAbuse<'VideoComment', MCommentOwner & PickWith<VideoCommentModel, 'Video', MVideo>> |
d95d1559 C |
54 | |
55 | export type MCommentAbuseUrl = | |
56 | MCommentAbuse & | |
57 | UseCommentAbuse<'VideoComment', MCommentUrl> | |
58 | ||
57f6896f C |
59 | export type MCommentAbuseFormattable = |
60 | MCommentAbuse & | |
61 | UseCommentAbuse<'VideoComment', MComment & PickWith<MCommentVideo, 'Video', Pick<MVideo, 'id' | 'uuid' | 'name'>>> | |
62 | ||
d95d1559 C |
63 | // ############################################################################ |
64 | ||
65 | export type MAbuseId = Pick<AbuseModel, 'id'> | |
66 | ||
67 | export type MAbuseVideo = | |
68 | MAbuse & | |
69 | Pick<AbuseModel, 'toActivityPubObject'> & | |
70 | Use<'VideoAbuse', MVideoAbuseVideo> | |
71 | ||
72 | export type MAbuseUrl = | |
73 | MAbuse & | |
74 | Use<'VideoAbuse', MVideoAbuseVideoUrl> & | |
75 | Use<'VideoCommentAbuse', MCommentAbuseUrl> | |
76 | ||
77 | export type MAbuseAccountVideo = | |
78 | MAbuse & | |
79 | Pick<AbuseModel, 'toActivityPubObject'> & | |
80 | Use<'VideoAbuse', MVideoAbuseVideoFull> & | |
81 | Use<'ReporterAccount', MAccountDefault> | |
82 | ||
d95d1559 C |
83 | export type MAbuseFull = |
84 | MAbuse & | |
85 | Pick<AbuseModel, 'toActivityPubObject'> & | |
86 | Use<'ReporterAccount', MAccountLight> & | |
87 | Use<'FlaggedAccount', MAccountLight> & | |
88 | Use<'VideoAbuse', MVideoAbuseVideoFull> & | |
89 | Use<'VideoCommentAbuse', MCommentAbuseAccountVideo> | |
90 | ||
91 | // ############################################################################ | |
92 | ||
93 | // Format for API or AP object | |
94 | ||
edbc9325 | 95 | export type MAbuseAdminFormattable = |
d95d1559 C |
96 | MAbuse & |
97 | Use<'ReporterAccount', MAccountFormattable> & | |
4f32032f | 98 | Use<'FlaggedAccount', MAccountFormattable> & |
57f6896f C |
99 | Use<'VideoAbuse', MVideoAbuseFormattable> & |
100 | Use<'VideoCommentAbuse', MCommentAbuseFormattable> | |
edbc9325 C |
101 | |
102 | export type MAbuseUserFormattable = | |
103 | MAbuse & | |
104 | Use<'FlaggedAccount', MAccountFormattable> & | |
105 | Use<'VideoAbuse', MVideoAbuseFormattable> & | |
106 | Use<'VideoCommentAbuse', MCommentAbuseFormattable> | |
594d3e48 C |
107 | |
108 | export type MAbuseAP = | |
109 | MAbuse & | |
110 | Pick<AbuseModel, 'toActivityPubObject'> & | |
111 | Use<'ReporterAccount', MAccountUrl> & | |
112 | Use<'FlaggedAccount', MAccountUrl> & | |
113 | Use<'VideoAbuse', MVideoAbuseVideo> & | |
114 | Use<'VideoCommentAbuse', MCommentAbuseAccount> |