Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] 여행 TODO 삭제 API 구현 #51

Merged
merged 2 commits into from
Jan 10, 2024
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 @@ -42,4 +42,10 @@ public ResponseEntity<ApiResponse<?>> getTripTodo(@UserId final Long userId,
final TodoGetResponse response = todoService.getTripTodo(userId, todoId);
return ApiResponseUtil.success(SuccessMessage.OK, response);
}

@DeleteMapping("/todos/{todoId}")
public ResponseEntity<ApiResponse<?>> deleteTripTodo(@PathVariable final Long todoId) {
todoService.deleteTripTodo(todoId);
return ApiResponseUtil.success(SuccessMessage.OK);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ public TodoGetResponse getTripTodo(Long userId, Long todoId) {
return TodoGetResponse.of(findTodo, allocatorResponses);
}

@Transactional
public void deleteTripTodo(Long todoId) {
todoRepository.deleteById(todoId);
}

private void validateAllocators(List<Long> allocators) {
if (allocators.isEmpty()) {
throw new InvalidValueException(ErrorMessage.INVALID_ALLOCATOR_COUNT);
Expand Down