parent
a25b7d5cc2
commit
dd0b751a43
|
@ -232,7 +232,7 @@ class LiveRoomController(
|
|||
) = run {
|
||||
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
||||
|
||||
ApiResponse.ok(service.getDonationStatus(roomId, member))
|
||||
ApiResponse.ok(service.getDonationStatus(roomId))
|
||||
}
|
||||
|
||||
@PostMapping("/quit")
|
||||
|
|
|
@ -11,6 +11,7 @@ import kr.co.vividnext.sodalive.live.room.QQuarterLiveRankings.quarterLiveRankin
|
|||
import kr.co.vividnext.sodalive.live.room.donation.GetLiveRoomDonationItem
|
||||
import kr.co.vividnext.sodalive.live.room.donation.QGetLiveRoomDonationItem
|
||||
import kr.co.vividnext.sodalive.member.QMember.member
|
||||
import org.springframework.beans.factory.annotation.Value
|
||||
import org.springframework.data.jpa.repository.JpaRepository
|
||||
import org.springframework.stereotype.Repository
|
||||
import java.time.LocalDateTime
|
||||
|
@ -47,13 +48,18 @@ interface LiveRoomQueryRepository {
|
|||
|
||||
fun getLiveRoom(id: Long): LiveRoom?
|
||||
fun getLiveRoomAndAccountId(roomId: Long, memberId: Long): LiveRoom?
|
||||
fun getRecentRoomInfo(memberId: Long, cloudFrontHost: String): GetRecentRoomInfoResponse?
|
||||
fun getRecentRoomInfo(memberId: Long): GetRecentRoomInfoResponse?
|
||||
fun getDonationTotal(roomId: Long): Int?
|
||||
fun getDonationList(roomId: Long, cloudFrontHost: String): List<GetLiveRoomDonationItem>
|
||||
fun getDonationList(roomId: Long): List<GetLiveRoomDonationItem>
|
||||
fun getRoomActiveAndChannelNameIsNotNull(memberId: Long): List<LiveRoom>
|
||||
}
|
||||
|
||||
class LiveRoomQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : LiveRoomQueryRepository {
|
||||
class LiveRoomQueryRepositoryImpl(
|
||||
private val queryFactory: JPAQueryFactory,
|
||||
|
||||
@Value("\${cloud.aws.cloud-front.host}")
|
||||
private val cloudFrontHost: String
|
||||
) : LiveRoomQueryRepository {
|
||||
override fun getLiveRoomListNow(
|
||||
offset: Long,
|
||||
limit: Long,
|
||||
|
@ -200,7 +206,7 @@ class LiveRoomQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : L
|
|||
.fetchFirst()
|
||||
}
|
||||
|
||||
override fun getRecentRoomInfo(memberId: Long, cloudFrontHost: String): GetRecentRoomInfoResponse? {
|
||||
override fun getRecentRoomInfo(memberId: Long): GetRecentRoomInfoResponse? {
|
||||
return queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
|
@ -234,7 +240,7 @@ class LiveRoomQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : L
|
|||
.fetchOne()
|
||||
}
|
||||
|
||||
override fun getDonationList(roomId: Long, cloudFrontHost: String): List<GetLiveRoomDonationItem> {
|
||||
override fun getDonationList(roomId: Long): List<GetLiveRoomDonationItem> {
|
||||
return queryFactory
|
||||
.select(
|
||||
QGetLiveRoomDonationItem(
|
||||
|
|
|
@ -690,7 +690,7 @@ class LiveRoomService(
|
|||
}
|
||||
|
||||
fun getRecentRoomInfo(member: Member): GetRecentRoomInfoResponse {
|
||||
return repository.getRecentRoomInfo(memberId = member.id!!, cloudFrontHost = cloudFrontHost)
|
||||
return repository.getRecentRoomInfo(memberId = member.id!!)
|
||||
?: throw SodaException("최근 데이터가 없습니다.")
|
||||
}
|
||||
|
||||
|
@ -1166,9 +1166,9 @@ class LiveRoomService(
|
|||
}
|
||||
}
|
||||
|
||||
fun getDonationStatus(roomId: Long, member: Member): GetLiveRoomDonationStatusResponse {
|
||||
fun getDonationStatus(roomId: Long): GetLiveRoomDonationStatusResponse {
|
||||
val room = repository.getLiveRoom(roomId) ?: throw SodaException("잘못된 요청입니다.")
|
||||
val donationList = repository.getDonationList(roomId = room.id!!, cloudFrontHost = cloudFrontHost)
|
||||
val donationList = repository.getDonationList(roomId = room.id!!)
|
||||
val totalCan = donationList.sumOf { it.can }
|
||||
|
||||
return GetLiveRoomDonationStatusResponse(
|
||||
|
|
Loading…
Reference in New Issue