]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/types/models/moderation/abuse.ts
Add openapi doc
[github/Chocobozzz/PeerTube.git] / server / types / models / moderation / abuse.ts
index a0bf4b08f9fde2534821c02c20ece8e81c680fb9..6fd83684c690ea9b9b6f950cc3cce613c6831868 100644 (file)
@@ -1,9 +1,10 @@
 import { VideoAbuseModel } from '@server/models/abuse/video-abuse'
 import { VideoCommentAbuseModel } from '@server/models/abuse/video-comment-abuse'
+import { VideoCommentModel } from '@server/models/video/video-comment'
 import { PickWith } from '@shared/core-utils'
 import { AbuseModel } from '../../../models/abuse/abuse'
 import { MAccountDefault, MAccountFormattable, MAccountLight, MAccountUrl } from '../account'
-import { MCommentOwner, MCommentUrl, MVideoUrl, MCommentOwnerVideo, MComment, MCommentVideo } from '../video'
+import { MComment, MCommentOwner, MCommentUrl, MCommentVideo, MVideoUrl } from '../video'
 import { MVideo, MVideoAccountLightBlacklistAllFiles } from '../video/video'
 
 type Use<K extends keyof AbuseModel, M> = PickWith<AbuseModel, K, M>
@@ -18,6 +19,10 @@ export type MVideoAbuse = Omit<VideoAbuseModel, 'Abuse' | 'Video'>
 
 export type MCommentAbuse = Omit<VideoCommentAbuseModel, 'Abuse' | 'VideoComment'>
 
+export type MAbuseReporter =
+  MAbuse &
+  Use<'ReporterAccount', MAccountDefault>
+
 // ############################################################################
 
 export type MVideoAbuseVideo =
@@ -30,7 +35,7 @@ export type MVideoAbuseVideoUrl =
 
 export type MVideoAbuseVideoFull =
   MVideoAbuse &
-  UseVideoAbuse<'Video', MVideoAccountLightBlacklistAllFiles>
+  UseVideoAbuse<'Video', Omit<MVideoAccountLightBlacklistAllFiles, 'VideoFiles' | 'VideoStreamingPlaylists'>>
 
 export type MVideoAbuseFormattable =
   MVideoAbuse &
@@ -45,7 +50,7 @@ export type MCommentAbuseAccount =
 
 export type MCommentAbuseAccountVideo =
   MCommentAbuse &
-  UseCommentAbuse<'VideoComment', MCommentOwnerVideo>
+  UseCommentAbuse<'VideoComment', MCommentOwner & PickWith<VideoCommentModel, 'Video', MVideo>>
 
 export type MCommentAbuseUrl =
   MCommentAbuse &
@@ -75,14 +80,6 @@ export type MAbuseAccountVideo =
   Use<'VideoAbuse', MVideoAbuseVideoFull> &
   Use<'ReporterAccount', MAccountDefault>
 
-export type MAbuseAP =
-  MAbuse &
-  Pick<AbuseModel, 'toActivityPubObject'> &
-  Use<'ReporterAccount', MAccountUrl> &
-  Use<'FlaggedAccount', MAccountUrl> &
-  Use<'VideoAbuse', MVideoAbuseVideo> &
-  Use<'VideoCommentAbuse', MCommentAbuseAccount>
-
 export type MAbuseFull =
   MAbuse &
   Pick<AbuseModel, 'toActivityPubObject'> &
@@ -95,9 +92,23 @@ export type MAbuseFull =
 
 // Format for API or AP object
 
-export type MAbuseFormattable =
+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>