관리자 - 이벤트 배너 등록

- 본인 인증 여부에 따라 노출할 수 있도록 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

@@ -20,7 +20,8 @@ class EventService(
@Value("\${cloud.aws.cloud-front.host}")
private val cloudFrontHost: String
) {
fun getEventList(isAdult: Boolean): GetEventResponse {
@Transactional(readOnly = true)
fun getEventList(isAdult: Boolean? = null): GetEventResponse {
val eventList = repository.getEventList(isAdult)
.asSequence()
.map {
@@ -43,6 +44,7 @@ class EventService(
return GetEventResponse(0, eventList)
}
@Transactional(readOnly = true)
fun getEventPopup(isAdult: Boolean): EventItem? {
val eventPopup = repository.getMainEventPopup(isAdult)
@@ -70,6 +72,7 @@ class EventService(
popup: MultipartFile? = null,
link: String? = null,
title: String? = null,
isAdult: Boolean? = null,
isPopup: Boolean
): Long {
if (detail == null && link.isNullOrBlank()) throw SodaException("상세이미지 혹은 링크를 등록하세요")
@@ -81,6 +84,7 @@ class EventService(
popupImage = null,
link = link,
title = title,
isAdult = isAdult,
isPopup = isPopup
)
)
@@ -137,14 +141,11 @@ class EventService(
popup: MultipartFile? = null,
link: String? = null,
title: String? = null,
isAdult: Boolean? = null,
isPopup: Boolean? = null
) {
if (id <= 0) throw SodaException("잘못된 요청입니다.")
if (thumbnail == null && detail == null && link.isNullOrBlank() && title.isNullOrBlank()) {
throw SodaException("수정할 내용을 입력하세요.")
}
val event = repository.findByIdOrNull(id)
?: throw SodaException("잘못된 요청입니다.")
@@ -192,6 +193,10 @@ class EventService(
if (isPopup != null) {
event.isPopup = isPopup
}
if (isAdult != event.isAdult) {
event.isAdult = isAdult
}
}
@Transactional