fix: BAC-29 Implement Mappers for Common Classes (#101)

Reviewed-on: #101
Co-authored-by: Janis <janis.e.20@gmx.de>
Co-committed-by: Janis <janis.e.20@gmx.de>
This commit is contained in:
2025-12-05 19:24:10 +01:00
committed by Janis
parent 73dbe5826a
commit 270f44cc1f
12 changed files with 202 additions and 6 deletions

View File

@@ -0,0 +1,20 @@
package dto
import de.knockoutwhist.control.sublogic.PlayerTieLogic
import play.api.libs.json.{Json, OFormat}
case class TieInfoDTO(currentPlayer: Option[PlayerDTO], tiedPlayers: Seq[PlayerDTO], highestAmount: Int)
object TieInfoDTO {
implicit val tieInfoFormat: OFormat[TieInfoDTO] = Json.format[TieInfoDTO]
def apply(tieInput: PlayerTieLogic): Unit = {
TieInfoDTO(
currentPlayer = tieInput.currentTiePlayer().map(PlayerDTO.apply),
tiedPlayers = tieInput.getTiedPlayers.map(PlayerDTO.apply),
highestAmount = tieInput.highestAllowedNumber()
)
}
}