2017-12-12 17:53:50 +01:00
|
|
|
import { Column, CreatedAt, ForeignKey, Model, Table, UpdatedAt } from 'sequelize-typescript'
|
2021-12-16 18:04:16 +01:00
|
|
|
import { AttributesOnly } from '@shared/typescript-utils'
|
2017-12-12 17:53:50 +01:00
|
|
|
import { TagModel } from './tag'
|
|
|
|
import { VideoModel } from './video'
|
2017-05-22 20:58:25 +02:00
|
|
|
|
2017-12-12 17:53:50 +01:00
|
|
|
@Table({
|
|
|
|
tableName: 'videoTag',
|
|
|
|
indexes: [
|
|
|
|
{
|
|
|
|
fields: [ 'videoId' ]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
fields: [ 'tagId' ]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
})
|
2021-05-12 14:09:04 +02:00
|
|
|
export class VideoTagModel extends Model<Partial<AttributesOnly<VideoTagModel>>> {
|
2017-12-12 17:53:50 +01:00
|
|
|
@CreatedAt
|
|
|
|
createdAt: Date
|
2017-05-22 20:58:25 +02:00
|
|
|
|
2017-12-12 17:53:50 +01:00
|
|
|
@UpdatedAt
|
|
|
|
updatedAt: Date
|
2017-05-22 20:58:25 +02:00
|
|
|
|
2017-12-12 17:53:50 +01:00
|
|
|
@ForeignKey(() => VideoModel)
|
|
|
|
@Column
|
|
|
|
videoId: number
|
2016-12-24 16:59:17 +01:00
|
|
|
|
2017-12-12 17:53:50 +01:00
|
|
|
@ForeignKey(() => TagModel)
|
|
|
|
@Column
|
|
|
|
tagId: number
|
2016-12-24 16:59:17 +01:00
|
|
|
}
|