1
0
Fork 0
peertube/server/models/abuse/video-comment-abuse.ts

49 lines
992 B
TypeScript
Raw Normal View History

2020-07-08 09:51:46 -04:00
import { BelongsTo, Column, CreatedAt, ForeignKey, Model, Table, UpdatedAt } from 'sequelize-typescript'
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
}