2020-07-08 09:51:46 -04:00
|
|
|
import { BelongsTo, Column, CreatedAt, ForeignKey, Model, Table, UpdatedAt } from 'sequelize-typescript'
|
2021-12-16 12:04:16 -05:00
|
|
|
import { AttributesOnly } from '@shared/typescript-utils'
|
2020-07-01 10:05:30 -04:00
|
|
|
import { VideoCommentModel } from '../video/video-comment'
|
|
|
|
import { AbuseModel } from './abuse'
|
|
|
|
|
|
|
|
@Table({
|
|
|
|
tableName: 'commentAbuse',
|
|
|
|
indexes: [
|
|
|
|
{
|
|
|
|
fields: [ 'abuseId' ]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
fields: [ 'videoCommentId' ]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
})
|
2021-05-12 08:09:04 -04:00
|
|
|
export class VideoCommentAbuseModel extends Model<Partial<AttributesOnly<VideoCommentAbuseModel>>> {
|
2020-07-01 10:05:30 -04: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
|
|
|
|
}
|