'use strict'; /** * 比赛时间配置模型 - CompetitionTime * * 存储各参赛组别的比赛时间配置,包括开始时间、结束时间、提交截止时间和Word模板路径。 * 每个组别只有一条配置记录。 * 表名:competition_times */ module.exports = app => { const { STRING, INTEGER, DATE } = app.Sequelize; const CompetitionTime = app.model.define('competition_time', { // 主键 ID,自增 id: { type: INTEGER, primaryKey: true, autoIncrement: true, comment: '时间配置唯一标识', }, // 组别:zhongzhi/gaozhi/benke/jiaoshi,唯一约束 group: { type: STRING(20), allowNull: false, unique: true, comment: '组别', }, // 比赛开始时间 start_time: { type: DATE, allowNull: true, defaultValue: null, comment: '比赛开始时间', }, // 比赛结束时间 end_time: { type: DATE, allowNull: true, defaultValue: null, comment: '比赛结束时间', }, // 作品提交截止时间 deadline: { type: DATE, allowNull: true, defaultValue: null, comment: '作品提交截止时间', }, // Word 操作题模板文件路径(相对于 app/public/ 的相对路径) word_template: { type: STRING(500), allowNull: true, defaultValue: null, comment: 'Word 操作题模板文件路径', }, // 客观题(选择题)抽取数量:考试时从该组别题库随机抽取的数量上限; // 若题库实际数量不足,则自动按实际数量封顶(题目序号自适应题目数量)。 choice_count: { type: INTEGER, allowNull: false, defaultValue: 50, comment: '选择题抽取数量', }, // 客观题(判断题)抽取数量,语义同 choice_count judge_count: { type: INTEGER, allowNull: false, defaultValue: 20, comment: '判断题抽取数量', }, // 记录创建时间 created_at: { type: DATE, allowNull: false, defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP'), comment: '创建时间', }, // 记录更新时间 updated_at: { type: DATE, allowNull: false, defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP'), comment: '更新时间', }, }, { tableName: 'competition_times', timestamps: false, underscored: true, }); return CompetitionTime; };