aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/services/rest/RestPatientLabelService.scala
diff options
context:
space:
mode:
authorKseniya Tomskikh <ktomskih@datamonsters.co>2017-12-04 16:25:27 +0700
committerKseniya Tomskikh <ktomskih@datamonsters.co>2017-12-04 16:25:27 +0700
commitbb37df3a7d871ae4ff37c3cfc3fecb11f1f245c3 (patch)
tree0fbc3269a14c06ee555e89342533e70749090d82 /src/main/scala/xyz/driver/pdsuidomain/services/rest/RestPatientLabelService.scala
parented8db038b3b74e0089fe3415d4e3df5ceb882d86 (diff)
downloadrest-query-bb37df3a7d871ae4ff37c3cfc3fecb11f1f245c3.tar.gz
rest-query-bb37df3a7d871ae4ff37c3cfc3fecb11f1f245c3.tar.bz2
rest-query-bb37df3a7d871ae4ff37c3cfc3fecb11f1f245c3.zip
PDSUI-2432 Removed *-Reply classes of TM
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/services/rest/RestPatientLabelService.scala')
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/services/rest/RestPatientLabelService.scala21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/services/rest/RestPatientLabelService.scala b/src/main/scala/xyz/driver/pdsuidomain/services/rest/RestPatientLabelService.scala
index a6ef5b4..4e9bee7 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/services/rest/RestPatientLabelService.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/services/rest/RestPatientLabelService.scala
@@ -22,13 +22,12 @@ class RestPatientLabelService(transport: ServiceTransport, baseUri: Uri)(
import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import xyz.driver.pdsuidomain.formats.json.listresponse._
import xyz.driver.pdsuidomain.formats.json.patientlabel._
- import xyz.driver.pdsuidomain.services.PatientLabelService._
def getAll(patientId: UuidId[Patient],
filter: SearchFilterExpr = SearchFilterExpr.Empty,
sorting: Option[Sorting] = None,
pagination: Option[Pagination] = None)(
- implicit requestContext: AuthorizedServiceRequestContext[AuthUserInfo]): Future[GetListReply] = {
+ implicit requestContext: AuthorizedServiceRequestContext[AuthUserInfo]): Future[(Seq[RichPatientLabel], Int)] = {
val request = HttpRequest(HttpMethods.GET,
endpointUri(baseUri,
s"/v1/patient/$patientId/label",
@@ -37,7 +36,7 @@ class RestPatientLabelService(transport: ServiceTransport, baseUri: Uri)(
response <- transport.sendRequestGetResponse(requestContext)(request)
reply <- apiResponse[ListResponse[RichPatientLabel]](response)
} yield {
- GetListReply.EntityList(reply.items, reply.meta.itemsCount)
+ (reply.items, reply.meta.itemsCount)
}
}
@@ -45,30 +44,30 @@ class RestPatientLabelService(transport: ServiceTransport, baseUri: Uri)(
hypothesisId: UuidId[Hypothesis],
pagination: Option[Pagination] = None)(
implicit requestContext: AuthorizedServiceRequestContext[AuthUserInfo]
- ): Future[GetDefiningCriteriaListReply] = {
+ ): Future[(Seq[PatientLabel], Int)] = {
val request = HttpRequest(HttpMethods.GET,
endpointUri(baseUri, s"/patient/$patientId/hypothesis", paginationQuery(pagination)))
for {
response <- transport.sendRequestGetResponse(requestContext)(request)
reply <- apiResponse[ListResponse[PatientLabel]](response)
} yield {
- GetDefiningCriteriaListReply.EntityList(reply.items, reply.meta.itemsCount)
+ (reply.items, reply.meta.itemsCount)
}
}
def getByLabelIdOfPatient(patientId: UuidId[Patient], labelId: LongId[Label])(
- implicit requestContext: AuthorizedServiceRequestContext[AuthUserInfo]): Future[GetByLabelIdReply] = {
+ implicit requestContext: AuthorizedServiceRequestContext[AuthUserInfo]): Future[RichPatientLabel] = {
val request = HttpRequest(HttpMethods.GET, endpointUri(baseUri, s"/v1/patient/$patientId/label/$labelId"))
for {
response <- transport.sendRequestGetResponse(requestContext)(request)
- reply <- apiResponse[RichPatientLabel](response)
+ entity <- apiResponse[RichPatientLabel](response)
} yield {
- GetByLabelIdReply.Entity(reply)
+ entity
}
}
def update(origPatientLabel: PatientLabel, draftPatientLabel: PatientLabel)(
- implicit requestContext: AuthorizedServiceRequestContext[AuthUserInfo]): Future[UpdateReply] = {
+ implicit requestContext: AuthorizedServiceRequestContext[AuthUserInfo]): Future[RichPatientLabel] = {
for {
entity <- Marshal(draftPatientLabel).to[RequestEntity]
request = HttpRequest(
@@ -76,9 +75,9 @@ class RestPatientLabelService(transport: ServiceTransport, baseUri: Uri)(
endpointUri(baseUri, s"/v1/patient/${origPatientLabel.patientId}/label/${origPatientLabel.labelId}"))
.withEntity(entity)
response <- transport.sendRequestGetResponse(requestContext)(request)
- reply <- apiResponse[RichPatientLabel](response)
+ entity <- apiResponse[RichPatientLabel](response)
} yield {
- UpdateReply.Updated(reply)
+ entity
}
}