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