No Description

Models.scala 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package fr.natan.akkastreamfileprocessingapi.models
  2. import play.api.libs.json.{JsValue, Json, Writes}
  3. object Models {
  4. final case class Person(
  5. personID: String,
  6. primaryName: String,
  7. birthYear: String,
  8. deathYear: String,
  9. primaryProfession: List[String],
  10. knownForTitles: List[String]
  11. ) {
  12. implicit val personFormat = new Writes[Person] {
  13. override def writes(person: Person): JsValue = Json.obj(
  14. "person id" -> person.personID,
  15. "primary name" -> person.primaryName,
  16. "birth year" -> person.birthYear,
  17. "death year" -> person.deathYear,
  18. "primary profession" -> person.primaryProfession,
  19. "known for titles" -> person.knownForTitles
  20. )
  21. }
  22. }
  23. final case class TvSerie(
  24. tvSerieID: String,
  25. titleType: String,
  26. primaryTitle: String,
  27. originalTitle: String,
  28. startYear: String,
  29. endYear: String,
  30. runtimeMinutes: String,
  31. genres: List[String]
  32. ) {
  33. implicit val tvSerieFormat = new Writes[TvSerie] {
  34. override def writes(tvSerie: TvSerie): JsValue = Json.obj(
  35. "tv serie id" -> tvSerie.tvSerieID,
  36. "tv serie type" -> tvSerie.titleType,
  37. "primary title" -> tvSerie.primaryTitle,
  38. "original title" -> tvSerie.originalTitle,
  39. "start year" -> tvSerie.startYear,
  40. "end year" -> tvSerie.endYear,
  41. "runtime minutes" -> tvSerie.runtimeMinutes,
  42. "genres" -> tvSerie.genres
  43. )
  44. }
  45. }
  46. }

Powered by TurnKey Linux.