parent
d1579126f3
commit
14b0eeec7e
|
@ -25,7 +25,6 @@ class AudioContentMainTabAlarmService(
|
||||||
val isAdult = member.auth != null
|
val isAdult = member.auth != null
|
||||||
val memberId = member.id!!
|
val memberId = member.id!!
|
||||||
|
|
||||||
// 메인 배너 (시리즈)
|
|
||||||
val contentBannerList = bannerService.getBannerList(
|
val contentBannerList = bannerService.getBannerList(
|
||||||
tabId = 4,
|
tabId = 4,
|
||||||
memberId = memberId,
|
memberId = memberId,
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
package kr.co.vividnext.sodalive.content.main.tab.asmr
|
||||||
|
|
||||||
|
import kr.co.vividnext.sodalive.common.ApiResponse
|
||||||
|
import kr.co.vividnext.sodalive.common.SodaException
|
||||||
|
import kr.co.vividnext.sodalive.member.Member
|
||||||
|
import org.springframework.security.core.annotation.AuthenticationPrincipal
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping
|
||||||
|
import org.springframework.web.bind.annotation.RestController
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/v2/audio-content/main/asmr")
|
||||||
|
class AudioContentMainTabAsmrController(private val service: AudioContentMainTabAsmrService) {
|
||||||
|
@GetMapping
|
||||||
|
fun fetchContentMainTabAsmr(
|
||||||
|
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
||||||
|
) = run {
|
||||||
|
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
||||||
|
|
||||||
|
ApiResponse.ok(service.fetchData(member))
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,84 @@
|
||||||
|
package kr.co.vividnext.sodalive.content.main.tab.asmr
|
||||||
|
|
||||||
|
import kr.co.vividnext.sodalive.content.AudioContentRepository
|
||||||
|
import kr.co.vividnext.sodalive.content.ContentType
|
||||||
|
import kr.co.vividnext.sodalive.content.main.banner.AudioContentBannerService
|
||||||
|
import kr.co.vividnext.sodalive.content.main.curation.AudioContentCurationQueryRepository
|
||||||
|
import kr.co.vividnext.sodalive.content.main.tab.GetContentCurationResponse
|
||||||
|
import kr.co.vividnext.sodalive.event.EventService
|
||||||
|
import kr.co.vividnext.sodalive.member.Member
|
||||||
|
import kr.co.vividnext.sodalive.rank.RankingService
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
import java.time.DayOfWeek
|
||||||
|
import java.time.LocalDateTime
|
||||||
|
import java.time.temporal.TemporalAdjusters
|
||||||
|
|
||||||
|
@Service
|
||||||
|
class AudioContentMainTabAsmrService(
|
||||||
|
private val bannerService: AudioContentBannerService,
|
||||||
|
private val contentRepository: AudioContentRepository,
|
||||||
|
private val rankingService: RankingService,
|
||||||
|
private val eventService: EventService,
|
||||||
|
private val curationRepository: AudioContentCurationQueryRepository
|
||||||
|
) {
|
||||||
|
fun fetchData(member: Member): GetContentMainTabAsmrResponse {
|
||||||
|
val isAdult = member.auth != null
|
||||||
|
val memberId = member.id!!
|
||||||
|
val theme = "ASMR"
|
||||||
|
val tabId = 5L
|
||||||
|
|
||||||
|
val contentBannerList = bannerService.getBannerList(
|
||||||
|
tabId = tabId,
|
||||||
|
memberId = memberId,
|
||||||
|
isAdult = isAdult
|
||||||
|
)
|
||||||
|
|
||||||
|
val newAsmrContentList = contentRepository.findByTheme(
|
||||||
|
memberId = memberId,
|
||||||
|
theme = theme,
|
||||||
|
isAdult = isAdult,
|
||||||
|
contentType = ContentType.ALL,
|
||||||
|
limit = 10
|
||||||
|
)
|
||||||
|
|
||||||
|
val currentDateTime = LocalDateTime.now()
|
||||||
|
val startDate = currentDateTime
|
||||||
|
.withHour(15)
|
||||||
|
.withMinute(0)
|
||||||
|
.withSecond(0)
|
||||||
|
.minusWeeks(1)
|
||||||
|
.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY))
|
||||||
|
val endDate = startDate
|
||||||
|
.plusDays(6)
|
||||||
|
|
||||||
|
val rankAsmrContentList = rankingService.getContentRanking(
|
||||||
|
memberId = memberId,
|
||||||
|
isAdult = isAdult,
|
||||||
|
startDate = startDate,
|
||||||
|
endDate = endDate,
|
||||||
|
theme = theme
|
||||||
|
)
|
||||||
|
|
||||||
|
val eventBannerList = eventService.getEventList(isAdult = isAdult)
|
||||||
|
|
||||||
|
val curationList = curationRepository.findByContentMainTabId(tabId = tabId, isAdult = isAdult)
|
||||||
|
.map {
|
||||||
|
GetContentCurationResponse(
|
||||||
|
title = it.title,
|
||||||
|
items = contentRepository.findAudioContentByCurationId(
|
||||||
|
curationId = it.id!!,
|
||||||
|
isAdult = isAdult,
|
||||||
|
contentType = ContentType.ALL
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetContentMainTabAsmrResponse(
|
||||||
|
contentBannerList = contentBannerList,
|
||||||
|
newAsmrContentList = newAsmrContentList,
|
||||||
|
rankAsmrContentList = rankAsmrContentList,
|
||||||
|
eventBannerList = eventBannerList,
|
||||||
|
curationList = curationList
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package kr.co.vividnext.sodalive.content.main.tab.asmr
|
||||||
|
|
||||||
|
import kr.co.vividnext.sodalive.content.main.GetAudioContentMainItem
|
||||||
|
import kr.co.vividnext.sodalive.content.main.GetAudioContentRankingItem
|
||||||
|
import kr.co.vividnext.sodalive.content.main.banner.GetAudioContentBannerResponse
|
||||||
|
import kr.co.vividnext.sodalive.content.main.tab.GetContentCurationResponse
|
||||||
|
import kr.co.vividnext.sodalive.event.GetEventResponse
|
||||||
|
|
||||||
|
data class GetContentMainTabAsmrResponse(
|
||||||
|
val tab: Long = 5,
|
||||||
|
val contentBannerList: List<GetAudioContentBannerResponse>,
|
||||||
|
val newAsmrContentList: List<GetAudioContentMainItem>,
|
||||||
|
val rankAsmrContentList: List<GetAudioContentRankingItem>,
|
||||||
|
val eventBannerList: GetEventResponse,
|
||||||
|
val curationList: List<GetContentCurationResponse>
|
||||||
|
)
|
Loading…
Reference in New Issue