change query

This commit is contained in:
2026-07-20 11:28:21 +08:00
parent b401c1b53a
commit a2c9936f79
5 changed files with 49 additions and 53 deletions
@@ -218,9 +218,9 @@ exports.visitLink = 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 (!(await assertTaskUnlocked(req.user.user_id, taskListId, task.order_index, taskId))) {
if (!(await assertTaskUnlocked(req.user.user_id, taskId))) {
await t.rollback();
return R.error(res, 'Complete the earlier required tasks in this list first.', 409);
return R.error(res, 'Complete this task\'s prerequisite tasks first.', 409);
}
const wasComplete = await checkTaskCompletion(req.user.user_id, taskId);
@@ -349,9 +349,9 @@ exports.updateProgress = 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 (!(await assertTaskUnlocked(req.user.user_id, taskListId, task.order_index, taskId))) {
if (!(await assertTaskUnlocked(req.user.user_id, taskId))) {
await t.rollback();
return R.error(res, 'Complete the earlier required tasks in this list first.', 409);
return R.error(res, 'Complete this task\'s prerequisite tasks first.', 409);
}
const now = new Date();