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

49 lines
987 B
TypeScript
Raw Normal View History

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