Compare commits

...

2 Commits
4.9.0 ... 4.9.1

Author SHA1 Message Date
TeamCity
bf6ffeadb0 ci: bump version to v4.9.1 2025-12-10 08:46:31 +00:00
fa3d21e303 fix: FRO-29 Websocket Communication (#104)
Reviewed-on: #104
Co-authored-by: Janis <janis.e.20@gmx.de>
Co-committed-by: Janis <janis.e.20@gmx.de>
2025-12-10 09:42:50 +01:00
9 changed files with 29 additions and 10 deletions

View File

@@ -219,3 +219,8 @@
### Features ### Features
* BAC-30 Implement Jackson Mapping via DTOs ([#102](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/issues/102)) ([8d697fd](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/8d697fd311478cf792b4631377de4522ecbda9f7)) * BAC-30 Implement Jackson Mapping via DTOs ([#102](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/issues/102)) ([8d697fd](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/8d697fd311478cf792b4631377de4522ecbda9f7))
## (2025-12-10)
### Bug Fixes
* FRO-29 Websocket Communication ([#104](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/issues/104)) ([fa3d21e](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/fa3d21e3038eb07369764850a9ad9badd269ac57))

View File

@@ -4,7 +4,7 @@ import dto.subDTO.UserDTO
import logic.game.GameLobby import logic.game.GameLobby
import model.users.User import model.users.User
case class LobbyInfoDTO(users: List[UserDTO], self: UserDTO, maxPlayers: Int) case class LobbyInfoDTO(gameId: String, users: List[UserDTO], self: UserDTO, maxPlayers: Int)
object LobbyInfoDTO { object LobbyInfoDTO {
@@ -12,6 +12,7 @@ object LobbyInfoDTO {
val session = lobby.getUserSession(user.id) val session = lobby.getUserSession(user.id)
LobbyInfoDTO( LobbyInfoDTO(
gameId = lobby.id,
users = lobby.getPlayers.values.map(user => UserDTO(user)).toList, users = lobby.getPlayers.values.map(user => UserDTO(user)).toList,
self = UserDTO(session), self = UserDTO(session),
maxPlayers = lobby.maxPlayers, maxPlayers = lobby.maxPlayers,

View File

@@ -6,7 +6,7 @@ import model.users.User
import scala.util.Try import scala.util.Try
case class TieInfoDTO(currentPlayer: Option[PlayerDTO], self: Option[PlayerDTO], tiedPlayers: Seq[PlayerDTO], highestAmount: Int) case class TieInfoDTO(gameId: String, currentPlayer: Option[PlayerDTO], self: Option[PlayerDTO], tiedPlayers: Seq[PlayerDTO], highestAmount: Int)
object TieInfoDTO { object TieInfoDTO {
@@ -16,6 +16,7 @@ object TieInfoDTO {
}.getOrElse(None) }.getOrElse(None)
TieInfoDTO( TieInfoDTO(
gameId = lobby.id,
currentPlayer = lobby.logic.playerTieLogic.currentTiePlayer().map(PlayerDTO.apply), currentPlayer = lobby.logic.playerTieLogic.currentTiePlayer().map(PlayerDTO.apply),
self = selfPlayer.map(PlayerDTO.apply), self = selfPlayer.map(PlayerDTO.apply),
tiedPlayers = lobby.logic.playerTieLogic.getTiedPlayers.map(PlayerDTO.apply), tiedPlayers = lobby.logic.playerTieLogic.getTiedPlayers.map(PlayerDTO.apply),

View File

@@ -7,6 +7,7 @@ import model.users.User
import scala.util.Try import scala.util.Try
case class TrumpInfoDTO( case class TrumpInfoDTO(
gameId: String,
chooser: Option[PlayerDTO], chooser: Option[PlayerDTO],
self: Option[PlayerDTO], self: Option[PlayerDTO],
selfHand: Option[HandDTO], selfHand: Option[HandDTO],
@@ -20,6 +21,7 @@ object TrumpInfoDTO {
}.getOrElse(None) }.getOrElse(None)
TrumpInfoDTO( TrumpInfoDTO(
gameId = lobby.id,
chooser = lobby.logic.getTrumpPlayer.map(PlayerDTO(_)), chooser = lobby.logic.getTrumpPlayer.map(PlayerDTO(_)),
self = selfPlayer.map(PlayerDTO(_)), self = selfPlayer.map(PlayerDTO(_)),
selfHand = selfPlayer.flatMap(_.currentHand()).map(HandDTO(_)) selfHand = selfPlayer.flatMap(_.currentHand()).map(HandDTO(_))

View File

@@ -5,6 +5,7 @@ import logic.game.GameLobby
import model.users.User import model.users.User
case class WonInfoDTO( case class WonInfoDTO(
gameId: String,
winner: Option[PodiumPlayerDTO], winner: Option[PodiumPlayerDTO],
allPlayers: Seq[PodiumPlayerDTO] allPlayers: Seq[PodiumPlayerDTO]
) )
@@ -24,6 +25,7 @@ object WonInfoDTO {
val winnerDTO = lobby.logic.getWinner val winnerDTO = lobby.logic.getWinner
WonInfoDTO( WonInfoDTO(
gameId = lobby.id,
winner = winnerDTO.map(player => PodiumPlayerDTO(lobby.logic, player)), winner = winnerDTO.map(player => PodiumPlayerDTO(lobby.logic, player)),
allPlayers = allPlayersDTO allPlayers = allPlayersDTO
) )

View File

@@ -3,7 +3,7 @@ package dto.subDTO
import de.knockoutwhist.cards.Card import de.knockoutwhist.cards.Card
import util.WebUIUtils import util.WebUIUtils
case class CardDTO(identifier: String, path: String, idx: Int) { case class CardDTO(identifier: String, path: String, idx: Option[Int]) {
def toCard: Card = { def toCard: Card = {
WebUIUtils.stringToCard(identifier) WebUIUtils.stringToCard(identifier)
@@ -13,11 +13,19 @@ case class CardDTO(identifier: String, path: String, idx: Int) {
object CardDTO { object CardDTO {
def apply(card: Card, index: Int = 0): CardDTO = { def apply(card: Card, index: Int): CardDTO = {
CardDTO( CardDTO(
identifier = WebUIUtils.cardtoString(card), identifier = WebUIUtils.cardtoString(card),
path = WebUIUtils.cardToPath(card), path = WebUIUtils.cardToPath(card),
idx = index idx = Some(index)
)
}
def apply(card: Card): CardDTO = {
CardDTO(
identifier = WebUIUtils.cardtoString(card),
path = WebUIUtils.cardToPath(card),
idx = None
) )
} }
} }

View File

@@ -3,7 +3,7 @@ package dto.subDTO
import de.knockoutwhist.cards.Card import de.knockoutwhist.cards.Card
import de.knockoutwhist.cards.CardValue.Ace import de.knockoutwhist.cards.CardValue.Ace
case class RoundDTO(trumpSuit: CardDTO, firstRound: Boolean, tricklist: List[TrickDTO]) case class RoundDTO(trumpSuit: CardDTO, firstRound: Boolean, trickList: List[TrickDTO])
object RoundDTO { object RoundDTO {
@@ -11,7 +11,7 @@ object RoundDTO {
RoundDTO( RoundDTO(
trumpSuit = CardDTO(Card(Ace, round.trumpSuit)), trumpSuit = CardDTO(Card(Ace, round.trumpSuit)),
firstRound = round.firstRound, firstRound = round.firstRound,
tricklist = round.tricklist.map(trick => TrickDTO(trick)) trickList = round.tricklist.map(trick => TrickDTO(trick))
) )
} }

View File

@@ -2,13 +2,13 @@ package dto.subDTO
import de.knockoutwhist.rounds.Trick import de.knockoutwhist.rounds.Trick
case class TrickDTO(cards: Map[PlayerDTO, CardDTO], firstCard: Option[CardDTO], winner: Option[PlayerDTO]) case class TrickDTO(cards: Map[String, CardDTO], firstCard: Option[CardDTO], winner: Option[PlayerDTO])
object TrickDTO { object TrickDTO {
def apply(trick: Trick): TrickDTO = { def apply(trick: Trick): TrickDTO = {
TrickDTO( TrickDTO(
cards = trick.cards.map { case (card, player) => PlayerDTO(player) -> CardDTO(card) }, cards = trick.cards.map { case (card, player) => player.id.toString -> CardDTO(card) },
firstCard = trick.firstCard.map(card => CardDTO(card)), firstCard = trick.firstCard.map(card => CardDTO(card)),
winner = trick.winner.map(player => PlayerDTO(player)) winner = trick.winner.map(player => PlayerDTO(player))
) )

View File

@@ -1,3 +1,3 @@
MAJOR=4 MAJOR=4
MINOR=9 MINOR=9
PATCH=0 PATCH=1