Last active
December 8, 2024 10:11
-
-
Save emag/73829d7ffa6f34ea0d4d20abea248a9a 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 BalanceSheet extends DomainModel[BalanceSheet, BsEvent, BsRejection] { | |
override def initial: BalanceSheet = NotReady | |
override def transition | |
: BsEvent => BalanceSheet => ValidatedNec[BsRejection, BalanceSheet] = { | |
case Initialized(as, ls) => _ => Ready(as, ls).validNec | |
case Journalized(e) => | |
_.mustBeReady.map { bs => | |
bs.copy( | |
assets = ???, // 新しい資産一覧を計算 | |
liabilities = ??? // 新しい負債一覧を計算 | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment