사용하지 않는 API 제거
This commit is contained in:
parent
06d670df50
commit
5e093a5555
|
@ -15,19 +15,8 @@ import org.springframework.web.bind.annotation.RestController
|
||||||
@RequestMapping("/audio-content/main")
|
@RequestMapping("/audio-content/main")
|
||||||
class AudioContentMainController(
|
class AudioContentMainController(
|
||||||
private val service: AudioContentMainService,
|
private val service: AudioContentMainService,
|
||||||
private val orderService: OrderService,
|
private val orderService: OrderService
|
||||||
private val manageService: AudioContentMainManageService
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
@GetMapping
|
|
||||||
fun getMain(
|
|
||||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
|
||||||
) = run {
|
|
||||||
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
|
||||||
|
|
||||||
ApiResponse.ok(manageService.getMain(member))
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/new-content-upload-creator")
|
@GetMapping("/new-content-upload-creator")
|
||||||
fun newContentUploadCreatorList(
|
fun newContentUploadCreatorList(
|
||||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
||||||
|
|
|
@ -1,94 +0,0 @@
|
||||||
package kr.co.vividnext.sodalive.content.main
|
|
||||||
|
|
||||||
import kr.co.vividnext.sodalive.content.AudioContentRepository
|
|
||||||
import kr.co.vividnext.sodalive.content.AudioContentService
|
|
||||||
import kr.co.vividnext.sodalive.content.order.OrderService
|
|
||||||
import kr.co.vividnext.sodalive.content.theme.AudioContentThemeQueryRepository
|
|
||||||
import kr.co.vividnext.sodalive.member.Member
|
|
||||||
import kr.co.vividnext.sodalive.member.block.BlockMemberRepository
|
|
||||||
import org.springframework.beans.factory.annotation.Value
|
|
||||||
import org.springframework.stereotype.Service
|
|
||||||
import org.springframework.transaction.annotation.Transactional
|
|
||||||
import java.time.DayOfWeek
|
|
||||||
import java.time.LocalDateTime
|
|
||||||
import java.time.temporal.TemporalAdjusters
|
|
||||||
|
|
||||||
@Service
|
|
||||||
class AudioContentMainManageService(
|
|
||||||
private val service: AudioContentMainService,
|
|
||||||
private val orderService: OrderService,
|
|
||||||
private val audioContentService: AudioContentService,
|
|
||||||
|
|
||||||
private val repository: AudioContentRepository,
|
|
||||||
private val blockMemberRepository: BlockMemberRepository,
|
|
||||||
private val audioContentThemeRepository: AudioContentThemeQueryRepository,
|
|
||||||
|
|
||||||
@Value("\${cloud.aws.cloud-front.host}")
|
|
||||||
private val imageHost: String
|
|
||||||
) {
|
|
||||||
@Transactional(readOnly = true)
|
|
||||||
fun getMain(member: Member): GetAudioContentMainResponse {
|
|
||||||
val memberId = member.id!!
|
|
||||||
val isAdult = member.auth != null
|
|
||||||
|
|
||||||
val newContentUploadCreatorList = service.getNewContentUploadCreatorList(
|
|
||||||
memberId = memberId,
|
|
||||||
isAdult = isAdult
|
|
||||||
)
|
|
||||||
|
|
||||||
val bannerList = service.getAudioContentMainBannerList(memberId = memberId, isAdult = isAdult)
|
|
||||||
|
|
||||||
val orderList = orderService.getAudioContentMainOrderList(
|
|
||||||
memberId = memberId,
|
|
||||||
limit = 20
|
|
||||||
)
|
|
||||||
|
|
||||||
// 콘텐츠 테마
|
|
||||||
val themeList = audioContentThemeRepository.getActiveThemeOfContent(isAdult = isAdult)
|
|
||||||
|
|
||||||
// 새 콘텐츠 20개 - 시간 내림차순 정렬
|
|
||||||
val newContentList = repository.findByTheme(
|
|
||||||
cloudfrontHost = imageHost,
|
|
||||||
isAdult = isAdult
|
|
||||||
)
|
|
||||||
.asSequence()
|
|
||||||
.filter {
|
|
||||||
!blockMemberRepository.isBlocked(
|
|
||||||
blockedMemberId = memberId,
|
|
||||||
memberId = it.creatorId
|
|
||||||
)
|
|
||||||
}
|
|
||||||
.toList()
|
|
||||||
|
|
||||||
val curationList = service.getAudioContentCurationList(memberId = memberId, isAdult = isAdult)
|
|
||||||
|
|
||||||
val currentDateTime = LocalDateTime.now()
|
|
||||||
val startDate = currentDateTime
|
|
||||||
.minusWeeks(1)
|
|
||||||
.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY))
|
|
||||||
.withHour(15)
|
|
||||||
.withMinute(0)
|
|
||||||
.withSecond(0)
|
|
||||||
val endDate = startDate.plusDays(7)
|
|
||||||
|
|
||||||
val contentRankingSortTypeList = audioContentService.getContentRankingSortTypeList()
|
|
||||||
val contentRanking = audioContentService.getAudioContentRanking(
|
|
||||||
isAdult = isAdult,
|
|
||||||
startDate = startDate,
|
|
||||||
endDate = endDate,
|
|
||||||
offset = 0,
|
|
||||||
limit = 12
|
|
||||||
)
|
|
||||||
|
|
||||||
return GetAudioContentMainResponse(
|
|
||||||
newContentUploadCreatorList = newContentUploadCreatorList,
|
|
||||||
bannerList = bannerList,
|
|
||||||
orderList = orderList,
|
|
||||||
themeList = themeList,
|
|
||||||
newContentList = newContentList,
|
|
||||||
curationList = curationList,
|
|
||||||
contentRankingSortTypeList = contentRankingSortTypeList,
|
|
||||||
contentRanking = contentRanking
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue