]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/models/abuse/video-comment-abuse.ts
Implement abuses check params
[github/Chocobozzz/PeerTube.git] / server / models / abuse / video-comment-abuse.ts
1 import { AllowNull, BelongsTo, Column, CreatedAt, DataType, Default, ForeignKey, Model, Table, UpdatedAt } from 'sequelize-typescript'
2 import { VideoComment } from '@shared/models'
3 import { VideoCommentModel } from '../video/video-comment'
4 import { AbuseModel } from './abuse'
5
6 @Table({
7 tableName: 'commentAbuse',
8 indexes: [
9 {
10 fields: [ 'abuseId' ]
11 },
12 {
13 fields: [ 'videoCommentId' ]
14 }
15 ]
16 })
17 export class VideoCommentAbuseModel extends Model<VideoCommentAbuseModel> {
18
19 @CreatedAt
20 createdAt: Date
21
22 @UpdatedAt
23 updatedAt: Date
24
25 @AllowNull(true)
26 @Default(null)
27 @Column(DataType.JSONB)
28 deletedComment: VideoComment & { Video: { name: string, id: number, uuid: string }}
29
30 @ForeignKey(() => AbuseModel)
31 @Column
32 abuseId: number
33
34 @BelongsTo(() => AbuseModel, {
35 foreignKey: {
36 allowNull: false
37 },
38 onDelete: 'cascade'
39 })
40 Abuse: AbuseModel
41
42 @ForeignKey(() => VideoCommentModel)
43 @Column
44 videoCommentId: number
45
46 @BelongsTo(() => VideoCommentModel, {
47 foreignKey: {
48 allowNull: true
49 },
50 onDelete: 'set null'
51 })
52 VideoComment: VideoCommentModel
53 }