Created
December 8, 2024 14:08
-
-
Save emag/13c1f6e8718ec4d6dd5e67783eb871f1 to your computer and use it in GitHub Desktop.
BS サービス
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
object BalanceSheetService | |
extends BalanceSheet.Service[BsCommand, BsNotification] { | |
def apply[F[_]: Monad]: App[F, Unit] = App.router { | |
case BsCommand.Initialize(a, l) => | |
for { | |
ready <- App.state.decide(_.initialize(a, l)) | |
aggId <- App.aggregateId | |
_ <- App.publish(BsNotification.BalanceSheetPrepared(aggId, ready)) | |
} yield () | |
case BsCommand.Journalize(e) => | |
for { | |
ready <- App.state.decide(_.journalize(e)) | |
aggId <- App.aggregateId | |
_ <- App.publish(BsNotification.BalanceSheetUpdated(aggId, ready)) | |
} yield () | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment