fix(event): 이벤트 성인 여부 조회 기준을 인증 저장소로 변경한다
This commit is contained in:
@@ -3,6 +3,8 @@ package kr.co.vividnext.sodalive.event
|
||||
import com.amazonaws.services.s3.model.ObjectMetadata
|
||||
import kr.co.vividnext.sodalive.aws.s3.S3Uploader
|
||||
import kr.co.vividnext.sodalive.common.SodaException
|
||||
import kr.co.vividnext.sodalive.member.MemberRole
|
||||
import kr.co.vividnext.sodalive.member.auth.AuthRepository
|
||||
import kr.co.vividnext.sodalive.utils.generateFileName
|
||||
import org.springframework.beans.factory.annotation.Value
|
||||
import org.springframework.data.repository.findByIdOrNull
|
||||
@@ -17,6 +19,7 @@ import java.time.format.DateTimeFormatter
|
||||
class EventService(
|
||||
private val repository: EventRepository,
|
||||
private val s3Uploader: S3Uploader,
|
||||
private val authRepository: AuthRepository,
|
||||
|
||||
@Value("\${cloud.aws.s3.bucket}")
|
||||
private val bucket: String,
|
||||
@@ -45,6 +48,16 @@ class EventService(
|
||||
return GetEventResponse(0, eventList)
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
fun getEventList(memberId: Long?, memberRole: MemberRole?): GetEventResponse {
|
||||
val isAdult = if (memberRole == MemberRole.ADMIN) {
|
||||
null
|
||||
} else {
|
||||
memberId?.let { authRepository.getAuthIdByMemberId(it) != null } ?: false
|
||||
}
|
||||
return getEventList(isAdult)
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
fun getEventPopup(isAdult: Boolean): EventItem? {
|
||||
val eventPopup = repository.getMainEventPopup(isAdult)
|
||||
@@ -66,6 +79,12 @@ class EventService(
|
||||
return eventPopup
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
fun getEventPopup(memberId: Long?): EventItem? {
|
||||
val isAdult = memberId?.let { authRepository.getAuthIdByMemberId(it) != null } ?: false
|
||||
return getEventPopup(isAdult)
|
||||
}
|
||||
|
||||
@Transactional
|
||||
fun save(
|
||||
thumbnail: MultipartFile,
|
||||
|
||||
Reference in New Issue
Block a user