Files
competition-website/app/model/competitionTime.js
WorkBuddy a303cf2d53 chore: 后端首次基线提交
运行必须源码:app/(controller/model/service/middleware/lib/utils/validate/router)、config/、database/(migrations/seeders/sql)、启动脚本、app/public/templates 模板。
已忽略运行非必须:node_modules/、logs/、run/、app/public 运行时上传数据、.env*、构建/缓存产物。
2026-08-17 12:25:42 +08:00

94 lines
2.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
'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;
};