Browse Source

server: Move the Balance model to the persisted package

master
Alexis Hernandez 6 years ago
parent
commit
685b54b576
  1. 3
      server/app/com/xsn/explorer/data/BalanceDataHandler.scala
  2. 3
      server/app/com/xsn/explorer/data/anorm/BalancePostgresDataHandler.scala
  3. 4
      server/app/com/xsn/explorer/data/anorm/LedgerPostgresDataHandler.scala
  4. 3
      server/app/com/xsn/explorer/data/anorm/dao/BalancePostgresDAO.scala
  5. 2
      server/app/com/xsn/explorer/data/anorm/parsers/BalanceParsers.scala
  6. 3
      server/app/com/xsn/explorer/data/async/BalanceFutureDataHandler.scala
  7. 3
      server/app/com/xsn/explorer/models/persisted/Balance.scala
  8. 4
      server/app/com/xsn/explorer/services/AddressService.scala
  9. 3
      server/app/com/xsn/explorer/services/BalanceService.scala
  10. 2
      server/test/com/xsn/explorer/data/BalancePostgresDataHandlerSpec.scala
  11. 3
      server/test/com/xsn/explorer/data/StatisticsPostgresDataHandlerSpec.scala
  12. 3
      server/test/com/xsn/explorer/helpers/BalanceDummyDataHandler.scala
  13. 2
      server/test/controllers/AddressesControllerSpec.scala
  14. 2
      server/test/controllers/BalancesControllerSpec.scala

3
server/app/com/xsn/explorer/data/BalanceDataHandler.scala

@ -4,7 +4,8 @@ import com.alexitc.playsonify.core.ApplicationResult
import com.alexitc.playsonify.models.ordering.FieldOrdering import com.alexitc.playsonify.models.ordering.FieldOrdering
import com.alexitc.playsonify.models.pagination.{Limit, PaginatedQuery, PaginatedResult} import com.alexitc.playsonify.models.pagination.{Limit, PaginatedQuery, PaginatedResult}
import com.xsn.explorer.models.fields.BalanceField import com.xsn.explorer.models.fields.BalanceField
import com.xsn.explorer.models.{Address, Balance} import com.xsn.explorer.models.Address
import com.xsn.explorer.models.persisted.Balance
import scala.language.higherKinds import scala.language.higherKinds

3
server/app/com/xsn/explorer/data/anorm/BalancePostgresDataHandler.scala

@ -7,7 +7,8 @@ import com.xsn.explorer.data.BalanceBlockingDataHandler
import com.xsn.explorer.data.anorm.dao.BalancePostgresDAO import com.xsn.explorer.data.anorm.dao.BalancePostgresDAO
import com.xsn.explorer.errors.BalanceUnknownError import com.xsn.explorer.errors.BalanceUnknownError
import com.xsn.explorer.models.fields.BalanceField import com.xsn.explorer.models.fields.BalanceField
import com.xsn.explorer.models.{Address, Balance} import com.xsn.explorer.models.Address
import com.xsn.explorer.models.persisted.Balance
import javax.inject.Inject import javax.inject.Inject
import org.scalactic.{Good, One, Or} import org.scalactic.{Good, One, Or}
import play.api.db.Database import play.api.db.Database

4
server/app/com/xsn/explorer/data/anorm/LedgerPostgresDataHandler.scala

@ -7,8 +7,8 @@ import com.alexitc.playsonify.models.ApplicationError
import com.xsn.explorer.data.LedgerBlockingDataHandler import com.xsn.explorer.data.LedgerBlockingDataHandler
import com.xsn.explorer.data.anorm.dao.{AggregatedAmountPostgresDAO, BalancePostgresDAO, BlockPostgresDAO, TransactionPostgresDAO} import com.xsn.explorer.data.anorm.dao.{AggregatedAmountPostgresDAO, BalancePostgresDAO, BlockPostgresDAO, TransactionPostgresDAO}
import com.xsn.explorer.errors.{PostgresForeignKeyViolationError, PreviousBlockMissingError, RepeatedBlockHeightError} import com.xsn.explorer.errors.{PostgresForeignKeyViolationError, PreviousBlockMissingError, RepeatedBlockHeightError}
import com.xsn.explorer.models.persisted.{Block, Transaction} import com.xsn.explorer.models.persisted.{Balance, Block, Transaction}
import com.xsn.explorer.models.{Address, Balance} import com.xsn.explorer.models.Address
import com.xsn.explorer.util.Extensions.ListOptionExt import com.xsn.explorer.util.Extensions.ListOptionExt
import javax.inject.Inject import javax.inject.Inject
import org.scalactic.Good import org.scalactic.Good

3
server/app/com/xsn/explorer/data/anorm/dao/BalancePostgresDAO.scala

