라이브 방 - 라이브 참여자 프로필 이미지에 cloudfront host 추가

This commit is contained in:
Klaus 2023-08-01 05:24:35 +09:00
parent fb1386be05
commit 3cac42b5b9
3 changed files with 20 additions and 16 deletions

View File

@ -451,9 +451,9 @@ class LiveRoomService(
roomInfo.removeManager(member)
if (room.member!!.id == member.id) {
roomInfo.addSpeaker(member)
roomInfo.addSpeaker(member, cloudFrontHost)
} else {
roomInfo.addListener(member)
roomInfo.addListener(member, cloudFrontHost)
}
roomInfoRepository.save(roomInfo)
@ -653,9 +653,9 @@ class LiveRoomService(
}
// 조회 하는 유저
val memberResponse = LiveRoomMember(member)
val memberResponse = LiveRoomMember(member, cloudFrontHost)
// 조회 당하는 유저
val userResponse = LiveRoomMember(user)
val userResponse = LiveRoomMember(user, cloudFrontHost)
val isSpeaker = if (
room.member!!.id!! != userId &&
@ -713,7 +713,7 @@ class LiveRoomService(
roomInfo.removeListener(account)
roomInfo.removeManager(account)
roomInfo.addSpeaker(account)
roomInfo.addSpeaker(account, cloudFrontHost)
roomInfoRepository.save(roomInfo)
}
@ -727,7 +727,7 @@ class LiveRoomService(
roomInfo.removeSpeaker(member)
roomInfo.removeManager(member)
roomInfo.addListener(member)
roomInfo.addListener(member, cloudFrontHost)
roomInfoRepository.save(roomInfo)
}
@ -742,7 +742,7 @@ class LiveRoomService(
val roomInfo = roomInfoRepository.findByIdOrNull(request.roomId)
?: throw SodaException("해당하는 라이브의 정보가 없습니다.")
val roomAccountResponse = LiveRoomMember(member = user)
val roomAccountResponse = LiveRoomMember(member = user, cloudFrontHost)
if (roomInfo.managerList.contains(roomAccountResponse)) {
throw SodaException("이미 매니저 입니다.")
}
@ -756,7 +756,7 @@ class LiveRoomService(
roomInfo.removeListener(user)
roomInfo.removeSpeaker(user)
roomInfo.addManager(user)
roomInfo.addManager(user, cloudFrontHost)
roomInfoRepository.save(roomInfo)
}

View File

@ -23,8 +23,8 @@ data class LiveRoomInfo(
var managerCount = 0
private set
fun addSpeaker(member: Member) {
val liveRoomMember = LiveRoomMember(member)
fun addSpeaker(member: Member, cloudFrontHost: String) {
val liveRoomMember = LiveRoomMember(member, cloudFrontHost)
liveRoomMember.role = LiveRoomMemberRole.SPEAKER
val speakerSet = speakerList.toMutableSet()
@ -43,8 +43,8 @@ data class LiveRoomInfo(
speakerCount = speakerList.size
}
fun addListener(member: Member) {
val liveRoomMember = LiveRoomMember(member)
fun addListener(member: Member, cloudFrontHost: String) {
val liveRoomMember = LiveRoomMember(member, cloudFrontHost)
liveRoomMember.role = LiveRoomMemberRole.LISTENER
val listenerSet = listenerList.toMutableSet()
@ -63,8 +63,8 @@ data class LiveRoomInfo(
listenerCount = listenerList.size
}
fun addManager(member: Member) {
val liveRoomMember = LiveRoomMember(member)
fun addManager(member: Member, cloudFrontHost: String) {
val liveRoomMember = LiveRoomMember(member, cloudFrontHost)
liveRoomMember.role = LiveRoomMemberRole.MANAGER
val managerSet = managerList.toMutableSet()

View File

@ -6,6 +6,7 @@ import kr.co.vividnext.sodalive.live.room.info.LiveRoomInfoRedisRepository
import kr.co.vividnext.sodalive.live.room.info.LiveRoomMember
import kr.co.vividnext.sodalive.member.Member
import kr.co.vividnext.sodalive.member.MemberRepository
import org.springframework.beans.factory.annotation.Value
import org.springframework.data.repository.findByIdOrNull
import org.springframework.stereotype.Service
@ -14,7 +15,10 @@ class LiveRoomKickOutService(
private val roomInfoRepository: LiveRoomInfoRedisRepository,
private val repository: LiveRoomKickOutRedisRepository,
private val accountRepository: MemberRepository,
private val roomRepository: LiveRoomRepository
private val roomRepository: LiveRoomRepository,
@Value("\${cloud.aws.cloud-front.host}")
private val cloudFrontHost: String
) {
fun kickOut(request: LiveRoomKickOutRequest, member: Member) {
val room = roomRepository.findByIdOrNull(request.roomId)
@ -27,7 +31,7 @@ class LiveRoomKickOutService(
throw SodaException("해당하는 라이브가 없습니다.")
}
if (!roomInfo.managerList.contains(LiveRoomMember(member)) && room.member!!.id != member.id) {
if (!roomInfo.managerList.contains(LiveRoomMember(member, cloudFrontHost)) && room.member!!.id != member.id) {
throw SodaException("권한이 없습니다.")
}