관리자 - 이벤트 배너 등록

- 본인 인증 여부에 따라 노출할 수 있도록 isAdult 컬럼 추가
This commit is contained in:
2023-11-22 01:11:15 +09:00
parent 61cf1577dc
commit 3c72ae048e
3 changed files with 40 additions and 20 deletions

View File

@@ -2,6 +2,7 @@ package kr.co.vividnext.sodalive.event
import kr.co.vividnext.sodalive.common.ApiResponse
import kr.co.vividnext.sodalive.member.Member
import kr.co.vividnext.sodalive.member.MemberRole
import org.springframework.security.access.prepost.PreAuthorize
import org.springframework.security.core.annotation.AuthenticationPrincipal
import org.springframework.web.bind.annotation.DeleteMapping
@@ -20,7 +21,17 @@ class EventController(private val service: EventService) {
@GetMapping
fun getEventList(
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
) = ApiResponse.ok(service.getEventList(member?.auth != null))
) = run {
ApiResponse.ok(
service.getEventList(
if (member?.role == MemberRole.ADMIN) {
null
} else {
member?.auth != null
}
)
)
}
@GetMapping("/popup")
fun getEventPopup(
@@ -35,9 +46,10 @@ class EventController(private val service: EventService) {
@RequestParam(value = "popup", required = false) popup: MultipartFile? = null,
@RequestParam(value = "link", required = false) link: String? = null,
@RequestParam(value = "title", required = false) title: String? = null,
@RequestParam(value = "isAdult", required = false) isAdult: Boolean? = null,
@RequestParam(value = "isPopup") isPopup: Boolean
) = ApiResponse.ok(
service.save(thumbnail, detail, popup, link, title, isPopup),
service.save(thumbnail, detail, popup, link, title, isAdult, isPopup),
"등록되었습니다."
)
@@ -50,9 +62,10 @@ class EventController(private val service: EventService) {
@RequestParam(value = "popup", required = false) popup: MultipartFile? = null,
@RequestParam(value = "link", required = false) link: String? = null,
@RequestParam(value = "title", required = false) title: String? = null,
@RequestParam(value = "isAdult", required = false) isAdult: Boolean? = null,
@RequestParam(value = "isPopup", required = false) isPopup: Boolean? = null
) = ApiResponse.ok(
service.update(id, thumbnail, detail, popup, link, title, isPopup),
service.update(id, thumbnail, detail, popup, link, title, isAdult, isPopup),
"수정되었습니다."
)