]>
Commit | Line | Data |
---|---|---|
1 | import { Column, CreatedAt, ForeignKey, Model, Table, UpdatedAt } from 'sequelize-typescript' | |
2 | import { TagModel } from './tag' | |
3 | import { VideoModel } from './video' | |
4 | ||
5 | @Table({ | |
6 | tableName: 'videoTag', | |
7 | indexes: [ | |
8 | { | |
9 | fields: [ 'videoId' ] | |
10 | }, | |
11 | { | |
12 | fields: [ 'tagId' ] | |
13 | } | |
14 | ] | |
15 | }) | |
16 | export class VideoTagModel extends Model<VideoTagModel> { | |
17 | @CreatedAt | |
18 | createdAt: Date | |
19 | ||
20 | @UpdatedAt | |
21 | updatedAt: Date | |
22 | ||
23 | @ForeignKey(() => VideoModel) | |
24 | @Column | |
25 | videoId: number | |
26 | ||
27 | @ForeignKey(() => TagModel) | |
28 | @Column | |
29 | tagId: number | |
30 | } |