Browse Source

server: Move the Transaction model to the persisted package

master
Alexis Hernandez 6 years ago
parent
commit
b7f91b7ce4
  1. 3
      server/app/com/xsn/explorer/data/LedgerDataHandler.scala
  2. 1
      server/app/com/xsn/explorer/data/TransactionDataHandler.scala
  3. 4
      server/app/com/xsn/explorer/data/anorm/LedgerPostgresDataHandler.scala
  4. 1
      server/app/com/xsn/explorer/data/anorm/TransactionPostgresDataHandler.scala
  5. 3
      server/app/com/xsn/explorer/data/anorm/dao/AddressTransactionDetailsPostgresDAO.scala
  6. 3
      server/app/com/xsn/explorer/data/anorm/dao/TransactionInputPostgresDAO.scala
  7. 3
      server/app/com/xsn/explorer/data/anorm/dao/TransactionOutputPostgresDAO.scala
  8. 1
      server/app/com/xsn/explorer/data/anorm/dao/TransactionPostgresDAO.scala
  9. 1
      server/app/com/xsn/explorer/data/anorm/parsers/TransactionParsers.scala
  10. 4
      server/app/com/xsn/explorer/data/async/LedgerFutureDataHandler.scala
  11. 1
      server/app/com/xsn/explorer/data/async/TransactionFutureDataHandler.scala
  12. 4
      server/app/com/xsn/explorer/models/persisted/Transaction.scala
  13. 6
      server/app/com/xsn/explorer/services/AddressService.scala
  14. 4
      server/app/com/xsn/explorer/services/LedgerSynchronizerService.scala
  15. 3
      server/app/com/xsn/explorer/services/TransactionRPCService.scala
  16. 2
      server/app/controllers/AddressesController.scala
  17. 1
      server/test/com/xsn/explorer/data/TransactionPostgresDataHandlerSpec.scala
  18. 3
      server/test/com/xsn/explorer/helpers/DataGenerator.scala
  19. 1
      server/test/com/xsn/explorer/helpers/LedgerHelper.scala
  20. 1
      server/test/com/xsn/explorer/helpers/TransactionDummyDataHandler.scala
  21. 1
      server/test/controllers/AddressesControllerSpec.scala

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

@ -1,8 +1,7 @@
package com.xsn.explorer.data
import com.alexitc.playsonify.core.ApplicationResult
import com.xsn.explorer.models.Transaction
import com.xsn.explorer.models.persisted.Block
import com.xsn.explorer.models.persisted.{Block, Transaction}
import scala.language.higherKinds

1
server/app/com/xsn/explorer/data/TransactionDataHandler.scala

@ -5,6 +5,7 @@ import com.alexitc.playsonify.models.ordering.{FieldOrdering, OrderingCondition}
import com.alexitc.playsonify.models.pagination.{Limit, PaginatedQuery, PaginatedResult}
import com.xsn.explorer.models._
import com.xsn.explorer.models.fields.TransactionField
import com.xsn.explorer.models.persisted.Transaction
import scala.language.higherKinds

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.anorm.dao.{AggregatedAmountPostgresDAO, BalancePostgresDAO, BlockPostgresDAO, TransactionPostgresDAO}
import com.xsn.explorer.errors.{PostgresForeignKeyViolationError, PreviousBlockMissingError, RepeatedBlockHeightError}
import com.xsn.explorer.models.persisted.Block
import com.xsn.explorer.models.{Address, Balance, Transaction}
import com.xsn.explorer.models.persisted.{Block, Transaction}
import com.xsn.explorer.models.{Address, Balance}
import com.xsn.explorer.util.Extensions.ListOptionExt
import javax.inject.Inject
import org.scalactic.Good

1
server/app/com/xsn/explorer/data/anorm/TransactionPostgresDataHandler.scala

@ -7,6 +7,7 @@ import com.xsn.explorer.data.TransactionBlockingDataHandler
import com.xsn.explorer.data.anorm.dao.{TransactionOutputPostgresDAO, TransactionPostgresDAO}
import com.xsn.explorer.models._
import com.xsn.explorer.models.fields.TransactionField
import com.xsn.explorer.models.persisted.Transaction
import javax.inject.Inject
import org.scalactic.Good
import play.api.db.Database

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

