blob: 0d6763c8d8191bfe203efa28b9be27580f4afcff (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
package xyz.driver.pdsuidomain.formats.json.hypothesis
import java.util.UUID
import xyz.driver.pdsuidomain.entities.Hypothesis
import play.api.libs.functional.syntax._
import play.api.libs.json.{Format, JsPath}
final case class ApiHypothesis(id: UUID, name: String, treatmentType: String, description: String)
object ApiHypothesis {
implicit val format: Format[ApiHypothesis] = (
(JsPath \ "id").format[UUID] and
(JsPath \ "name").format[String] and
(JsPath \ "treatmentType").format[String] and
(JsPath \ "description").format[String]
) (ApiHypothesis.apply, unlift(ApiHypothesis.unapply))
def fromDomain(hypothesis: Hypothesis) = ApiHypothesis(
id = hypothesis.id.id,
name = hypothesis.name,
treatmentType = hypothesis.treatmentType,
description = hypothesis.description
)
}
|