Skip to content

Commit

Permalink
Fix [#139] Todo 생성 API userId 검사 로직 추가 (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
geniusYoo authored Jul 18, 2024
2 parents 3440b79 + 7d9f6c5 commit 6cfe431
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void startTimer(LocalDate targetDate, StartTimerRequest startTimerRequest
Long userId = 3L;
Todo todo = Todo.init(userId);
// 해당 날짜에 생성한 Todo가 없다면
if (!isExist(targetDate)) {
if (!isExist(userId, targetDate)) {
// Todo 생성
todo.setTargetDate(targetDate);
todo = todoRepository.save(todo);
Expand All @@ -57,8 +57,8 @@ public void startTimer(LocalDate targetDate, StartTimerRequest startTimerRequest
todoTaskService.excute(todo, startTimerRequest.taskIdList());
}

public boolean isExist(LocalDate targetDate) {
return todoRepository.findByTargetDate(targetDate) != null;
public boolean isExist(Long userId, LocalDate targetDate) {
return todoRepository.findByUserIdAndTargetDate(userId, targetDate) != null;
}

public TodoCardResponse getTodoCard(LocalDate targetDate) {
Expand Down

0 comments on commit 6cfe431

Please sign in to comment.