123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- import {
- Model,
- DataTypes,
- CreationOptional,
- InferAttributes,
- InferCreationAttributes,
- } from 'sequelize';
- import sequelize from '../sequelizeInstance';
- import TrackTask from './trackTask';
- class TrackTaskDetail extends Model<
- // eslint-disable-next-line no-use-before-define
- InferAttributes<TrackTaskDetail>,
- // eslint-disable-next-line no-use-before-define
- InferCreationAttributes<TrackTaskDetail>
- > {
- declare id: CreationOptional<number>;
- declare trackTaskId: number;
- declare studentName: string;
- declare studentCode: string;
- declare courseName: string;
- declare courseCode: string;
- declare status: number;
- declare error: string | null;
- }
- TrackTaskDetail.init(
- {
- id: {
- type: DataTypes.INTEGER.UNSIGNED,
- autoIncrement: true,
- primaryKey: true,
- },
- trackTaskId: {
- type: DataTypes.INTEGER.UNSIGNED,
- allowNull: false,
- },
- studentName: {
- type: DataTypes.STRING,
- allowNull: false,
- },
- studentCode: {
- type: DataTypes.STRING,
- allowNull: false,
- },
- courseName: {
- type: DataTypes.STRING,
- allowNull: false,
- },
- courseCode: {
- type: DataTypes.STRING,
- allowNull: false,
- },
- status: {
- type: DataTypes.INTEGER,
- allowNull: false,
- defaultValue: 0,
- // 任务状态:0:未开始,1:运行中,2:已完成
- },
- error: {
- type: DataTypes.TEXT,
- allowNull: true,
- comment: '错误信息',
- },
- },
- {
- sequelize,
- modelName: 'TrackTaskDetail',
- underscored: true,
- tableName: 'trackTaskDetail',
- }
- );
- TrackTask.hasMany(TrackTaskDetail);
- TrackTaskDetail.belongsTo(TrackTask);
- export type TrackTaskDetailCreationAttributes =
- InferCreationAttributes<TrackTaskDetail>;
- export default TrackTaskDetail;
|