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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
import { VideoAbuseModel } from '@server/models/abuse/video-abuse'
import { VideoCommentAbuseModel } from '@server/models/abuse/video-comment-abuse'
import { PickWith } from '@shared/core-utils'
import { AbuseModel } from '../../../models/abuse/abuse'
import { MAccountDefault, MAccountFormattable, MAccountLight, MAccountUrl, MAccount } from '../account'
import { MCommentOwner, MCommentUrl, MVideoUrl, MCommentOwnerVideo, MComment, MCommentVideo } from '../video'
import { MVideo, MVideoAccountLightBlacklistAllFiles } from '../video/video'
import { VideoCommentModel } from '@server/models/video/video-comment'
type Use<K extends keyof AbuseModel, M> = PickWith<AbuseModel, K, M>
type UseVideoAbuse<K extends keyof VideoAbuseModel, M> = PickWith<VideoAbuseModel, K, M>
type UseCommentAbuse<K extends keyof VideoCommentAbuseModel, M> = PickWith<VideoCommentAbuseModel, K, M>
// ############################################################################
export type MAbuse = Omit<AbuseModel, 'VideoCommentAbuse' | 'VideoAbuse' | 'ReporterAccount' | 'FlaggedAccount' | 'toActivityPubObject'>
export type MVideoAbuse = Omit<VideoAbuseModel, 'Abuse' | 'Video'>
export type MCommentAbuse = Omit<VideoCommentAbuseModel, 'Abuse' | 'VideoComment'>
export type MAbuseReporter =
MAbuse &
Use<'ReporterAccount', MAccountDefault>
// ############################################################################
export type MVideoAbuseVideo =
MVideoAbuse &
UseVideoAbuse<'Video', MVideo>
export type MVideoAbuseVideoUrl =
MVideoAbuse &
UseVideoAbuse<'Video', MVideoUrl>
export type MVideoAbuseVideoFull =
MVideoAbuse &
UseVideoAbuse<'Video', Omit<MVideoAccountLightBlacklistAllFiles, 'VideoFiles' | 'VideoStreamingPlaylists'>>
export type MVideoAbuseFormattable =
MVideoAbuse &
UseVideoAbuse<'Video', Pick<MVideoAccountLightBlacklistAllFiles,
'id' | 'uuid' | 'name' | 'nsfw' | 'getMiniatureStaticPath' | 'isBlacklisted' | 'VideoChannel'>>
// ############################################################################
export type MCommentAbuseAccount =
MCommentAbuse &
UseCommentAbuse<'VideoComment', MCommentOwner>
export type MCommentAbuseAccountVideo =
MCommentAbuse &
UseCommentAbuse<'VideoComment', MCommentOwner & PickWith<VideoCommentModel, 'Video', MVideo>>
export type MCommentAbuseUrl =
MCommentAbuse &
UseCommentAbuse<'VideoComment', MCommentUrl>
export type MCommentAbuseFormattable =
MCommentAbuse &
UseCommentAbuse<'VideoComment', MComment & PickWith<MCommentVideo, 'Video', Pick<MVideo, 'id' | 'uuid' | 'name'>>>
// ############################################################################
export type MAbuseId = Pick<AbuseModel, 'id'>
export type MAbuseVideo =
MAbuse &
Pick<AbuseModel, 'toActivityPubObject'> &
Use<'VideoAbuse', MVideoAbuseVideo>
export type MAbuseUrl =
MAbuse &
Use<'VideoAbuse', MVideoAbuseVideoUrl> &
Use<'VideoCommentAbuse', MCommentAbuseUrl>
export type MAbuseAccountVideo =
MAbuse &
Pick<AbuseModel, 'toActivityPubObject'> &
Use<'VideoAbuse', MVideoAbuseVideoFull> &
Use<'ReporterAccount', MAccountDefault>
export type MAbuseFull =
MAbuse &
Pick<AbuseModel, 'toActivityPubObject'> &
Use<'ReporterAccount', MAccountLight> &
Use<'FlaggedAccount', MAccountLight> &
Use<'VideoAbuse', MVideoAbuseVideoFull> &
Use<'VideoCommentAbuse', MCommentAbuseAccountVideo>
// ############################################################################
// Format for API or AP object
export type MAbuseAdminFormattable =
MAbuse &
Use<'ReporterAccount', MAccountFormattable> &
Use<'FlaggedAccount', MAccountFormattable> &
Use<'VideoAbuse', MVideoAbuseFormattable> &
Use<'VideoCommentAbuse', MCommentAbuseFormattable>
export type MAbuseUserFormattable =
MAbuse &
Use<'FlaggedAccount', MAccountFormattable> &
Use<'VideoAbuse', MVideoAbuseFormattable> &
Use<'VideoCommentAbuse', MCommentAbuseFormattable>
export type MAbuseAP =
MAbuse &
Pick<AbuseModel, 'toActivityPubObject'> &
Use<'ReporterAccount', MAccountUrl> &
Use<'FlaggedAccount', MAccountUrl> &
Use<'VideoAbuse', MVideoAbuseVideo> &
Use<'VideoCommentAbuse', MCommentAbuseAccount>
|