2020-07-01 16:05:30 +02:00
|
|
|
import { VideoAbuseModel } from '@server/models/abuse/video-abuse'
|
|
|
|
import { VideoCommentAbuseModel } from '@server/models/abuse/video-comment-abuse'
|
2020-07-28 11:12:16 +02:00
|
|
|
import { VideoCommentModel } from '@server/models/video/video-comment'
|
2021-12-16 18:04:16 +01:00
|
|
|
import { PickWith } from '@shared/typescript-utils'
|
2020-07-01 16:05:30 +02:00
|
|
|
import { AbuseModel } from '../../../models/abuse/abuse'
|
2020-07-28 11:12:16 +02:00
|
|
|
import { MAccountDefault, MAccountFormattable, MAccountLight, MAccountUrl } from '../account'
|
|
|
|
import { MComment, MCommentOwner, MCommentUrl, MCommentVideo, MVideoUrl } from '../video'
|
2020-07-01 16:05:30 +02:00
|
|
|
import { MVideo, MVideoAccountLightBlacklistAllFiles } from '../video/video'
|
|
|
|
|
|
|
|
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'>
|
|
|
|
|
2020-07-27 11:40:30 +02:00
|
|
|
export type MAbuseReporter =
|
|
|
|
MAbuse &
|
|
|
|
Use<'ReporterAccount', MAccountDefault>
|
|
|
|
|
2020-07-01 16:05:30 +02:00
|
|
|
// ############################################################################
|
|
|
|
|
|
|
|
export type MVideoAbuseVideo =
|
|
|
|
MVideoAbuse &
|
|
|
|
UseVideoAbuse<'Video', MVideo>
|
|
|
|
|
|
|
|
export type MVideoAbuseVideoUrl =
|
|
|
|
MVideoAbuse &
|
|
|
|
UseVideoAbuse<'Video', MVideoUrl>
|
|
|
|
|
|
|
|
export type MVideoAbuseVideoFull =
|
|
|
|
MVideoAbuse &
|
2020-07-27 16:26:25 +02:00
|
|
|
UseVideoAbuse<'Video', Omit<MVideoAccountLightBlacklistAllFiles, 'VideoFiles' | 'VideoStreamingPlaylists'>>
|
2020-07-01 16:05:30 +02:00
|
|
|
|
|
|
|
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 &
|
2020-07-27 16:26:25 +02:00
|
|
|
UseCommentAbuse<'VideoComment', MCommentOwner & PickWith<VideoCommentModel, 'Video', MVideo>>
|
2020-07-01 16:05:30 +02:00
|
|
|
|
|
|
|
export type MCommentAbuseUrl =
|
|
|
|
MCommentAbuse &
|
|
|
|
UseCommentAbuse<'VideoComment', MCommentUrl>
|
|
|
|
|
2020-07-07 10:57:04 +02:00
|
|
|
export type MCommentAbuseFormattable =
|
|
|
|
MCommentAbuse &
|
|
|
|
UseCommentAbuse<'VideoComment', MComment & PickWith<MCommentVideo, 'Video', Pick<MVideo, 'id' | 'uuid' | 'name'>>>
|
|
|
|
|
2020-07-01 16:05:30 +02:00
|
|
|
// ############################################################################
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2020-07-24 15:05:51 +02:00
|
|
|
export type MAbuseAdminFormattable =
|
2020-07-01 16:05:30 +02:00
|
|
|
MAbuse &
|
|
|
|
Use<'ReporterAccount', MAccountFormattable> &
|
2020-07-07 14:34:16 +02:00
|
|
|
Use<'FlaggedAccount', MAccountFormattable> &
|
2020-07-07 10:57:04 +02:00
|
|
|
Use<'VideoAbuse', MVideoAbuseFormattable> &
|
|
|
|
Use<'VideoCommentAbuse', MCommentAbuseFormattable>
|
2020-07-24 15:05:51 +02:00
|
|
|
|
|
|
|
export type MAbuseUserFormattable =
|
|
|
|
MAbuse &
|
|
|
|
Use<'FlaggedAccount', MAccountFormattable> &
|
|
|
|
Use<'VideoAbuse', MVideoAbuseFormattable> &
|
|
|
|
Use<'VideoCommentAbuse', MCommentAbuseFormattable>
|
2020-07-27 16:26:25 +02:00
|
|
|
|
|
|
|
export type MAbuseAP =
|
|
|
|
MAbuse &
|
|
|
|
Pick<AbuseModel, 'toActivityPubObject'> &
|
|
|
|
Use<'ReporterAccount', MAccountUrl> &
|
|
|
|
Use<'FlaggedAccount', MAccountUrl> &
|
|
|
|
Use<'VideoAbuse', MVideoAbuseVideo> &
|
|
|
|
Use<'VideoCommentAbuse', MCommentAbuseAccount>
|