-
-
Save Jacoby6000/9fd688de058bda7cc4fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
implicit val userWrites: Writes[User] = ( | |
(__ \ "lastVisit").write[Timestamp] and | |
(__ \ "handle").write[String] and | |
(__ \ "firstName").write[String] and | |
(__ \ "lastName").write[String] and | |
(__ \ "email").write[String] and | |
(__ \ "rating").write[Int] and | |
(__ \ "location").write[String] and | |
(__ \ "shirtSize").write[String] and | |
(__ \ "id").writeNullable[Long] and | |
(__ \ "createdAt").writeNullable[Timestamp] and | |
(__ \ "updatedAt").writeNullable[Timestamp] | |
)(unlift(User.unapply)) | |
implicit val userReads: Reads[User] = ( | |
(__ \ "lastVisit").readNullable[Timestamp].map(_.getOrElse(new Timestamp())) and | |
(__ \ "handle").read[String] and | |
(__ \ "firstName").read[String] and | |
(__ \ "lastName").read[String] and | |
(__ \ "email").read[String] and | |
(__ \ "rating").read[Int] and | |
(__ \ "location").read[String] and | |
(__ \ "shirtSize").read[String] and | |
(__ \ "id").readNullable[Long] and | |
(__ \ "createdAt").readNullable[Timestamp] and | |
(__ \ "updatedAt").readNullable[Timestamp] | |
)(User.apply _) | |
implicit val userFormat: Format[User] = Format(userReads, userWrites) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment