Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ ResponseEntity<BaseResponse<Object>> updateTodo(
반복 TODO는 date를 포함한 이후 반복 일정만 삭제하고, date 이전 일정과 완료·타이머 기록은 유지합니다.
이때 반복 종료일은 date 전날로 변경되며, date 이후 일정에 실행 중이거나 일시정지된 타이머가 있으면 삭제할 수 없습니다.
반복이 아닌 TODO는 해당 TODO 전체를 삭제합니다.
기존 클라이언트 호환을 위해 당분간 date 없이 요청하면 반복 여부와 상관없이 TODO 전체를 삭제합니다.

구글 캘린더에서 가져온 일정은 삭제할 수 없습니다.
단, 구글에서 삭제되었지만 타이머 기록이 있어 남아 있는 일정(isDeletedFromGoogle=true)과
Expand All @@ -383,7 +384,7 @@ ResponseEntity<BaseResponse<Object>> updateTodo(
),
@ApiResponse(
responseCode = "400",
description = "date가 누락되었거나 날짜 형식(yyyy-MM-dd)이 올바르지 않은 경우",
description = "date의 날짜 형식(yyyy-MM-dd)이 올바르지 않은 경우",
content = @Content(
mediaType = "application/json",
schema = @Schema(implementation = ErrorDto.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public void updateTodo(Long userId, Long todoId, TodoUpdateRequest request) {

@Transactional
public void deleteTodo(Long userId, Long todoId, String dateValue) {
LocalDate date = parseDate(dateValue);
LocalDate date = dateValue == null ? null : parseDate(dateValue);
userRepository.findByIdForUpdate(userId)
.orElseThrow(() -> new CustomException(UserErrorCode.USER_NOT_FOUND));
Todo todo = todoRepository.findByIdAndUser_Id(todoId, userId)
Expand All @@ -267,7 +267,7 @@ public void deleteTodo(Long userId, Long todoId, String dateValue) {
throw new CustomException(TodoErrorCode.GOOGLE_EVENT_NOT_DELETABLE);
}

if (todo.isRepeating() && todoDateCalculator.occursBefore(todo, date)) {
if (date != null && todo.isRepeating() && todoDateCalculator.occursBefore(todo, date)) {
removeTodoFrom(todo, date);
} else {
removeTodo(todo);
Expand Down
Loading