Reviewed-on: #101 Co-authored-by: Janis <janis.e.20@gmx.de> Co-committed-by: Janis <janis.e.20@gmx.de>
19 lines
334 B
Scala
19 lines
334 B
Scala
package dto
|
|
|
|
import model.users.User
|
|
import play.api.libs.json.{Json, OFormat}
|
|
|
|
case class UserDTO(id: String, username: String)
|
|
|
|
object UserDTO {
|
|
|
|
implicit val userFormat: OFormat[UserDTO] = Json.format[UserDTO]
|
|
|
|
def apply(user: User): UserDTO = {
|
|
UserDTO(
|
|
id = user.id.toString,
|
|
username = user.name
|
|
)
|
|
}
|
|
|
|
} |