From dd2e131af0a66142fa5a4525e306bce998b6dcbe Mon Sep 17 00:00:00 2001 From: wonjun0120 Date: Fri, 5 Jul 2024 05:30:36 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20spot=20=EC=83=9D=EC=84=B1=EC=8B=9C=20sp?= =?UTF-8?q?ot=EC=83=9D=EC=84=B1=20=EA=B2=B0=EA=B3=BC=20=EB=B0=98=ED=99=98?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #33 --- .../umc/hackaton/snapspot/spot/controller/SpotController.java | 4 ++-- .../com/umc/hackaton/snapspot/spot/service/SpotService.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/umc/hackaton/snapspot/spot/controller/SpotController.java b/src/main/java/com/umc/hackaton/snapspot/spot/controller/SpotController.java index 5dce3d8..080568c 100644 --- a/src/main/java/com/umc/hackaton/snapspot/spot/controller/SpotController.java +++ b/src/main/java/com/umc/hackaton/snapspot/spot/controller/SpotController.java @@ -22,8 +22,8 @@ public class SpotController { @PostMapping public ResponseEntity upload(@RequestBody SpotRequestDto dto) { try { - spotService.upload(dto); - return ResponseEntity.ok().body("스팟 업로드 성공."); + Spot spot = spotService.upload(dto); + return ResponseEntity.ok().body(spot); } catch (Exception e) { return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("스팟 업로드에 실패하였습니다."); } diff --git a/src/main/java/com/umc/hackaton/snapspot/spot/service/SpotService.java b/src/main/java/com/umc/hackaton/snapspot/spot/service/SpotService.java index bbe8098..a27e928 100644 --- a/src/main/java/com/umc/hackaton/snapspot/spot/service/SpotService.java +++ b/src/main/java/com/umc/hackaton/snapspot/spot/service/SpotService.java @@ -27,7 +27,7 @@ public class SpotService { private final CategorySpotRepository categorySpotRepository; @Transactional - public void upload(SpotRequestDto dto) { + public Spot upload(SpotRequestDto dto) { User user = userRepository.findUserById(dto.getUserId()); @@ -55,7 +55,7 @@ public void upload(SpotRequestDto dto) { // CategorySpot 저장 categorySpotRepository.saveAll(categorySpots); - + return savedSpot; } @Transactional