units,lesson as standalone

This commit is contained in:
2026-07-10 11:44:46 +08:00
parent 86fba50b95
commit e1ffdab190
46 changed files with 1463 additions and 197 deletions
@@ -0,0 +1,30 @@
'use strict';
// Part 1A — new requirement types (submit_text, pass_quiz) + review workflow.
// `prompt` is submit_text's instructions field (mirrors link_label/reference_label
// as the type-specific display field). `requires_review` opts any submission-based
// requirement into admin approve/reject before it counts as complete.
// task_requirements.type has no DB-level CHECK constraint (verified against the
// live schema — Sequelize enforces the ENUM only at the application layer for
// this table), so no constraint migration is needed to add the new type values.
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.addColumn('task_requirements', 'prompt', {
type: Sequelize.TEXT,
allowNull: true,
after: 'reference_label',
});
await queryInterface.addColumn('task_requirements', 'requires_review', {
type: Sequelize.BOOLEAN,
allowNull: false,
defaultValue: false,
after: 'prompt',
});
},
async down(queryInterface) {
await queryInterface.removeColumn('task_requirements', 'requires_review');
await queryInterface.removeColumn('task_requirements', 'prompt');
},
};