implement tasks

Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
2026-07-17 17:28:11 +08:00
parent bae079d5d8
commit 941590f51a
11 changed files with 327 additions and 103 deletions
+5
View File
@@ -723,6 +723,11 @@ exports.submitTask = async (req, res) => {
const task = await Task.findOne({ where: { task_id: taskId, task_list_id: taskListId }, transaction: t });
if (!task) { await t.rollback(); return R.error(res, 'Task not found.', 404); }
if (task.accepts_submissions === false) {
await t.rollback();
return R.error(res, 'This task no longer accepts submissions.', 409);
}
if (!(await assertTaskUnlocked(req.user.user_id, taskListId, task.order_index, taskId))) {
await t.rollback();
return R.error(res, 'Complete the earlier required tasks in this list first.', 409);