|
@@ -0,0 +1,87 @@
|
|
|
+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;
|