@ -4,7 +4,8 @@ import java.sql.Connection
import anorm._
import com.xsn.explorer.data.anorm.parsers.TransactionParsers._
import com.xsn.explorer.models.{AddressTransactionDetails, Transaction, TransactionId}
import com.xsn.explorer.models.persisted.Transaction
import com.xsn.explorer.models.{AddressTransactionDetails, TransactionId}
class AddressTransactionDetailsPostgresDAO {

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

@ -4,7 +4,8 @@ import java.sql.Connection
import anorm._
import com.xsn.explorer.data.anorm.parsers.TransactionParsers._
import com.xsn.explorer.models.{Address, Transaction, TransactionId}
import com.xsn.explorer.models._
import com.xsn.explorer.models.persisted.Transaction
import org.slf4j.LoggerFactory
class TransactionInputPostgresDAO {

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

@ -4,7 +4,8 @@ import java.sql.Connection
import anorm._
import com.xsn.explorer.data.anorm.parsers.TransactionParsers._
import com.xsn.explorer.models.{Address, Transaction, TransactionId}
import com.xsn.explorer.models._
import com.xsn.explorer.models.persisted.Transaction
import org.slf4j.LoggerFactory
class TransactionOutputPostgresDAO {

1
server/app/com/xsn/explorer/data/anorm/dao/TransactionPostgresDAO.scala

@ -9,6 +9,7 @@ import com.alexitc.playsonify.sql.FieldOrderingSQLInterpreter
import com.xsn.explorer.data.anorm.parsers.TransactionParsers._
import com.xsn.explorer.models._
import com.xsn.explorer.models.fields.TransactionField
import com.xsn.explorer.models.persisted.Transaction
import javax.inject.Inject
import org.slf4j.LoggerFactory

1
server/app/com/xsn/explorer/data/anorm/parsers/TransactionParsers.scala

@ -3,6 +3,7 @@ package com.xsn.explorer.data.anorm.parsers
import anorm.SqlParser.{get, str}
import anorm.~
import com.xsn.explorer.models._
import com.xsn.explorer.models.persisted.Transaction
object TransactionParsers {

4
server/app/com/xsn/explorer/data/async/LedgerFutureDataHandler.scala

@ -1,12 +1,10 @@
package com.xsn.explorer.data.async
import javax.inject.Inject
import com.alexitc.playsonify.core.FutureApplicationResult
import com.xsn.explorer.data.{LedgerBlockingDataHandler, LedgerDataHandler}
import com.xsn.explorer.executors.DatabaseExecutionContext
import com.xsn.explorer.models.Transaction
import com.xsn.explorer.models.persisted.Block
import com.xsn.explorer.models.persisted.{Block, Transaction}
import scala.concurrent.Future

1
server/app/com/xsn/explorer/data/async/TransactionFutureDataHandler.scala

@ -7,6 +7,7 @@ import com.xsn.explorer.data.{TransactionBlockingDataHandler, TransactionDataHan
import com.xsn.explorer.executors.DatabaseExecutionContext
import com.xsn.explorer.models._
import com.xsn.explorer.models.fields.TransactionField
import com.xsn.explorer.models.persisted.Transaction
import javax.inject.Inject
import scala.concurrent.Future

4
server/app/com/xsn/explorer/models/Transaction.scala → server/app/com/xsn/explorer/models/persisted/Transaction.scala

@ -1,4 +1,6 @@
package com.xsn.explorer.models
package com.xsn.explorer.models.persisted
import com.xsn.explorer.models.{Address, Blockhash, HexString, Size, TransactionId, rpc}
case class Transaction(
id: TransactionId,

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

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

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

@ -4,9 +4,9 @@ import com.alexitc.playsonify.core.FutureApplicationResult
import com.alexitc.playsonify.core.FutureOr.Implicits.{FutureOps, OptionOps}
import com.xsn.explorer.data.async.{BlockFutureDataHandler, LedgerFutureDataHandler}
import com.xsn.explorer.errors.BlockNotFoundError
import com.xsn.explorer.models.persisted.Block
import com.xsn.explorer.models.persisted.{Block, Transaction}
import com.xsn.explorer.models.transformers._
import com.xsn.explorer.models.{Blockhash, Height, Transaction}
import com.xsn.explorer.models.{Blockhash, Height}
import com.xsn.explorer.util.Extensions.FutureOrExt
import javax.inject.Inject
import org.scalactic.Good

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

@ -3,8 +3,9 @@ package com.xsn.explorer.services
import com.alexitc.playsonify.core.FutureOr.Implicits.{FutureListOps, FutureOps, OrOps}
import com.alexitc.playsonify.core.{FutureApplicationResult, FutureOr}
import com.xsn.explorer.errors.{InvalidRawTransactionError, TransactionFormatError, TransactionNotFoundError, XSNWorkQueueDepthExceeded}
import com.xsn.explorer.models.persisted.Transaction
import com.xsn.explorer.models.rpc.TransactionVIN
import com.xsn.explorer.models.{HexString, Transaction, TransactionDetails, TransactionId, TransactionValue}
import com.xsn.explorer.models.{HexString, TransactionDetails, TransactionId, TransactionValue}
import com.xsn.explorer.util.Extensions.FutureOrExt
import javax.inject.Inject
import org.scalactic.{Bad, Good, One, Or}

2
server/app/controllers/AddressesController.scala

@ -2,7 +2,7 @@ package controllers
import com.alexitc.playsonify.models.ordering.OrderingQuery
import com.alexitc.playsonify.models.pagination.{Limit, Offset, PaginatedQuery}
import com.xsn.explorer.models.Transaction
import com.xsn.explorer.models.persisted.Transaction
import com.xsn.explorer.services.{AddressService, TransactionService}
import com.xsn.explorer.util.Extensions.BigDecimalExt
import controllers.common.{Codecs, MyJsonController, MyJsonControllerComponents}

1
server/test/com/xsn/explorer/data/TransactionPostgresDataHandlerSpec.scala

@ -10,6 +10,7 @@ import com.xsn.explorer.helpers.DataHelper._
import com.xsn.explorer.helpers.{DataGenerator, LedgerHelper, TransactionLoader}
import com.xsn.explorer.models._
import com.xsn.explorer.models.fields.TransactionField
import com.xsn.explorer.models.persisted.Transaction
import com.xsn.explorer.models.rpc.Block
import org.scalactic.{Good, One, Or}
import org.scalatest.BeforeAndAfter

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

@ -1,7 +1,8 @@
package com.xsn.explorer.helpers
import com.xsn.explorer.models.persisted.Transaction
import com.xsn.explorer.models.rpc.Block
import com.xsn.explorer.models.{Address, Blockhash, Confirmations, Height, HexString, Size, Transaction, TransactionId}
import com.xsn.explorer.models.{Address, Blockhash, Confirmations, Height, HexString, Size, TransactionId}
trait DataGenerator {

1
server/test/com/xsn/explorer/helpers/LedgerHelper.scala

@ -1,6 +1,7 @@
package com.xsn.explorer.helpers
import com.xsn.explorer.models._
import com.xsn.explorer.models.persisted.Transaction
object LedgerHelper {

1
server/test/com/xsn/explorer/helpers/TransactionDummyDataHandler.scala

@ -7,6 +7,7 @@ import com.alexitc.playsonify.models.pagination.{PaginatedQuery, PaginatedResult
import com.xsn.explorer.data.TransactionBlockingDataHandler
import com.xsn.explorer.models._
import com.xsn.explorer.models.fields.TransactionField
import com.xsn.explorer.models.persisted.Transaction
class TransactionDummyDataHandler extends TransactionBlockingDataHandler {

1
server/test/controllers/AddressesControllerSpec.scala

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

Loading…
Cancel
Save