Created
December 11, 2019 09:34
-
-
Save lforite/ee813564cf4fc4c5835974598091c06f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| trait ServiceA { | |
| def createA(a: EntityA): RIO[_] | |
| } | |
| trait ClientB { | |
| def getB(bId: EntityBID): RIO[_] | |
| } | |
| case class ServiceA(clientB: ClientB) extends ServiceA { | |
| override def createA(a: EntityA): RIO[_] = { | |
| for { | |
| entityB <- clientB.getB(a.idOfB) | |
| processed <- somePrivateBusinessLogic(entityB) | |
| result <- someMoreBusinessLogic(processed) | |
| _ <- logger.info(s"Successfully processed entity ${a.id}") | |
| } yield result | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment