aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/formats/json/document/ApiPartialDocument.scala
diff options
context:
space:
mode:
authorvlad <vlad@driver.xyz>2017-06-30 19:38:37 -0700
committervlad <vlad@driver.xyz>2017-06-30 19:38:37 -0700
commit96d81a36286e41035ff4068859a3b0f9da924fbc (patch)
tree8d9f0014140d1f07ca449b56adaba8ccb3d2fc59 /src/main/scala/xyz/driver/pdsuidomain/formats/json/document/ApiPartialDocument.scala
parenta997aa6539d1f0af4ab4fc395ff2033335da312a (diff)
downloadrest-query-96d81a36286e41035ff4068859a3b0f9da924fbc.tar.gz
rest-query-96d81a36286e41035ff4068859a3b0f9da924fbc.tar.bz2
rest-query-96d81a36286e41035ff4068859a3b0f9da924fbc.zip
Latest PDS UI utils including all the domain stuffv0.1.12
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/formats/json/document/ApiPartialDocument.scala')
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/document/ApiPartialDocument.scala8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/document/ApiPartialDocument.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/document/ApiPartialDocument.scala
index 7682bb5..84e9e09 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/document/ApiPartialDocument.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/document/ApiPartialDocument.scala
@@ -31,15 +31,17 @@ final case class ApiPartialDocument(recordId: Option[Long],
def applyTo(orig: Document): Document = Document(
id = orig.id,
- status = status.map(DocumentUtils.statusFromString).getOrElse(orig.status),
+ status = status.map(Document.Status.fromString).getOrElse(orig.status),
previousStatus = orig.previousStatus,
assignee = assignee.map(LongId[User]).cata(Some(_), None, orig.assignee),
previousAssignee = orig.previousAssignee,
+ lastActiveUserId = orig.lastActiveUserId,
recordId = recordId.map(LongId[MedicalRecord]).getOrElse(orig.recordId),
physician = physician.orElse(orig.physician),
typeId = typeId.map(LongId[DocumentType]).cata(Some(_), None, orig.typeId),
providerName = provider.cata(Some(_), None, orig.providerName),
providerTypeId = providerTypeId.map(LongId[ProviderType]).cata(Some(_), None, orig.providerTypeId),
+ requiredType = orig.requiredType,
meta = meta.cata(x => Some(TextJson(JsonSerializer.deserialize[Meta](x))), None, orig.meta),
startDate = startDate.cata(Some(_), None, orig.startDate),
endDate = endDate.cata(Some(_), None, orig.endDate),
@@ -64,10 +66,12 @@ final case class ApiPartialDocument(recordId: Option[Long],
endDate = endDate.toOption,
providerName = provider.toOption,
providerTypeId = providerTypeId.map(LongId[ProviderType]).toOption,
+ requiredType = None,
meta = meta.map(x => TextJson(JsonSerializer.deserialize[Meta](x))).toOption,
previousStatus = None,
assignee = None,
previousAssignee = None,
+ lastActiveUserId = None,
lastUpdate = LocalDateTime.MIN
)
} else {
@@ -87,7 +91,7 @@ object ApiPartialDocument {
(JsPath \ "provider").readTristate[String] and
(JsPath \ "providerTypeId").readTristate[Long] and
(JsPath \ "status").readNullable[String](Reads.of[String].filter(ValidationError("unknown status"))({
- case x if DocumentUtils.statusFromString.isDefinedAt(x) => true
+ case x if Document.Status.fromString.isDefinedAt(x) => true
case _ => false
})) and
(JsPath \ "assignee").readTristate[Long] and