aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/types/models/moderation/abuse.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/types/models/moderation/abuse.ts')
-rw-r--r--server/types/models/moderation/abuse.ts97
1 files changed, 97 insertions, 0 deletions
diff --git a/server/types/models/moderation/abuse.ts b/server/types/models/moderation/abuse.ts
new file mode 100644
index 000000000..abbc93d6f
--- /dev/null
+++ b/server/types/models/moderation/abuse.ts
@@ -0,0 +1,97 @@
1import { VideoAbuseModel } from '@server/models/abuse/video-abuse'
2import { VideoCommentAbuseModel } from '@server/models/abuse/video-comment-abuse'
3import { PickWith } from '@shared/core-utils'
4import { AbuseModel } from '../../../models/abuse/abuse'
5import { MAccountDefault, MAccountFormattable, MAccountLight, MAccountUrl } from '../account'
6import { MCommentOwner, MCommentUrl, MVideoUrl, MCommentOwnerVideo } from '../video'
7import { MVideo, MVideoAccountLightBlacklistAllFiles } from '../video/video'
8
9type Use<K extends keyof AbuseModel, M> = PickWith<AbuseModel, K, M>
10type UseVideoAbuse<K extends keyof VideoAbuseModel, M> = PickWith<VideoAbuseModel, K, M>
11type UseCommentAbuse<K extends keyof VideoCommentAbuseModel, M> = PickWith<VideoCommentAbuseModel, K, M>
12
13// ############################################################################
14
15export type MAbuse = Omit<AbuseModel, 'VideoCommentAbuse' | 'VideoAbuse' | 'ReporterAccount' | 'FlaggedAccount' | 'toActivityPubObject'>
16
17export type MVideoAbuse = Omit<VideoAbuseModel, 'Abuse' | 'Video'>
18
19export type MCommentAbuse = Omit<VideoCommentAbuseModel, 'Abuse' | 'VideoComment'>
20
21// ############################################################################
22
23export type MVideoAbuseVideo =
24 MVideoAbuse &
25 UseVideoAbuse<'Video', MVideo>
26
27export type MVideoAbuseVideoUrl =
28 MVideoAbuse &
29 UseVideoAbuse<'Video', MVideoUrl>
30
31export type MVideoAbuseVideoFull =
32 MVideoAbuse &
33 UseVideoAbuse<'Video', MVideoAccountLightBlacklistAllFiles>
34
35export type MVideoAbuseFormattable =
36 MVideoAbuse &
37 UseVideoAbuse<'Video', Pick<MVideoAccountLightBlacklistAllFiles,
38 'id' | 'uuid' | 'name' | 'nsfw' | 'getMiniatureStaticPath' | 'isBlacklisted' | 'VideoChannel'>>
39
40// ############################################################################
41
42export type MCommentAbuseAccount =
43 MCommentAbuse &
44 UseCommentAbuse<'VideoComment', MCommentOwner>
45
46export type MCommentAbuseAccountVideo =
47 MCommentAbuse &
48 UseCommentAbuse<'VideoComment', MCommentOwnerVideo>
49
50export type MCommentAbuseUrl =
51 MCommentAbuse &
52 UseCommentAbuse<'VideoComment', MCommentUrl>
53
54// ############################################################################
55
56export type MAbuseId = Pick<AbuseModel, 'id'>
57
58export type MAbuseVideo =
59 MAbuse &
60 Pick<AbuseModel, 'toActivityPubObject'> &
61 Use<'VideoAbuse', MVideoAbuseVideo>
62
63export type MAbuseUrl =
64 MAbuse &
65 Use<'VideoAbuse', MVideoAbuseVideoUrl> &
66 Use<'VideoCommentAbuse', MCommentAbuseUrl>
67
68export type MAbuseAccountVideo =
69 MAbuse &
70 Pick<AbuseModel, 'toActivityPubObject'> &
71 Use<'VideoAbuse', MVideoAbuseVideoFull> &
72 Use<'ReporterAccount', MAccountDefault>
73
74export type MAbuseAP =
75 MAbuse &
76 Pick<AbuseModel, 'toActivityPubObject'> &
77 Use<'ReporterAccount', MAccountUrl> &
78 Use<'FlaggedAccount', MAccountUrl> &
79 Use<'VideoAbuse', MVideoAbuseVideo> &
80 Use<'VideoCommentAbuse', MCommentAbuseAccount>
81
82export type MAbuseFull =
83 MAbuse &
84 Pick<AbuseModel, 'toActivityPubObject'> &
85 Use<'ReporterAccount', MAccountLight> &
86 Use<'FlaggedAccount', MAccountLight> &
87 Use<'VideoAbuse', MVideoAbuseVideoFull> &
88 Use<'VideoCommentAbuse', MCommentAbuseAccountVideo>
89
90// ############################################################################
91
92// Format for API or AP object
93
94export type MAbuseFormattable =
95 MAbuse &
96 Use<'ReporterAccount', MAccountFormattable> &
97 Use<'VideoAbuse', MVideoAbuseFormattable>