trackTask.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import {
  2. Model,
  3. DataTypes,
  4. CreationOptional,
  5. InferAttributes,
  6. InferCreationAttributes,
  7. } from 'sequelize';
  8. import sequelize from '../sequelizeInstance';
  9. class TrackTask extends Model<
  10. // eslint-disable-next-line no-use-before-define
  11. InferAttributes<TrackTask>,
  12. // eslint-disable-next-line no-use-before-define
  13. InferCreationAttributes<TrackTask>
  14. > {
  15. declare id: CreationOptional<number>;
  16. declare schoolId: string;
  17. declare semesterId: string;
  18. declare examId: string;
  19. declare pathRule: string;
  20. declare status: number;
  21. }
  22. TrackTask.init(
  23. {
  24. id: {
  25. type: DataTypes.INTEGER.UNSIGNED,
  26. autoIncrement: true,
  27. primaryKey: true,
  28. },
  29. schoolId: {
  30. type: DataTypes.STRING,
  31. allowNull: false,
  32. },
  33. semesterId: {
  34. type: DataTypes.STRING,
  35. allowNull: false,
  36. },
  37. examId: {
  38. type: DataTypes.STRING,
  39. allowNull: false,
  40. },
  41. pathRule: {
  42. type: DataTypes.STRING,
  43. allowNull: false,
  44. comment: '保存路径规则',
  45. },
  46. status: {
  47. type: DataTypes.INTEGER,
  48. allowNull: false,
  49. defaultValue: 0,
  50. // 任务状态:0:未开始,1:运行中,2:已完成
  51. },
  52. },
  53. {
  54. sequelize,
  55. modelName: 'TrackTask',
  56. underscored: true,
  57. tableName: 'trackTask',
  58. }
  59. );
  60. export type TrackTaskCreationAttributes = InferCreationAttributes<TrackTask>;
  61. export default TrackTask;