라이브 메인 - 추천라이브, 추천채널, 예약중인 라이브, 진행중인 라이브, 이벤트 배너 API 추가
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package kr.co.vividnext.sodalive.event
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value
|
||||
import org.springframework.stereotype.Service
|
||||
|
||||
@Service
|
||||
class EventService(
|
||||
private val repository: EventRepository,
|
||||
|
||||
@Value("\${cloud.aws.cloud-front.host}")
|
||||
private val cloudFrontHost: String
|
||||
) {
|
||||
fun getEventList(): GetEventResponse {
|
||||
val eventList = repository.getEventList()
|
||||
.asSequence()
|
||||
.map {
|
||||
if (!it.thumbnailImageUrl.startsWith("https://")) {
|
||||
it.thumbnailImageUrl = "$cloudFrontHost/${it.thumbnailImageUrl}"
|
||||
}
|
||||
|
||||
if (it.detailImageUrl != null && !it.detailImageUrl!!.startsWith("https://")) {
|
||||
it.detailImageUrl = "$cloudFrontHost/${it.detailImageUrl}"
|
||||
}
|
||||
|
||||
if (it.popupImageUrl != null && !it.popupImageUrl!!.startsWith("https://")) {
|
||||
it.popupImageUrl = "$cloudFrontHost/${it.popupImageUrl}"
|
||||
}
|
||||
|
||||
it
|
||||
}
|
||||
.toList()
|
||||
|
||||
return GetEventResponse(0, eventList)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user