소셜 로그인 시 이메일 동의 없이도 계정 생성이 가능하도록 변경합니다. Member 엔티티의 email 필드를 선택 사항으로 변경하고, 관련 API 응답 및 인증 로직에서 이메일이 없는 경우에 대한 처리를 추가합니다.
27 lines
1000 B
Kotlin
27 lines
1000 B
Kotlin
package kr.co.vividnext.sodalive.menu
|
|
|
|
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.access.prepost.PreAuthorize
|
|
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.RestController
|
|
|
|
@RestController
|
|
@RequestMapping("/menu")
|
|
class MenuController(private val service: MenuService) {
|
|
@GetMapping
|
|
@PreAuthorize("hasAnyRole('AGENT', 'ADMIN', 'CREATOR')")
|
|
fun getMenus(
|
|
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
|
) = run {
|
|
if (member == null) {
|
|
throw SodaException(messageKey = "common.error.bad_credentials")
|
|
}
|
|
|
|
ApiResponse.ok(service.getMenus(member))
|
|
}
|
|
}
|