- @BeforeDestroy
- static async sendDeleteIfOwned (instance: VideoCommentModel, options) {
- if (!instance.Account || !instance.Account.Actor) {
- instance.Account = await instance.$get('Account', {
- include: [ ActorModel ],
- transaction: options.transaction
- }) as AccountModel
- }
-
- if (!instance.Video) {
- instance.Video = await instance.$get('Video', {
- include: [
- {
- model: VideoChannelModel,
- include: [
- {
- model: AccountModel,
- include: [
- {
- model: ActorModel
- }
- ]
- }
- ]
- }
- ],
- transaction: options.transaction
- }) as VideoModel
- }
-
- if (instance.isOwned()) {
- await sendDeleteVideoComment(instance, options.transaction)
- }
- }
+ @HasMany(() => VideoCommentAbuseModel, {
+ foreignKey: {
+ name: 'videoCommentId',
+ allowNull: true
+ },
+ onDelete: 'set null'
+ })
+ CommentAbuses: VideoCommentAbuseModel[]