111 lines
2.9 KiB
JavaScript
111 lines
2.9 KiB
JavaScript
|
|
'use strict';
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 综合大题作答模型 - BigQuestionAnswer
|
|||
|
|
*
|
|||
|
|
* 对应 big_question_answers 表(2026-09-21 新增)。
|
|||
|
|
*
|
|||
|
|
* 一对一行:UNIQUE(aggregation_uid) —— 一个考生一行数据(用户明确要求的存储形态),
|
|||
|
|
* 同时与「逐题一行」的客观题表 zhongzhi_submissions / gaozhi_submissions 完全隔离。
|
|||
|
|
*
|
|||
|
|
* question_snapshot:抽题那一刻的题干快照(JSON 文本)。因 MariaDB 5.5 无 JSON 列类型,
|
|||
|
|
* 以 MEDIUMTEXT 存储,由应用层 JSON.stringify / JSON.parse 处理。
|
|||
|
|
*/
|
|||
|
|
module.exports = app => {
|
|||
|
|
const { STRING, INTEGER, DATE, TEXT } = app.Sequelize;
|
|||
|
|
|
|||
|
|
return app.model.define('BigQuestionAnswer', {
|
|||
|
|
id: {
|
|||
|
|
type: INTEGER,
|
|||
|
|
primaryKey: true,
|
|||
|
|
autoIncrement: true,
|
|||
|
|
comment: '主键ID',
|
|||
|
|
},
|
|||
|
|
aggregation_uid: {
|
|||
|
|
type: INTEGER,
|
|||
|
|
allowNull: false,
|
|||
|
|
comment: '聚合报名ID(中职/高职组 == contestants.id),唯一 → 一考生一行',
|
|||
|
|
},
|
|||
|
|
contestant_id: {
|
|||
|
|
type: INTEGER,
|
|||
|
|
allowNull: true,
|
|||
|
|
comment: '选手ID(冗余,便于管理端查证与排障)',
|
|||
|
|
},
|
|||
|
|
group: {
|
|||
|
|
type: STRING(20),
|
|||
|
|
allowNull: false,
|
|||
|
|
comment: '组别:zhongzhi/gaozhi',
|
|||
|
|
},
|
|||
|
|
big_question_id: {
|
|||
|
|
type: INTEGER,
|
|||
|
|
allowNull: true,
|
|||
|
|
comment: '抽中的大题ID',
|
|||
|
|
},
|
|||
|
|
big_question_uid: {
|
|||
|
|
type: STRING(64),
|
|||
|
|
allowNull: true,
|
|||
|
|
comment: '抽中的大题稳定标识',
|
|||
|
|
},
|
|||
|
|
question_snapshot: {
|
|||
|
|
type: TEXT('medium'),
|
|||
|
|
allowNull: true,
|
|||
|
|
comment: '抽题时刻的题干快照 JSON(防纠纷存证)',
|
|||
|
|
},
|
|||
|
|
answer_1: {
|
|||
|
|
type: TEXT,
|
|||
|
|
allowNull: true,
|
|||
|
|
comment: '第1小问作答(上限 2000 字)',
|
|||
|
|
},
|
|||
|
|
answer_2: {
|
|||
|
|
type: TEXT,
|
|||
|
|
allowNull: true,
|
|||
|
|
comment: '第2小问作答(上限 2000 字)',
|
|||
|
|
},
|
|||
|
|
answer_3: {
|
|||
|
|
type: TEXT,
|
|||
|
|
allowNull: true,
|
|||
|
|
comment: '第3小问作答(上限 2000 字)',
|
|||
|
|
},
|
|||
|
|
score_1: {
|
|||
|
|
type: INTEGER,
|
|||
|
|
allowNull: true,
|
|||
|
|
comment: '第1小问得分(0-10)',
|
|||
|
|
},
|
|||
|
|
score_2: {
|
|||
|
|
type: INTEGER,
|
|||
|
|
allowNull: true,
|
|||
|
|
comment: '第2小问得分(0-10)',
|
|||
|
|
},
|
|||
|
|
score_3: {
|
|||
|
|
type: INTEGER,
|
|||
|
|
allowNull: true,
|
|||
|
|
comment: '第3小问得分(0-10)',
|
|||
|
|
},
|
|||
|
|
total_score: {
|
|||
|
|
type: INTEGER,
|
|||
|
|
allowNull: true,
|
|||
|
|
comment: '三小问得分合计',
|
|||
|
|
},
|
|||
|
|
submit_time: {
|
|||
|
|
type: DATE,
|
|||
|
|
allowNull: true,
|
|||
|
|
comment: '随整卷正式提交写入(未提交为 NULL)',
|
|||
|
|
},
|
|||
|
|
created_at: {
|
|||
|
|
type: DATE,
|
|||
|
|
defaultValue: app.Sequelize.NOW,
|
|||
|
|
comment: '创建时间',
|
|||
|
|
},
|
|||
|
|
updated_at: {
|
|||
|
|
type: DATE,
|
|||
|
|
defaultValue: app.Sequelize.NOW,
|
|||
|
|
comment: '更新时间',
|
|||
|
|
},
|
|||
|
|
}, {
|
|||
|
|
tableName: 'big_question_answers',
|
|||
|
|
timestamps: true,
|
|||
|
|
createdAt: 'created_at',
|
|||
|
|
updatedAt: 'updated_at',
|
|||
|
|
});
|
|||
|
|
};
|