유저 푸시토큰 업데이트 API 추가

This commit is contained in:
2023-07-25 03:05:54 +09:00
parent 0580cdd2d6
commit ee124e258e
4 changed files with 46 additions and 2 deletions

View File

@@ -7,6 +7,7 @@ import kr.co.vividnext.sodalive.member.notification.UpdateNotificationSettingReq
import org.springframework.security.core.annotation.AuthenticationPrincipal
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.PutMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestParam
@@ -45,4 +46,20 @@ class MemberController(private val service: MemberService) {
ApiResponse.ok(service.updateNotificationSettings(request, member))
}
@PutMapping("/push-token/update")
fun updatePushToken(
@RequestBody pushTokenUpdateRequest: PushTokenUpdateRequest,
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
) {
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
ApiResponse.ok(
service.updatePushToken(
memberId = member.id!!,
pushToken = pushTokenUpdateRequest.pushToken,
container = pushTokenUpdateRequest.container
)
)
}
}