import { Model, DataTypes, CreationOptional, InferAttributes, InferCreationAttributes, } from 'sequelize'; import sequelize from '../sequelizeInstance'; import { TRACK_TASK_STATUS } from '../enumerate'; class TrackTask extends Model< // eslint-disable-next-line no-use-before-define InferAttributes, // eslint-disable-next-line no-use-before-define InferCreationAttributes > { declare id: CreationOptional; declare schoolId: string; declare semesterId: string; declare examId: string; declare extType: string; declare pictureType: string; declare outputDir: string; declare status: number; declare createdAt: CreationOptional; declare updatedAt: CreationOptional; } TrackTask.init( { id: { type: DataTypes.INTEGER, autoIncrement: true, primaryKey: true, }, schoolId: { type: DataTypes.STRING, allowNull: false, }, semesterId: { type: DataTypes.STRING, allowNull: false, }, examId: { type: DataTypes.STRING, allowNull: false, }, extType: { type: DataTypes.STRING, allowNull: false, comment: '文件类型', }, pictureType: { type: DataTypes.STRING, allowNull: false, comment: '图片类型', }, outputDir: { type: DataTypes.STRING, allowNull: false, comment: '保存目录', }, status: { type: DataTypes.INTEGER, allowNull: false, defaultValue: TRACK_TASK_STATUS.INIT, }, createdAt: DataTypes.DATE, updatedAt: DataTypes.DATE, }, { sequelize, modelName: 'TrackTask', underscored: true, tableName: 'trackTask', } ); export type TrackTaskCreationAttributes = InferCreationAttributes< TrackTask, { omit: 'id' | 'createdAt' | 'updatedAt' } >; export default TrackTask;