Modularized Scala/Spring example
This commit is contained in:
12
scala-spring/common-backend/build.gradle
Normal file
12
scala-spring/common-backend/build.gradle
Normal file
@@ -0,0 +1,12 @@
|
||||
apply plugin: 'scala'
|
||||
|
||||
dependencies {
|
||||
compile "org.scala-lang:scala-library:2.10.2"
|
||||
compile "net.chrisrichardson.eventstore.common:eventstore-common:$eventStoreCommonVersion"
|
||||
|
||||
testCompile scalaTestDependency
|
||||
|
||||
testCompile "junit:junit:4.11"
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package net.chrisrichardson.eventstore.examples.bank.backend.common.accounts
|
||||
|
||||
import net.chrisrichardson.eventstore.{EntityId, Event}
|
||||
|
||||
trait AccountChangedEvent extends Event {
|
||||
val amount : BigDecimal
|
||||
val transactionId : EntityId
|
||||
}
|
||||
|
||||
case class AccountOpenedEvent(initialBalance : BigDecimal) extends Event
|
||||
|
||||
case class AccountCreditedEvent(amount : BigDecimal, transactionId : EntityId) extends AccountChangedEvent
|
||||
|
||||
case class AccountDebitedEvent(amount : BigDecimal, transactionId : EntityId) extends AccountChangedEvent
|
||||
|
||||
case class AccountDebitFailedDueToInsufficientFundsEvent(amount : BigDecimal, transactionId : EntityId) extends AccountChangedEvent
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
@net.chrisrichardson.eventstore.EventEntity(entity="net.chrisrichardson.eventstore.examples.bank.accounts.Account")
|
||||
package net.chrisrichardson.eventstore.examples.bank.backend.common.accounts;
|
||||
@@ -0,0 +1,8 @@
|
||||
package net.chrisrichardson.eventstore.examples.bank.backend.common.transactions
|
||||
|
||||
import net.chrisrichardson.eventstore.Event
|
||||
|
||||
case class MoneyTransferCreatedEvent(details : TransferDetails) extends Event
|
||||
case class DebitRecordedEvent(details : TransferDetails) extends Event
|
||||
case class CreditRecordedEvent(details : TransferDetails) extends Event
|
||||
case class TransferFailedDueToInsufficientFundsEvent() extends Event
|
||||
@@ -0,0 +1,6 @@
|
||||
package net.chrisrichardson.eventstore.examples.bank.backend.common.transactions
|
||||
|
||||
import net.chrisrichardson.eventstore.EntityId
|
||||
|
||||
|
||||
case class TransferDetails(fromAccountId : EntityId, toAccountId : EntityId, amount : BigDecimal)
|
||||
@@ -0,0 +1,2 @@
|
||||
@net.chrisrichardson.eventstore.EventEntity(entity="net.chrisrichardson.eventstore.examples.bank.transactions.MoneyTransfer")
|
||||
package net.chrisrichardson.eventstore.examples.bank.backend.common.transactions;
|
||||
Reference in New Issue
Block a user