import { Model, DataTypes, CreationOptional, InferAttributes, InferCreationAttributes, } from 'sequelize'; import sequelize from '../sequelizeInstance'; 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 pathRule: string; declare status: number; declare createdAt: CreationOptional; declare updatedAt: CreationOptional; } TrackTask.init( { id: { type: DataTypes.INTEGER.UNSIGNED, autoIncrement: true, primaryKey: true, }, schoolId: { type: DataTypes.STRING, allowNull: false, }, semesterId: { type: DataTypes.STRING, allowNull: false, }, examId: { type: DataTypes.STRING, allowNull: false, }, pathRule: { type: DataTypes.STRING, allowNull: false, comment: '保存路径规则', }, status: { type: DataTypes.INTEGER, allowNull: false, defaultValue: 0, // 任务状态:0:未开始,1:运行中,2:已完成 }, 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;