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:
61
database/seeders/005-seed-competition-times.js
Normal file
61
database/seeders/005-seed-competition-times.js
Normal file
@@ -0,0 +1,61 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* 种子数据:初始化比赛时间配置
|
||||
* 中职组和高职组设置起止时间(在线答题模式)
|
||||
* 本科组和教师组设置截止时间(作品提交模式)
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
up: async (queryInterface) => {
|
||||
const now = new Date();
|
||||
|
||||
const times = [
|
||||
// 中职组:在线答题,有起止时间
|
||||
{
|
||||
group: 'zhongzhi',
|
||||
start_time: new Date(now.getTime() + 1 * 24 * 60 * 60 * 1000), // 1天后开始
|
||||
end_time: new Date(now.getTime() + 1 * 24 * 60 * 60 * 1000 + 3 * 60 * 60 * 1000), // 持续3小时
|
||||
deadline: null,
|
||||
created_at: now,
|
||||
updated_at: now,
|
||||
},
|
||||
// 高职组:在线答题,有起止时间
|
||||
{
|
||||
group: 'gaozhi',
|
||||
start_time: new Date(now.getTime() + 2 * 24 * 60 * 60 * 1000), // 2天后开始
|
||||
end_time: new Date(now.getTime() + 2 * 24 * 60 * 60 * 1000 + 3 * 60 * 60 * 1000), // 持续3小时
|
||||
deadline: null,
|
||||
created_at: now,
|
||||
updated_at: now,
|
||||
},
|
||||
// 本科组:作品提交,只有截止时间
|
||||
{
|
||||
group: 'benke',
|
||||
start_time: null,
|
||||
end_time: null,
|
||||
deadline: new Date(now.getTime() + 7 * 24 * 60 * 60 * 1000), // 7天后截止
|
||||
created_at: now,
|
||||
updated_at: now,
|
||||
},
|
||||
// 教师组:作品提交,只有截止时间
|
||||
{
|
||||
group: 'jiaoshi',
|
||||
start_time: null,
|
||||
end_time: null,
|
||||
deadline: new Date(now.getTime() + 7 * 24 * 60 * 60 * 1000), // 7天后截止
|
||||
created_at: now,
|
||||
updated_at: now,
|
||||
},
|
||||
];
|
||||
|
||||
await queryInterface.bulkInsert('competition_times', times, {});
|
||||
},
|
||||
|
||||
/**
|
||||
* 回滚种子数据:删除所有时间配置
|
||||
*/
|
||||
down: async (queryInterface) => {
|
||||
await queryInterface.bulkDelete('competition_times', null, {});
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user