123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- 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<TrackTask>,
- // eslint-disable-next-line no-use-before-define
- InferCreationAttributes<TrackTask>
- > {
- declare id: CreationOptional<number>;
- declare schoolId: string;
- declare semesterId: string;
- declare examId: string;
- declare extType: string;
- declare pictureType: string;
- declare outputDir: string;
- declare status: number;
- declare createdAt: CreationOptional<Date>;
- declare updatedAt: CreationOptional<Date>;
- }
- 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;
|