From b08c92f6c012a9707ee23eeb4ef16738de6a1457 Mon Sep 17 00:00:00 2001 From: "Masaharu.Kato" Date: Mon, 9 Jun 2025 13:39:25 +0900 Subject: [PATCH] Fix response of tobuy API --- .../com/example/todoapp/controller/ToBuysController.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/com/example/todoapp/controller/ToBuysController.java b/backend/src/main/java/com/example/todoapp/controller/ToBuysController.java index c644e14..00a9766 100644 --- a/backend/src/main/java/com/example/todoapp/controller/ToBuysController.java +++ b/backend/src/main/java/com/example/todoapp/controller/ToBuysController.java @@ -22,6 +22,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import java.util.Collections; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; @@ -57,19 +58,19 @@ public class ToBuysController { */ @PostMapping("/add") - public ResponseEntity addToBuys( + public ResponseEntity> addToBuys( @Valid @RequestBody ToBuysDTO dto, Authentication authentication) { toBuysService.addToBuys(dto, authentication); - return ResponseEntity.ok("Item added to 'To Buys' successfully"); + return ResponseEntity.ok(Collections.singletonMap("result", true)); } @PutMapping("/update") - public ResponseEntity updateToBuys( + public ResponseEntity> updateToBuys( @Valid @RequestBody ToBuysDTO dto, Authentication authentication) { toBuysService.updateToBuys(dto, authentication); - return ResponseEntity.ok("Item updated to 'To Buys' successfully"); + return ResponseEntity.ok(Collections.singletonMap("result", true)); }