From a4859cf6da42621f43cce61dbfe7e3807312ed8b Mon Sep 17 00:00:00 2001 From: Joonhee Jeong Date: Thu, 5 Oct 2023 01:56:53 +0900 Subject: [PATCH] =?UTF-8?q?feat=20#125:=20=EC=95=8C=EB=A6=BC=20=EB=81=84?= =?UTF-8?q?=EA=B8=B0=20API=20=EC=BB=A8=ED=8A=B8=EB=A1=A4=EB=9F=AC=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/FCMController.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/fastcampus/team7/Livable_officener/controller/FCMController.java b/src/main/java/fastcampus/team7/Livable_officener/controller/FCMController.java index 46ec524e..3a3334b9 100644 --- a/src/main/java/fastcampus/team7/Livable_officener/controller/FCMController.java +++ b/src/main/java/fastcampus/team7/Livable_officener/controller/FCMController.java @@ -7,10 +7,7 @@ import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.core.annotation.AuthenticationPrincipal; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; @RequiredArgsConstructor @RequestMapping("/api/notify") @@ -29,4 +26,13 @@ public ResponseEntity registerFcmToken( return new ResponseEntity<>(HttpStatus.CREATED); } + + @DeleteMapping("/fcm-token") + public ResponseEntity unsubscribe( + @AuthenticationPrincipal User user) { + + fcmService.unsubscribe(user.getId()); + + return new ResponseEntity<>(HttpStatus.OK); + } }