diff options
Diffstat (limited to 'server/models/abuse/video-comment-abuse.ts')
-rw-r--r-- | server/models/abuse/video-comment-abuse.ts | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/server/models/abuse/video-comment-abuse.ts b/server/models/abuse/video-comment-abuse.ts new file mode 100644 index 000000000..b4cc2762e --- /dev/null +++ b/server/models/abuse/video-comment-abuse.ts | |||
@@ -0,0 +1,53 @@ | |||
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 | ||
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 | } | ||