Skip to content

Commit

Permalink
Fix: #149 이미 할당된 수행자인지 확인하는 MSW 로직 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
Seok93 committed Sep 24, 2024
1 parent d7d08ac commit cbe4d07
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/mocks/services/taskServiceHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ const taskServiceHandler = [
const isIncludedTask = statues.map((status) => status.statusId).includes(task.statusId);
if (!isIncludedTask) return new HttpResponse(null, { status: 404 });

const isAlreadyAssigned = TASK_USER_DUMMY.find(
(taskUser) => taskUser.taskId === Number(taskId) && taskUser.userId === userId,
);
if (isAlreadyAssigned) return new HttpResponse(null, { status: 400 });

TASK_USER_DUMMY.push({ taskId: Number(taskId), userId });

return new HttpResponse(null, { status: 200 });
Expand Down

0 comments on commit cbe4d07

Please sign in to comment.