Skip to content

Instantly share code, notes, and snippets.

@emag
Last active December 8, 2024 10:11
Show Gist options
  • Save emag/73829d7ffa6f34ea0d4d20abea248a9a to your computer and use it in GitHub Desktop.
Save emag/73829d7ffa6f34ea0d4d20abea248a9a to your computer and use it in GitHub Desktop.
BS 集約の状態更新
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