]>
Commit | Line | Data |
---|---|---|
310b5219 | 1 | import { BelongsTo, Column, CreatedAt, ForeignKey, Model, Table, UpdatedAt } from 'sequelize-typescript' |
d95d1559 C |
2 | import { VideoCommentModel } from '../video/video-comment' |
3 | import { AbuseModel } from './abuse' | |
4 | ||
5 | @Table({ | |
6 | tableName: 'commentAbuse', | |
7 | indexes: [ | |
8 | { | |
9 | fields: [ 'abuseId' ] | |
10 | }, | |
11 | { | |
12 | fields: [ 'videoCommentId' ] | |
13 | } | |
14 | ] | |
15 | }) | |
16 | export class VideoCommentAbuseModel extends Model<VideoCommentAbuseModel> { | |
17 | ||
18 | @CreatedAt | |
19 | createdAt: Date | |
20 | ||
21 | @UpdatedAt | |
22 | updatedAt: Date | |
23 | ||
d95d1559 C |
24 | @ForeignKey(() => AbuseModel) |
25 | @Column | |
26 | abuseId: number | |
27 | ||
28 | @BelongsTo(() => AbuseModel, { | |
29 | foreignKey: { | |
30 | allowNull: false | |
31 | }, | |
32 | onDelete: 'cascade' | |
33 | }) | |
34 | Abuse: AbuseModel | |
35 | ||
36 | @ForeignKey(() => VideoCommentModel) | |
37 | @Column | |
38 | videoCommentId: number | |
39 | ||
40 | @BelongsTo(() => VideoCommentModel, { | |
41 | foreignKey: { | |
42 | allowNull: true | |
43 | }, | |
44 | onDelete: 'set null' | |
45 | }) | |
46 | VideoComment: VideoCommentModel | |
47 | } |