]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/models/abuse/video-comment-abuse.ts
Move typescript utils in its own directory
[github/Chocobozzz/PeerTube.git] / server / models / abuse / video-comment-abuse.ts
CommitLineData
310b5219 1import { BelongsTo, Column, CreatedAt, ForeignKey, Model, Table, UpdatedAt } from 'sequelize-typescript'
6b5f72be 2import { AttributesOnly } from '@shared/typescript-utils'
d95d1559
C
3import { VideoCommentModel } from '../video/video-comment'
4import { AbuseModel } from './abuse'
5
6@Table({
7 tableName: 'commentAbuse',
8 indexes: [
9 {
10 fields: [ 'abuseId' ]
11 },
12 {
13 fields: [ 'videoCommentId' ]
14 }
15 ]
16})
16c016e8 17export class VideoCommentAbuseModel extends Model<Partial<AttributesOnly<VideoCommentAbuseModel>>> {
d95d1559
C
18
19 @CreatedAt
20 createdAt: Date
21
22 @UpdatedAt
23 updatedAt: Date
24
d95d1559
C
25 @ForeignKey(() => AbuseModel)
26 @Column
27 abuseId: number
28
29 @BelongsTo(() => AbuseModel, {
30 foreignKey: {
31 allowNull: false
32 },
33 onDelete: 'cascade'
34 })
35 Abuse: AbuseModel
36
37 @ForeignKey(() => VideoCommentModel)
38 @Column
39 videoCommentId: number
40
41 @BelongsTo(() => VideoCommentModel, {
42 foreignKey: {
43 allowNull: true
44 },
45 onDelete: 'set null'
46 })
47 VideoComment: VideoCommentModel
48}