-import { each } from 'async'
-import * as Sequelize from 'sequelize'
-
-import { addMethodsToModel } from '../utils'
-import {
- TagClass,
- TagInstance,
- TagAttributes,
-
- TagMethods
-} from './tag-interface'
-
-let Tag: Sequelize.Model<TagInstance, TagAttributes>
-let findOrCreateTags: TagMethods.FindOrCreateTags
-
-export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
- Tag = sequelize.define<TagInstance, TagAttributes>('Tag',
- {
- name: {
- type: DataTypes.STRING,
- allowNull: false
- }
- },
+import * as Bluebird from 'bluebird'
+import { Transaction } from 'sequelize'
+import { AllowNull, BelongsToMany, Column, CreatedAt, Is, Model, Table, UpdatedAt } from 'sequelize-typescript'
+import { isVideoTagValid } from '../../helpers/custom-validators/videos'
+import { throwIfNotValid } from '../utils'
+import { VideoModel } from './video'
+import { VideoTagModel } from './video-tag'
+
+@Table({
+ tableName: 'tag',
+ timestamps: false,
+ indexes: [