]>
Commit | Line | Data |
---|---|---|
310b5219 | 1 | import { BelongsTo, Column, CreatedAt, ForeignKey, Model, Table, UpdatedAt } from 'sequelize-typescript' |
16c016e8 | 2 | import { AttributesOnly } from '@shared/core-utils' |
d95d1559 C |
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 | }) | |
16c016e8 | 17 | export 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 | } |