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,115 @@
'use strict';
/**
* 教师组作品提交模型 - JiaoshiSubmission
*
* 存储教师组参赛选手的作品提交记录,包括文件信息和评分。
* 表名:jiaoshi_submissions
*/
module.exports = app => {
const { STRING, INTEGER, DATE } = app.Sequelize;
const JiaoshiSubmission = app.model.define('jiaoshi_submission', {
// 主键 ID,自增
id: {
type: INTEGER,
primaryKey: true,
autoIncrement: true,
comment: '提交记录唯一标识',
},
// 外键:关联聚合报名 ID
aggregation_uid: {
type: INTEGER,
allowNull: false,
comment: '关联聚合报名 ID',
},
// 文件类型:word(文档)/ ppt(演示文稿)
file_type: {
type: STRING(20),
allowNull: true,
defaultValue: null,
comment: '文件类型 word/ppt',
},
// 作品名称
work_name: {
type: STRING(200),
allowNull: false,
comment: '作品名称',
},
// 文件存储路径
file_path: {
type: STRING(500),
allowNull: false,
comment: '文件存储路径',
},
// 文件原始名称
file_name: {
type: STRING(200),
allowNull: false,
comment: '文件原始名称',
},
// 文件大小(字节)
file_size: {
type: INTEGER,
allowNull: true,
defaultValue: null,
comment: '文件大小(字节)',
},
// 文件 MD5
file_md5: {
type: STRING(32),
allowNull: true,
defaultValue: null,
comment: '文件 MD5',
},
// 上传时间
upload_time: {
type: DATE,
allowNull: false,
defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP'),
comment: '上传时间',
},
// 评分
score: {
type: INTEGER,
allowNull: true,
defaultValue: null,
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: 'jiaoshi_submissions',
timestamps: false,
underscored: true,
indexes: [
{
fields: ['aggregation_uid'],
},
],
});
// 关联定义
JiaoshiSubmission.associate = function() {
app.model.JiaoshiSubmission.belongsTo(app.model.Aggregation, {
foreignKey: 'aggregation_uid',
targetKey: 'aggregation_uid',
as: 'aggregation',
});
};
return JiaoshiSubmission;
};