From ee712833caf70b5dceff4096fe2b6dff3f3e2576 Mon Sep 17 00:00:00 2001 From: garamv20 Date: Wed, 1 May 2024 16:16:50 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=ED=8F=90=EA=B8=B0=EB=AC=BC=20?= =?UTF-8?q?=EA=B4=80=EC=8B=AC=20=EC=B6=94=EA=B0=80=20=EB=98=90=EB=8A=94=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=20=EB=B0=98=ED=99=98=EA=B0=92=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20-=20like=20->=20true=20-=20unlike=20->=20false?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../freshtrash/freshtrashbackend/controller/WasteApi.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/freshtrash/freshtrashbackend/controller/WasteApi.java b/src/main/java/freshtrash/freshtrashbackend/controller/WasteApi.java index 2f6c6e5d..117fb610 100644 --- a/src/main/java/freshtrash/freshtrashbackend/controller/WasteApi.java +++ b/src/main/java/freshtrash/freshtrashbackend/controller/WasteApi.java @@ -4,6 +4,7 @@ import freshtrash.freshtrashbackend.dto.constants.LikeStatus; import freshtrash.freshtrashbackend.dto.request.ReviewRequest; import freshtrash.freshtrashbackend.dto.request.WasteRequest; +import freshtrash.freshtrashbackend.dto.response.ApiResponse; import freshtrash.freshtrashbackend.dto.response.ReviewResponse; import freshtrash.freshtrashbackend.dto.response.WasteResponse; import freshtrash.freshtrashbackend.dto.security.MemberPrincipal; @@ -138,19 +139,19 @@ private ResponseEntity addWasteReview( * 폐기물 관심 추가 또는 삭제 */ @PostMapping("/{wasteId}/likes") - public ResponseEntity addOrDeleteWasteLike( + public ResponseEntity> addOrDeleteWasteLike( @RequestParam LikeStatus likeStatus, @PathVariable Long wasteId, @AuthenticationPrincipal MemberPrincipal memberPrincipal) { checkIfNotWriter(memberPrincipal, wasteId); - + Boolean isLike = likeStatus == LikeStatus.LIKE; if (likeStatus == LikeStatus.LIKE) { wasteService.addWasteLike(memberPrincipal.id(), wasteId); } else if (likeStatus == LikeStatus.UNLIKE) { wasteService.deleteWasteLike(memberPrincipal.id(), wasteId); } - return ResponseEntity.status(HttpStatus.NO_CONTENT).body(null); + return ResponseEntity.status(HttpStatus.OK).body(ApiResponse.of(isLike)); } /**