No Description

Models.scala 1.9KB

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

Powered by TurnKey Linux.