-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/api 버전 넘버링 적용 #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The head ref may contain hidden characters: "feat/api-\uBC84\uC804-\uB118\uBC84\uB9C1-\uC801\uC6A9"
Changes from all commits
7867b1e
af90fd5
743852d
8a205ab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| package me.pinitnotification.interfaces.notification; | ||
|
|
||
| import io.swagger.v3.oas.annotations.Operation; | ||
| import io.swagger.v3.oas.annotations.Parameter; | ||
| import io.swagger.v3.oas.annotations.media.Content; | ||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
| import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
| import io.swagger.v3.oas.annotations.tags.Tag; | ||
| import me.pinitnotification.application.push.PushService; | ||
| import me.pinitnotification.domain.member.MemberId; | ||
| import me.pinitnotification.interfaces.notification.dto.PushTokenRequest; | ||
| import org.springframework.web.bind.annotation.*; | ||
|
|
||
| @RestController | ||
| @RequestMapping("/v0/push") | ||
|
||
| @Tag(name = "푸시 알림", description = "푸시 구독 및 VAPID 키 관련 API") | ||
| public class PushNotificationControllerV0 { | ||
|
||
| private final PushService pushService; | ||
|
|
||
| public PushNotificationControllerV0(PushService pushService) { | ||
| this.pushService = pushService; | ||
| } | ||
|
|
||
| @GetMapping("/vapid") | ||
| @Operation( | ||
| summary = "VAPID 공개키 조회", | ||
| description = "웹 푸시 구독에 사용되는 VAPID 공개키를 반환합니다." | ||
| ) | ||
| @ApiResponses({ | ||
| @ApiResponse(responseCode = "200", description = "VAPID 공개키", | ||
| content = @Content(mediaType = "text/plain", schema = @Schema(implementation = String.class))) | ||
| }) | ||
| public String getVapidPublicKey() { | ||
| return pushService.getVapidPublicKey(); | ||
| } | ||
|
|
||
| @GetMapping("/subscribed") | ||
| @Operation( | ||
| summary = "푸시 구독 상태 조회", | ||
| description = "인증된 회원이 푸시 알림을 구독 중인지 여부를 반환합니다." | ||
| ) | ||
| @ApiResponses({ | ||
| @ApiResponse(responseCode = "200", description = "구독 상태 조회 완료", | ||
| content = @Content(mediaType = "text/plain", schema = @Schema(implementation = Boolean.class))) | ||
| }) | ||
| public boolean isSubscribed( | ||
| @Parameter(hidden = true) @MemberId Long memberId, | ||
| @RequestParam String deviceId) { | ||
| return pushService.isSubscribed(memberId, deviceId); | ||
| } | ||
|
|
||
| @PostMapping("/subscribe") | ||
| @Operation( | ||
| summary = "푸시 토큰 구독 등록", | ||
| description = "인증된 회원의 푸시 토큰을 등록합니다." | ||
| ) | ||
| @ApiResponses({ | ||
| @ApiResponse(responseCode = "200", description = "구독 등록 완료"), | ||
| @ApiResponse(responseCode = "400", description = "토큰이 유효하지 않음", content = @Content) | ||
| }) | ||
| public void subscribe( | ||
| @Parameter(hidden = true) @MemberId Long memberId, | ||
| @RequestBody PushTokenRequest request) { | ||
| pushService.subscribe(memberId, request.deviceId(), request.token()); | ||
| } | ||
|
|
||
| @PostMapping("/unsubscribe") | ||
| @Operation( | ||
| summary = "푸시 토큰 구독 해지", | ||
| description = "인증된 회원의 등록된 푸시 토큰을 삭제합니다." | ||
| ) | ||
| @ApiResponses({ | ||
| @ApiResponse(responseCode = "200", description = "구독 해지 완료"), | ||
| @ApiResponse(responseCode = "400", description = "토큰이 유효하지 않음", content = @Content) | ||
| }) | ||
| public void unsubscribe( | ||
| @Parameter(hidden = true) @MemberId Long memberId, | ||
| @RequestBody PushTokenRequest request) { | ||
| pushService.unsubscribe(memberId, request.deviceId(), request.token()); | ||
| } | ||
|
|
||
|
|
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
문제점:
@deprecated 어노테이션이 since, forRemoval 속성 없이 사용되었습니다.
영향:
수정 제안:
since와 forRemoval 속성을 명시하여 deprecated 정책을 명확히 하세요. 예를 들어, 다음과 같이 작성할 수 있습니다: