2020-07-08 15:51:46 +02:00
|
|
|
import { BelongsTo, Column, CreatedAt, ForeignKey, Model, Table, UpdatedAt } from 'sequelize-typescript'
|
2021-12-16 18:04:16 +01:00
|
|
|
import { AttributesOnly } from '@shared/typescript-utils'
|
2020-07-01 16:05:30 +02:00
|
|
|
import { VideoCommentModel } from '../video/video-comment'
|
|
|
|
import { AbuseModel } from './abuse'
|
|
|
|
|
|
|
|
@Table({
|
|
|
|
tableName: 'commentAbuse',
|
|
|
|
indexes: [
|
|
|
|
{
|
|
|
|
fields: [ 'abuseId' ]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
fields: [ 'videoCommentId' ]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
})
|
2021-05-12 14:09:04 +02:00
|
|
|
export class VideoCommentAbuseModel extends Model<Partial<AttributesOnly<VideoCommentAbuseModel>>> {
|
2020-07-01 16:05:30 +02:00
|
|
|
|
|
|
|
@CreatedAt
|
|
|
|
createdAt: Date
|
|
|
|
|
|
|
|
@UpdatedAt
|
|
|
|
updatedAt: Date
|
|
|
|
|
|
|
|
@ForeignKey(() => AbuseModel)
|
|
|
|
@Column
|
|
|
|
abuseId: number
|
|
|
|
|
|
|
|
@BelongsTo(() => AbuseModel, {
|
|
|
|
foreignKey: {
|
|
|
|
allowNull: false
|
|
|
|
},
|
|
|
|
onDelete: 'cascade'
|
|
|
|
})
|
|
|
|
Abuse: AbuseModel
|
|
|
|
|
|
|
|
@ForeignKey(() => VideoCommentModel)
|
|
|
|
@Column
|
|
|
|
videoCommentId: number
|
|
|
|
|
|
|
|
@BelongsTo(() => VideoCommentModel, {
|
|
|
|
foreignKey: {
|
|
|
|
allowNull: true
|
|
|
|
},
|
|
|
|
onDelete: 'set null'
|
|
|
|
})
|
|
|
|
VideoComment: VideoCommentModel
|
|
|
|
}
|