Files
KnockOutWhist-Web/knockoutwhistweb/app/dto/PlayerDTO.scala
Janis 270f44cc1f 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>
2025-12-05 19:24:10 +01:00

20 lines
437 B
Scala

package dto
import de.knockoutwhist.player.AbstractPlayer
import play.api.libs.json.{Json, OFormat}
case class PlayerDTO(id: String, name: String, dogLife: Boolean)
object PlayerDTO {
implicit val playerFormat: OFormat[PlayerDTO] = Json.format[PlayerDTO]
def apply(player: AbstractPlayer): PlayerDTO = {
PlayerDTO(
id = player.id.toString,
name = player.name,
dogLife = player.isInDogLife
)
}
}