parent
bbfcf5fd4f
commit
5609bdb6f4
|
@ -0,0 +1,7 @@
|
||||||
|
package kr.co.vividnext.sodalive.live.room.menu
|
||||||
|
|
||||||
|
data class GetMenuPresetResponse(
|
||||||
|
val id: Long,
|
||||||
|
val menu: String,
|
||||||
|
val isActive: Boolean
|
||||||
|
)
|
|
@ -1,6 +0,0 @@
|
||||||
package kr.co.vividnext.sodalive.live.room.menu
|
|
||||||
|
|
||||||
data class GetMenuResponse(
|
|
||||||
val id: Long,
|
|
||||||
val menu: String
|
|
||||||
)
|
|
|
@ -9,13 +9,13 @@ class LiveRoomMenuService(
|
||||||
private val idGenerator: RedisIdGenerator,
|
private val idGenerator: RedisIdGenerator,
|
||||||
private val repository: LiveRoomMenuRepository
|
private val repository: LiveRoomMenuRepository
|
||||||
) {
|
) {
|
||||||
fun getAllLiveMenu(creatorId: Long, memberId: Long): List<GetMenuResponse> {
|
fun getAllLiveMenu(creatorId: Long, memberId: Long): List<GetMenuPresetResponse> {
|
||||||
if (creatorId != memberId) throw SodaException("잘못된 요청입니다.")
|
if (creatorId != memberId) throw SodaException("잘못된 요청입니다.")
|
||||||
|
|
||||||
return repository.findByCreatorId(creatorId)
|
return repository.findByCreatorId(creatorId)
|
||||||
.sortedBy { it.id }
|
.sortedBy { it.id }
|
||||||
.asSequence()
|
.asSequence()
|
||||||
.map { GetMenuResponse(id = it.id, menu = it.menu) }
|
.map { GetMenuPresetResponse(id = it.id, menu = it.menu, isActive = it.isActive) }
|
||||||
.toList()
|
.toList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ class LiveRoomMenuService(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getLiveMenu(creatorId: Long): GetMenuResponse? {
|
fun getLiveMenu(creatorId: Long): GetMenuPresetResponse? {
|
||||||
val menuList = repository.findByCreatorId(creatorId = creatorId)
|
val menuList = repository.findByCreatorId(creatorId = creatorId)
|
||||||
|
|
||||||
var activeMenu: LiveRoomMenu? = null
|
var activeMenu: LiveRoomMenu? = null
|
||||||
|
@ -81,7 +81,7 @@ class LiveRoomMenuService(
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetMenuResponse(id = activeMenu.id, menu = activeMenu.menu)
|
return GetMenuPresetResponse(id = activeMenu.id, menu = activeMenu.menu, isActive = activeMenu.isActive)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun deactivateAll(memberId: Long) {
|
fun deactivateAll(memberId: Long) {
|
||||||
|
|
Loading…
Reference in New Issue