feat: BAC-30 Implement Jackson Mapping via DTOs
This commit is contained in:
23
knockoutwhistweb/app/dto/subDTO/CardDTO.scala
Normal file
23
knockoutwhistweb/app/dto/subDTO/CardDTO.scala
Normal file
@@ -0,0 +1,23 @@
|
||||
package dto.subDTO
|
||||
|
||||
import de.knockoutwhist.cards.Card
|
||||
import util.WebUIUtils
|
||||
|
||||
case class CardDTO(identifier: String, path: String, idx: Int) {
|
||||
|
||||
def toCard: Card = {
|
||||
WebUIUtils.stringToCard(identifier)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
object CardDTO {
|
||||
|
||||
def apply(card: Card, index: Int = 0): CardDTO = {
|
||||
CardDTO(
|
||||
identifier = WebUIUtils.cardtoString(card),
|
||||
path = WebUIUtils.cardToPath(card),
|
||||
idx = index
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user