'use strict'; /** * 综合大题模型 - BigQuestion * * 对应 big_questions 表(2026-09-21 新增)。 * 中职组(zhongzhi) / 高职组(gaozhi) 取消 Word 文件上传题后,改为从本表随机抽取一道大题: * 题干 = 文字描述 + 富文本表格(HTML),下设三小问,每小问 score_per_sub 分(默认 10), * 大题总分 total_score(默认 30)。 * * 说明:本模型为**新增隔离模型**,与既有 word_questions(已弃用)互不影响, * 也不参与 choice_questions / judge_questions 客观题链路。 */ module.exports = app => { const { STRING, INTEGER, DATE, TEXT } = app.Sequelize; // 分数列统一走共享工厂(DECIMAL(6,2) + Number 兜底,见 app/lib/decimal_score.js) const decimalScore = require('../lib/decimal_score')(app); return app.model.define('BigQuestion', { id: { type: INTEGER, primaryKey: true, autoIncrement: true, comment: '大题ID', }, question_uid: { type: STRING(64), allowNull: false, comment: '大题稳定标识(全局唯一,形如 big_12)', }, group: { type: STRING(20), allowNull: false, comment: '组别:zhongzhi/gaozhi', }, title: { type: STRING(200), allowNull: false, comment: '大题标题', }, description: { type: TEXT('medium'), allowNull: true, comment: '题干富文本 HTML(含表格)', }, sub_prompt_1: { type: TEXT, allowNull: true, comment: '第1小问题干', }, sub_prompt_2: { type: TEXT, allowNull: true, comment: '第2小问题干', }, sub_prompt_3: { type: TEXT, allowNull: true, comment: '第3小问题干', }, score_per_sub: decimalScore('score_per_sub', '每小题分值', { allowNull: false, defaultValue: 10 }), total_score: decimalScore('total_score', '大题总分', { allowNull: false, defaultValue: 30 }), sort_order: { type: INTEGER, allowNull: false, defaultValue: 0, comment: '排序', }, status: { type: INTEGER, allowNull: false, defaultValue: 1, comment: '状态:1=启用(参与抽题),0=停用', }, created_at: { type: DATE, defaultValue: app.Sequelize.NOW, comment: '创建时间', }, updated_at: { type: DATE, defaultValue: app.Sequelize.NOW, comment: '更新时间', }, }, { tableName: 'big_questions', timestamps: true, createdAt: 'created_at', updatedAt: 'updated_at', }); };