Recover completed deep-linked curator tasks
This commit is contained in:
@@ -134,8 +134,16 @@ export const curatorService = {
|
||||
async completeTask(input: { userId: string; taskId: string; date?: string; reason?: string }) {
|
||||
const date = taskActionDate(input);
|
||||
const task = (await buildCuratorTasks(input.userId, date)).find((item) => item.id === input.taskId);
|
||||
if (!task) throw new Error("curator_task_not_found");
|
||||
const reason = input.reason ?? "subtasks_completed";
|
||||
if (!task && reason === "matchmaking_matches_reviewed") {
|
||||
const event = await emitCuratorEvent({
|
||||
userId: input.userId,
|
||||
type: "curator.task.completed",
|
||||
payload: { taskId: input.taskId, date, reason, recoveredDeepLink: true },
|
||||
});
|
||||
return { task: { id: input.taskId, date, status: "completed" as const }, eventId: event.id };
|
||||
}
|
||||
if (!task) throw new Error("curator_task_not_found");
|
||||
const allowDirectServiceCompletion =
|
||||
(task.serviceId === "qscore-service" && reason === "qscore_review_opened") ||
|
||||
(task.serviceId === "matchmaking-service" && reason === "matchmaking_matches_reviewed");
|
||||
|
||||
Reference in New Issue
Block a user