fix: 포인트 내역 리스트
- 유저의 포인트 보상내역, 사용내역 API 추가
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
package kr.co.vividnext.sodalive.point
|
||||
|
||||
import kr.co.vividnext.sodalive.common.ApiResponse
|
||||
import kr.co.vividnext.sodalive.common.SodaException
|
||||
import kr.co.vividnext.sodalive.member.Member
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal
|
||||
import org.springframework.web.bind.annotation.GetMapping
|
||||
import org.springframework.web.bind.annotation.RequestMapping
|
||||
import org.springframework.web.bind.annotation.RequestParam
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/point")
|
||||
class PointController(private val service: PointService) {
|
||||
@GetMapping("/status")
|
||||
fun getPointStatus(
|
||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
||||
) = run {
|
||||
if (member == null) {
|
||||
throw SodaException("로그인 정보를 확인해주세요.")
|
||||
}
|
||||
|
||||
ApiResponse.ok(service.getPointStatus(member))
|
||||
}
|
||||
|
||||
@GetMapping("/status/use")
|
||||
fun getPointUseStatus(
|
||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?,
|
||||
@RequestParam("timezone") timezone: String
|
||||
) = run {
|
||||
if (member == null) {
|
||||
throw SodaException("로그인 정보를 확인해주세요.")
|
||||
}
|
||||
|
||||
ApiResponse.ok(service.getPointUseStatus(member, timezone))
|
||||
}
|
||||
|
||||
@GetMapping("/status/reward")
|
||||
fun getPointRewardStatus(
|
||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?,
|
||||
@RequestParam("timezone") timezone: String
|
||||
) = run {
|
||||
if (member == null) {
|
||||
throw SodaException("로그인 정보를 확인해주세요.")
|
||||
}
|
||||
|
||||
ApiResponse.ok(service.getPointRewardStatus(member, timezone))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user