diff --git a/doorip-api/src/main/java/org/doorip/trip/api/TodoApiController.java b/doorip-api/src/main/java/org/doorip/trip/api/TodoApiController.java index fbcb60e..ad80214 100644 --- a/doorip-api/src/main/java/org/doorip/trip/api/TodoApiController.java +++ b/doorip-api/src/main/java/org/doorip/trip/api/TodoApiController.java @@ -42,4 +42,10 @@ public ResponseEntity> getTripTodo(@UserId final Long userId, final TodoGetResponse response = todoService.getTripTodo(userId, todoId); return ApiResponseUtil.success(SuccessMessage.OK, response); } + + @DeleteMapping("/todos/{todoId}") + public ResponseEntity> deleteTripTodo(@PathVariable final Long todoId) { + todoService.deleteTripTodo(todoId); + return ApiResponseUtil.success(SuccessMessage.OK); + } } diff --git a/doorip-api/src/main/java/org/doorip/trip/service/TodoService.java b/doorip-api/src/main/java/org/doorip/trip/service/TodoService.java index 8487c7b..0686a4e 100644 --- a/doorip-api/src/main/java/org/doorip/trip/service/TodoService.java +++ b/doorip-api/src/main/java/org/doorip/trip/service/TodoService.java @@ -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 allocators) { if (allocators.isEmpty()) { throw new InvalidValueException(ErrorMessage.INVALID_ALLOCATOR_COUNT);