Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package models
- import org.joda.time.DateTime
- import play.api.libs.json.{Json, Writes, JsPath, Reads}
- import play.api.libs.functional.syntax._
- case class Collab(id: Int, pays: String, entree: DateTime, naiss: DateTime, sexe: String, nbHeureDef: Int, nbItg: Int)
- object Collab{
- implicit val collabReads : Reads[Collab] = (
- (JsPath \ "id").read[Int] and
- (JsPath \ "pays").read[String] and
- (JsPath \ "entree").read[DateTime] and
- (JsPath \ "naiss").read[DateTime] and
- (JsPath \ "sexe").read[String] and
- (JsPath \ "nbHeureDef").read[Int] and
- (JsPath \ "nbItg").read[Int]
- )(Collab.apply _)
- implicit val collabWrites = new Writes[Collab] {
- def writes(collab: Collab) = Json.obj(
- "id" -> collab.id,
- "pays" -> collab.pays,
- "entree" -> collab.entree,
- "naiss" -> collab.naiss,
- "sexe" -> collab.sexe,
- "nbHeureDef" -> collab.nbHeureDef,
- "nbItg" -> collab.nbItg
- )
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement