feat: BAC-27 Implemented endpoint which returns information about the current state

This commit is contained in:
2025-12-06 10:23:31 +01:00
parent da87439a07
commit 1914aa67cd
3 changed files with 5 additions and 59 deletions

View File

@@ -57,12 +57,12 @@ object WebsocketEventMapper {
Json.obj(
"id" -> ("request-" + java.util.UUID.randomUUID().toString),
"event" -> obj.id,
"state" -> toJson(session),
"state" -> stateToJson(session),
"data" -> data
)
}
def toJson(session: UserSession): JsValue = {
def stateToJson(session: UserSession): JsValue = {
session.gameLobby.getLogic.getCurrentState match {
case Lobby => Json.toJson(LobbyInfoDTO(session.gameLobby, session.user))
case InGame => Json.toJson(GameInfoDTO(session.gameLobby, session.user))