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*、构建/缓存产物。
This commit is contained in:
WorkBuddy
2026-08-17 12:25:42 +08:00
commit a303cf2d53
109 changed files with 25904 additions and 0 deletions

View File

@@ -0,0 +1,89 @@
'use strict';
/**
* 中职组题库模型 - ZhongzhiQuestion
*
* 存储中职组比赛题目,支持单选、多选、判断等多种题型。
* 表名:zhongzhi_questions
*/
module.exports = app => {
const { STRING, INTEGER, JSON, DATE } = app.Sequelize;
const ZhongzhiQuestion = app.model.define('zhongzhi_question', {
// 主键,自增
question_uid: {
type: INTEGER,
primaryKey: true,
autoIncrement: true,
comment: '题目唯一标识',
},
// 题目内容
question: {
type: STRING(1000),
allowNull: false,
comment: '题目内容',
},
// 正确答案
answer: {
type: STRING(500),
allowNull: false,
comment: '正确答案',
},
// 题目类型:single(单选) / multiple(多选) / judge(判断)
question_type: {
type: STRING(20),
allowNull: false,
comment: '题目类型',
},
// 选项(JSON 格式,如 ["A. xxx", "B. xxx", "C. xxx", "D. xxx"])
options: {
type: JSON,
allowNull: true,
defaultValue: null,
comment: '选项',
},
// 题目分值
score: {
type: INTEGER,
allowNull: false,
defaultValue: 0,
comment: '题目分值',
},
// 排序序号
sort_order: {
type: INTEGER,
allowNull: false,
defaultValue: 0,
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: 'zhongzhi_questions',
timestamps: false,
underscored: true,
indexes: [
{
fields: ['question_type'],
},
{
fields: ['sort_order'],
},
],
});
return ZhongzhiQuestion;
};