aboutsummaryrefslogblamecommitdiffhomepage
path: root/server/models/video/video-tag.ts
blob: 1285d375bb91cebbab4237e71f5cbe3d18231463 (plain) (tree)
1
2
3
4
5
                                                                                             
                                                   

                                    
 










                           
                                                                                  

                 
 

                 
 


                               
 


                             
 
import { Column, CreatedAt, ForeignKey, Model, Table, UpdatedAt } from 'sequelize-typescript'
import { AttributesOnly } from '@shared/core-utils'
import { TagModel } from './tag'
import { VideoModel } from './video'

@Table({
  tableName: 'videoTag',
  indexes: [
    {
      fields: [ 'videoId' ]
    },
    {
      fields: [ 'tagId' ]
    }
  ]
})
export class VideoTagModel extends Model<Partial<AttributesOnly<VideoTagModel>>> {
  @CreatedAt
  createdAt: Date

  @UpdatedAt
  updatedAt: Date

  @ForeignKey(() => VideoModel)
  @Column
  videoId: number

  @ForeignKey(() => TagModel)
  @Column
  tagId: number
}