aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/services/InterventionService.scala
diff options
context:
space:
mode:
authorKseniya Tomskikh <ktomskih@datamonsters.co>2017-09-28 17:52:21 +0700
committerKseniya Tomskikh <ktomskih@datamonsters.co>2017-09-28 17:52:21 +0700
commit283ca02360949143ffe7ee8ad87d51902426b450 (patch)
treec098efe0628fc80a0a6b8f05fa465a99ff494fb8 /src/main/scala/xyz/driver/pdsuidomain/services/InterventionService.scala
parentd82c93fef0fc0bb937220334f73c264fbb1082f2 (diff)
parentc24679f1ae7d7ccc4e6693535b0aa3ac0e1ca225 (diff)
downloadrest-query-283ca02360949143ffe7ee8ad87d51902426b450.tar.gz
rest-query-283ca02360949143ffe7ee8ad87d51902426b450.tar.bz2
rest-query-283ca02360949143ffe7ee8ad87d51902426b450.zip
Merge branch 'master' into synch-refactor
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/services/InterventionService.scala')
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/services/InterventionService.scala36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/services/InterventionService.scala b/src/main/scala/xyz/driver/pdsuidomain/services/InterventionService.scala
index 439e456..1e7c7f1 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/services/InterventionService.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/services/InterventionService.scala
@@ -61,6 +61,37 @@ object InterventionService {
final case class CommonError(userMessage: String) extends UpdateReply with DomainError
}
+ sealed trait CreateReply
+ object CreateReply {
+ final case class Created(x: InterventionWithArms) 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
+
+ implicit def toPhiString(reply: CreateReply): PhiString = reply match {
+ case Created(x) => phi"Created($x)"
+ case x: Error => DomainError.toPhiString(x)
+ }
+ }
+
+ 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 InterventionService {
@@ -76,4 +107,9 @@ trait InterventionService {
def update(origIntervention: InterventionWithArms, draftIntervention: InterventionWithArms)(
implicit requestContext: AuthenticatedRequestContext): Future[UpdateReply]
+
+ def create(draftIntervention: InterventionWithArms)(
+ implicit requestContext: AuthenticatedRequestContext): Future[CreateReply]
+
+ def delete(id: LongId[Intervention])(implicit requestContext: AuthenticatedRequestContext): Future[DeleteReply]
}