이벤트 배너, 팝업

- 본인 인증 여부에 따라 노출할 수 있도록 isAdult 컬럼 추가
This commit is contained in:
2023-11-21 21:41:45 +09:00
parent 7fefc9b0a6
commit 61cf1577dc
5 changed files with 53 additions and 16 deletions

View File

@@ -1,7 +1,9 @@
package kr.co.vividnext.sodalive.event
import kr.co.vividnext.sodalive.common.ApiResponse
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.DeleteMapping
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
@@ -16,10 +18,14 @@ import org.springframework.web.multipart.MultipartFile
@RequestMapping("/event")
class EventController(private val service: EventService) {
@GetMapping
fun getEventList() = ApiResponse.ok(service.getEventList())
fun getEventList(
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
) = ApiResponse.ok(service.getEventList(member?.auth != null))
@GetMapping("/popup")
fun getEventPopup() = ApiResponse.ok(service.getEventPopup())
fun getEventPopup(
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
) = ApiResponse.ok(service.getEventPopup(member?.auth != null))
@PostMapping
@PreAuthorize("hasRole('ADMIN')")