메뉴판

- 활성화 여부를 표시하는 isActive 추가
This commit is contained in:
Klaus 2024-03-07 04:34:41 +09:00
parent bbfcf5fd4f
commit 5609bdb6f4
3 changed files with 11 additions and 10 deletions

View File

@ -0,0 +1,7 @@
package kr.co.vividnext.sodalive.live.room.menu
data class GetMenuPresetResponse(
val id: Long,
val menu: String,
val isActive: Boolean
)

View File

@ -1,6 +0,0 @@
package kr.co.vividnext.sodalive.live.room.menu
data class GetMenuResponse(
val id: Long,
val menu: String
)

View File

@ -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) {