feat: BAC-30 Implement Jackson Mapping via DTOs

This commit is contained in:
2025-12-06 10:15:59 +01:00
parent b9e60b5d4a
commit a8ccebb504
16 changed files with 240 additions and 70 deletions

View File

@@ -0,0 +1,21 @@
package dto
import dto.subDTO.UserDTO
import logic.game.GameLobby
import model.users.User
case class LobbyInfoDTO(users: List[UserDTO], self: UserDTO, maxPlayers: Int)
object LobbyInfoDTO {
def apply(lobby: GameLobby, user: User): LobbyInfoDTO = {
val session = lobby.getUserSession(user.id)
LobbyInfoDTO(
users = lobby.getPlayers.values.map(user => UserDTO(user)).toList,
self = UserDTO(session),
maxPlayers = lobby.maxPlayers,
)
}
}