UpdatedAt
} from 'sequelize-typescript'
import { isAbuseModerationCommentValid, isAbuseReasonValid, isAbuseStateValid } from '@server/helpers/custom-validators/abuses'
-import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse'
+import { abusePredefinedReasonsMap, AttributesOnly } from '@shared/core-utils'
import {
AbuseFilter,
AbuseObject,
}
]
})
-export class AbuseModel extends Model {
+export class AbuseModel extends Model<Partial<AttributesOnly<AbuseModel>>> {
@AllowNull(false)
@Default(null)
}
buildBaseVideoCommentAbuse (this: MAbuseUserFormattable) {
- if (!this.VideoCommentAbuse) return null
+ // Associated video comment could have been destroyed if the video has been deleted
+ if (!this.VideoCommentAbuse || !this.VideoCommentAbuse.VideoComment) return null
- const abuseModel = this.VideoCommentAbuse
- const entity = abuseModel.VideoComment
+ const entity = this.VideoCommentAbuse.VideoComment
return {
id: entity.id,