From a0877d81ca2844d75dc361b5ce7c99afacd6e25f Mon Sep 17 00:00:00 2001 From: vlad Date: Thu, 25 Jan 2018 14:12:31 -0800 Subject: Extracting query library --- .../pdsuidomain/services/HypothesisService.scala | 69 ---------------------- 1 file changed, 69 deletions(-) delete mode 100644 src/main/scala/xyz/driver/pdsuidomain/services/HypothesisService.scala (limited to 'src/main/scala/xyz/driver/pdsuidomain/services/HypothesisService.scala') diff --git a/src/main/scala/xyz/driver/pdsuidomain/services/HypothesisService.scala b/src/main/scala/xyz/driver/pdsuidomain/services/HypothesisService.scala deleted file mode 100644 index 929dd58..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/services/HypothesisService.scala +++ /dev/null @@ -1,69 +0,0 @@ -package xyz.driver.pdsuidomain.services - -import xyz.driver.core.rest.AuthorizedServiceRequestContext -import xyz.driver.entities.users.AuthUserInfo -import xyz.driver.pdsuicommon.db.Sorting -import xyz.driver.pdsuicommon.domain.UuidId -import xyz.driver.pdsuicommon.error.DomainError -import xyz.driver.pdsuidomain.entities.Hypothesis - -import scala.concurrent.Future - -object HypothesisService { - trait DefaultNotFoundError { - def userMessage: String = "Hypothesis not found" - } - - trait DefaultAccessDeniedError { - def userMessage: String = "Access denied" - } - - sealed trait GetListReply - object GetListReply { - final case class EntityList(xs: Seq[Hypothesis], totalFound: Int) extends GetListReply - - case object AuthorizationError extends GetListReply with DomainError.AuthorizationError { - def userMessage: String = "Access denied" - } - } - - sealed trait CreateReply - object CreateReply { - final case class Created(x: Hypothesis) extends CreateReply - - type Error = CreateReply with DomainError - - case object AuthorizationError - extends CreateReply with DefaultAccessDeniedError with DomainError.AuthorizationError - - final case class CommonError(userMessage: String) extends CreateReply with DomainError - } - - sealed trait DeleteReply - object DeleteReply { - case object Deleted extends DeleteReply - - type Error = DeleteReply with DomainError - - case object NotFoundError extends DeleteReply with DefaultNotFoundError with DomainError.NotFoundError - - case object AuthorizationError - extends DeleteReply with DefaultAccessDeniedError with DomainError.AuthorizationError - - final case class CommonError(userMessage: String) extends DeleteReply with DomainError - } -} - -trait HypothesisService { - - import HypothesisService._ - - def getAll(sorting: Option[Sorting] = None)( - implicit requestContext: AuthorizedServiceRequestContext[AuthUserInfo]): Future[GetListReply] - - def create(draftHypothesis: Hypothesis)( - implicit requestContext: AuthorizedServiceRequestContext[AuthUserInfo]): Future[CreateReply] - - def delete(id: UuidId[Hypothesis])( - implicit requestContext: AuthorizedServiceRequestContext[AuthUserInfo]): Future[DeleteReply] -} -- cgit v1.2.3