@ -8,7 +8,8 @@ import com.alexitc.playsonify.models.pagination.{Count, Limit, PaginatedQuery}
import com.alexitc.playsonify.sql.FieldOrderingSQLInterpreter import com.alexitc.playsonify.sql.FieldOrderingSQLInterpreter
import com.xsn.explorer.data.anorm.parsers.BalanceParsers._ import com.xsn.explorer.data.anorm.parsers.BalanceParsers._
import com.xsn.explorer.models.fields.BalanceField import com.xsn.explorer.models.fields.BalanceField
import com.xsn.explorer.models.{Address, Balance} import com.xsn.explorer.models.Address
import com.xsn.explorer.models.persisted.Balance
import javax.inject.Inject import javax.inject.Inject
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory

2
server/app/com/xsn/explorer/data/anorm/parsers/BalanceParsers.scala

@ -2,7 +2,7 @@ package com.xsn.explorer.data.anorm.parsers
import anorm.SqlParser._ import anorm.SqlParser._
import anorm._ import anorm._
import com.xsn.explorer.models.Balance import com.xsn.explorer.models.persisted.Balance
object BalanceParsers { object BalanceParsers {

3
server/app/com/xsn/explorer/data/async/BalanceFutureDataHandler.scala

@ -7,7 +7,8 @@ import com.alexitc.playsonify.models.pagination.PaginatedQuery
import com.xsn.explorer.data.{BalanceBlockingDataHandler, BalanceDataHandler} import com.xsn.explorer.data.{BalanceBlockingDataHandler, BalanceDataHandler}
import com.xsn.explorer.executors.DatabaseExecutionContext import com.xsn.explorer.executors.DatabaseExecutionContext
import com.xsn.explorer.models.fields.BalanceField import com.xsn.explorer.models.fields.BalanceField
import com.xsn.explorer.models.{Address, Balance} import com.xsn.explorer.models.Address
import com.xsn.explorer.models.persisted.Balance
import javax.inject.Inject import javax.inject.Inject
import scala.concurrent.Future import scala.concurrent.Future

3
server/app/com/xsn/explorer/models/Balance.scala → server/app/com/xsn/explorer/models/persisted/Balance.scala

@ -1,5 +1,6 @@
package com.xsn.explorer.models package com.xsn.explorer.models.persisted
import com.xsn.explorer.models.Address
import play.api.libs.json._ import play.api.libs.json._
case class Balance( case class Balance(

4
server/app/com/xsn/explorer/services/AddressService.scala

@ -4,8 +4,8 @@ import com.alexitc.playsonify.core.FutureOr.Implicits.{FutureOps, OrOps}
import com.alexitc.playsonify.core.{ApplicationResult, FutureApplicationResult} import com.alexitc.playsonify.core.{ApplicationResult, FutureApplicationResult}
import com.xsn.explorer.data.async.{BalanceFutureDataHandler, TransactionFutureDataHandler} import com.xsn.explorer.data.async.{BalanceFutureDataHandler, TransactionFutureDataHandler}
import com.xsn.explorer.errors.AddressFormatError import com.xsn.explorer.errors.AddressFormatError
import com.xsn.explorer.models.persisted.Transaction import com.xsn.explorer.models.persisted.{Balance, Transaction}
import com.xsn.explorer.models.{Address, Balance} import com.xsn.explorer.models.Address
import javax.inject.Inject import javax.inject.Inject
import org.scalactic.{One, Or} import org.scalactic.{One, Or}

3
server/app/com/xsn/explorer/services/BalanceService.scala

@ -7,7 +7,8 @@ import com.alexitc.playsonify.models.pagination.{Limit, Offset, PaginatedQuery}
import com.alexitc.playsonify.validators.PaginatedQueryValidator import com.alexitc.playsonify.validators.PaginatedQueryValidator
import com.xsn.explorer.data.async.BalanceFutureDataHandler import com.xsn.explorer.data.async.BalanceFutureDataHandler
import com.xsn.explorer.errors.AddressFormatError import com.xsn.explorer.errors.AddressFormatError
import com.xsn.explorer.models.{Address, Balance, WrappedResult} import com.xsn.explorer.models.persisted.Balance
import com.xsn.explorer.models.{Address, WrappedResult}
import com.xsn.explorer.parsers.BalanceOrderingParser import com.xsn.explorer.parsers.BalanceOrderingParser
import javax.inject.Inject import javax.inject.Inject
import org.scalactic.{Good, One, Or} import org.scalactic.{Good, One, Or}

2
server/test/com/xsn/explorer/data/BalancePostgresDataHandlerSpec.scala

@ -7,8 +7,8 @@ import com.xsn.explorer.data.anorm.BalancePostgresDataHandler
import com.xsn.explorer.data.anorm.dao.BalancePostgresDAO import com.xsn.explorer.data.anorm.dao.BalancePostgresDAO
import com.xsn.explorer.data.common.PostgresDataHandlerSpec import com.xsn.explorer.data.common.PostgresDataHandlerSpec
import com.xsn.explorer.helpers.DataHelper import com.xsn.explorer.helpers.DataHelper
import com.xsn.explorer.models.Balance
import com.xsn.explorer.models.fields.BalanceField import com.xsn.explorer.models.fields.BalanceField
import com.xsn.explorer.models.persisted.Balance
import org.scalactic.Good import org.scalactic.Good
class BalancePostgresDataHandlerSpec extends PostgresDataHandlerSpec { class BalancePostgresDataHandlerSpec extends PostgresDataHandlerSpec {

3
server/test/com/xsn/explorer/data/StatisticsPostgresDataHandlerSpec.scala

@ -5,7 +5,8 @@ import com.xsn.explorer.data.anorm.dao.{BalancePostgresDAO, StatisticsPostgresDA
import com.xsn.explorer.data.anorm.{BalancePostgresDataHandler, StatisticsPostgresDataHandler} import com.xsn.explorer.data.anorm.{BalancePostgresDataHandler, StatisticsPostgresDataHandler}
import com.xsn.explorer.data.common.PostgresDataHandlerSpec import com.xsn.explorer.data.common.PostgresDataHandlerSpec
import com.xsn.explorer.helpers.DataHelper import com.xsn.explorer.helpers.DataHelper
import com.xsn.explorer.models.{Address, Balance} import com.xsn.explorer.models.Address
import com.xsn.explorer.models.persisted.Balance
import org.scalatest.OptionValues._ import org.scalatest.OptionValues._
class StatisticsPostgresDataHandlerSpec extends PostgresDataHandlerSpec { class StatisticsPostgresDataHandlerSpec extends PostgresDataHandlerSpec {

3
server/test/com/xsn/explorer/helpers/BalanceDummyDataHandler.scala

@ -6,7 +6,8 @@ import com.alexitc.playsonify.models.pagination
import com.alexitc.playsonify.models.pagination.{PaginatedQuery, PaginatedResult} import com.alexitc.playsonify.models.pagination.{PaginatedQuery, PaginatedResult}
import com.xsn.explorer.data.BalanceBlockingDataHandler import com.xsn.explorer.data.BalanceBlockingDataHandler
import com.xsn.explorer.models.fields.BalanceField import com.xsn.explorer.models.fields.BalanceField
import com.xsn.explorer.models.{Address, Balance} import com.xsn.explorer.models.Address
import com.xsn.explorer.models.persisted.Balance
class BalanceDummyDataHandler extends BalanceBlockingDataHandler { class BalanceDummyDataHandler extends BalanceBlockingDataHandler {

2
server/test/controllers/AddressesControllerSpec.scala

@ -8,7 +8,7 @@ import com.xsn.explorer.data.{BalanceBlockingDataHandler, TransactionBlockingDat
import com.xsn.explorer.helpers.{BalanceDummyDataHandler, DataHelper, TransactionDummyDataHandler} import com.xsn.explorer.helpers.{BalanceDummyDataHandler, DataHelper, TransactionDummyDataHandler}
import com.xsn.explorer.models._ import com.xsn.explorer.models._
import com.xsn.explorer.models.fields.TransactionField import com.xsn.explorer.models.fields.TransactionField
import com.xsn.explorer.models.persisted.Transaction import com.xsn.explorer.models.persisted.{Balance, Transaction}
import com.xsn.explorer.util.Extensions.BigDecimalExt import com.xsn.explorer.util.Extensions.BigDecimalExt
import controllers.common.MyAPISpec import controllers.common.MyAPISpec
import org.scalactic.Good import org.scalactic.Good

2
server/test/controllers/BalancesControllerSpec.scala

@ -5,8 +5,8 @@ import com.alexitc.playsonify.models.ordering.FieldOrdering
import com.alexitc.playsonify.models.pagination._ import com.alexitc.playsonify.models.pagination._
import com.xsn.explorer.data.BalanceBlockingDataHandler import com.xsn.explorer.data.BalanceBlockingDataHandler
import com.xsn.explorer.helpers.{BalanceDummyDataHandler, DataHelper} import com.xsn.explorer.helpers.{BalanceDummyDataHandler, DataHelper}
import com.xsn.explorer.models.Balance
import com.xsn.explorer.models.fields.BalanceField import com.xsn.explorer.models.fields.BalanceField
import com.xsn.explorer.models.persisted.Balance
import controllers.common.MyAPISpec import controllers.common.MyAPISpec
import org.scalactic.Good import org.scalactic.Good
import play.api.inject.bind import play.api.inject.bind

Loading…
Cancel
Save