|
1 | 1 | package inu.codin.codin.infra.fcm.controller; |
2 | 2 |
|
3 | 3 | import inu.codin.codin.common.response.SingleResponse; |
| 4 | +import inu.codin.codin.infra.fcm.controller.swagger.FcmController; |
4 | 5 | import inu.codin.codin.infra.fcm.dto.request.FcmTokenRequest; |
5 | 6 | import inu.codin.codin.infra.fcm.service.FcmService; |
6 | | -import io.swagger.v3.oas.annotations.tags.Tag; |
7 | 7 | import jakarta.validation.Valid; |
| 8 | +import jakarta.validation.constraints.Null; |
8 | 9 | import lombok.RequiredArgsConstructor; |
9 | 10 | import org.springframework.http.HttpStatus; |
10 | 11 | import org.springframework.http.ResponseEntity; |
11 | | -import org.springframework.web.bind.annotation.PostMapping; |
12 | | -import org.springframework.web.bind.annotation.RequestBody; |
13 | | -import org.springframework.web.bind.annotation.RequestMapping; |
14 | | -import org.springframework.web.bind.annotation.RestController; |
| 12 | +import org.springframework.web.bind.annotation.*; |
15 | 13 |
|
16 | 14 | @RestController |
17 | 15 | @RequestMapping("/fcm") |
18 | | -@Tag(name = "FCM API", description = "FCM 토큰 저장 API") |
19 | 16 | @RequiredArgsConstructor |
20 | | -public class FcmController { |
| 17 | +public class FcmControllerImpl implements FcmController { |
21 | 18 |
|
22 | 19 | private final FcmService fcmService; |
23 | 20 |
|
24 | 21 | @PostMapping("/save") |
25 | | - public ResponseEntity<?> sendFcmMessage( |
| 22 | + public ResponseEntity<SingleResponse<Null>> sendFcmMessage( |
26 | 23 | @RequestBody @Valid FcmTokenRequest fcmTokenRequest |
27 | 24 | ) { |
28 | 25 | fcmService.saveFcmToken(fcmTokenRequest); |
29 | 26 | return ResponseEntity.status(HttpStatus.ACCEPTED).body(new SingleResponse<>(202, "FCM 토큰 저장 성공", null)); |
30 | 27 | } |
31 | 28 |
|
32 | 29 | @PostMapping("/subscribe") |
33 | | - public ResponseEntity<?> subscribeTopic( |
34 | | - @RequestBody String topic |
| 30 | + public ResponseEntity<SingleResponse<Null>> subscribeTopic( |
| 31 | + @RequestParam String topic |
35 | 32 | ) { |
36 | 33 | fcmService.subscribeTopic(topic); |
37 | 34 | return ResponseEntity.status(HttpStatus.ACCEPTED).body(new SingleResponse<>(202, "FCM 토픽 구독 성공", null)); |
38 | 35 | } |
39 | 36 |
|
40 | 37 | @PostMapping("/unsubscribe") |
41 | | - public ResponseEntity<?> unsubscribeTopic( |
42 | | - @RequestBody String topic |
| 38 | + public ResponseEntity<SingleResponse<Null>> unsubscribeTopic( |
| 39 | + @RequestParam String topic |
43 | 40 | ) { |
44 | 41 | fcmService.unsubscribeTopic(topic); |
45 | 42 | return ResponseEntity.status(HttpStatus.ACCEPTED).body(new SingleResponse<>(202, "FCM 토픽 구독 해제 성공", null)); |
|
0 commit comments