Skip to content

Commit

Permalink
Merge pull request #13 from STUDIO-EYE/feat/#9-myTodo-mySchedule
Browse files Browse the repository at this point in the history
[FEAT]: todo check api
  • Loading branch information
phonil authored Apr 20, 2024
2 parents 3aa9b7f + 48d1de6 commit 1c069f9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,12 @@ public CommonResult deleteMyToDo(@PathVariable Long userTodoId) {
return responseService.getSuccessfulResult();
}

// 내 할 일 완료
@PatchMapping("/checking/{userTodoId}")
@Operation(summary = "내 할 일 완료 표시", description = "내 할 일 완료 표시 api")
public CommonResult finishMyToDo(@PathVariable Long userTodoId) {
userTodoService.finishMyToDo(JwtContextHolder.getUserId(), userTodoId);
return responseService.getSuccessfulResult();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ public interface UserTodoService {
void deleteMyToDo(Long userId, Long userTodoId);

UserTodo showMyToDoOne(Long userTodoId);

void finishMyToDo(Long userId, Long userTodoId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,20 @@ public void deleteMyToDo(Long userId, Long userTodoId) {
} else
throw new NonExistentException(ExceptionList.NON_EXISTENT_PROJECT);
}

// Description : 내 할 일 완료
@Override
@Transactional
public void finishMyToDo(Long userId, Long userTodoId) {

Optional<UserTodo> findUserTodo = userTodoRepository.findByUserTodoIdAndUserId(userTodoId, userId);
if (findUserTodo.isPresent()) {
UserTodo userTodo = findUserTodo.get();
userTodo.finish(userTodo.isChecked());

} else
throw new NonExistentException(ExceptionList.NON_EXISTENT_PROJECT);

}

}

0 comments on commit 1c069f9

Please sign in to comment.