PeerTube/server/core/models/abuse/video-comment-abuse.ts

49 lines
987 B
TypeScript
Raw Normal View History

2024-02-22 10:12:04 +01:00
import { BelongsTo, Column, CreatedAt, ForeignKey, Table, UpdatedAt } from 'sequelize-typescript'
import { VideoCommentModel } from '../video/video-comment.js'
import { AbuseModel } from './abuse.js'
2024-02-22 10:12:04 +01:00
import { SequelizeModel } from '../shared/index.js'
2020-07-01 16:05:30 +02:00
@Table({
tableName: 'commentAbuse',
indexes: [
{
fields: [ 'abuseId' ]
},
{
fields: [ 'videoCommentId' ]
}
]
})
2024-02-22 10:12:04 +01:00
export class VideoCommentAbuseModel extends SequelizeModel<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: Awaited<AbuseModel>
2020-07-01 16:05:30 +02:00
@ForeignKey(() => VideoCommentModel)
@Column
videoCommentId: number
@BelongsTo(() => VideoCommentModel, {
foreignKey: {
allowNull: true
},
onDelete: 'set null'
})
VideoComment: Awaited<VideoCommentModel>
2020-07-01 16:05:30 +02:00
}