Skip to content

Commit

Permalink
server: Update playsonify to 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexITC committed Dec 15, 2018
1 parent e20d12c commit f4738ba
Show file tree
Hide file tree
Showing 60 changed files with 231 additions and 214 deletions.
3 changes: 2 additions & 1 deletion server/app/com/xsn/explorer/data/BalanceDataHandler.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package com.xsn.explorer.data

import com.alexitc.playsonify.core.ApplicationResult
import com.alexitc.playsonify.models.{FieldOrdering, PaginatedQuery, PaginatedResult}
import com.alexitc.playsonify.models.ordering.FieldOrdering
import com.alexitc.playsonify.models.pagination.{PaginatedQuery, PaginatedResult}
import com.xsn.explorer.models.fields.BalanceField
import com.xsn.explorer.models.{Address, Balance}

Expand Down
3 changes: 2 additions & 1 deletion server/app/com/xsn/explorer/data/BlockDataHandler.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package com.xsn.explorer.data

import com.alexitc.playsonify.core.ApplicationResult
import com.alexitc.playsonify.models.{FieldOrdering, PaginatedQuery, PaginatedResult}
import com.alexitc.playsonify.models.ordering.FieldOrdering
import com.alexitc.playsonify.models.pagination.{PaginatedQuery, PaginatedResult}
import com.xsn.explorer.models.fields.BlockField
import com.xsn.explorer.models.rpc.Block
import com.xsn.explorer.models.{Blockhash, Height}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package com.xsn.explorer.data

import com.alexitc.playsonify.core.ApplicationResult
import com.alexitc.playsonify.models.{FieldOrdering, PaginatedQuery, PaginatedResult}
import com.alexitc.playsonify.models.ordering.FieldOrdering
import com.alexitc.playsonify.models.pagination.{PaginatedQuery, PaginatedResult}
import com.xsn.explorer.models._
import com.xsn.explorer.models.fields.TransactionField
import org.scalactic.Every
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.xsn.explorer.data.anorm

import javax.inject.Inject

import com.alexitc.playsonify.core.ApplicationResult
import com.alexitc.playsonify.models.{FieldOrdering, PaginatedQuery, PaginatedResult}
import com.alexitc.playsonify.models.ordering.FieldOrdering
import com.alexitc.playsonify.models.pagination.{PaginatedQuery, PaginatedResult}
import com.xsn.explorer.data.BalanceBlockingDataHandler
import com.xsn.explorer.data.anorm.dao.BalancePostgresDAO
import com.xsn.explorer.errors.BalanceUnknownError
import com.xsn.explorer.models.fields.BalanceField
import com.xsn.explorer.models.{Address, Balance}
import javax.inject.Inject
import org.scalactic.{Good, One, Or}
import play.api.db.Database

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package com.xsn.explorer.data.anorm

import javax.inject.Inject

import com.alexitc.playsonify.core.ApplicationResult
import com.alexitc.playsonify.models.{FieldOrdering, PaginatedQuery, PaginatedResult}
import com.alexitc.playsonify.models.ordering.FieldOrdering
import com.alexitc.playsonify.models.pagination.{PaginatedQuery, PaginatedResult}
import com.xsn.explorer.data.BlockBlockingDataHandler
import com.xsn.explorer.data.anorm.dao.BlockPostgresDAO
import com.xsn.explorer.errors._
import com.xsn.explorer.models.fields.BlockField
import com.xsn.explorer.models.rpc.Block
import com.xsn.explorer.models.{Blockhash, Height}
import javax.inject.Inject
import org.scalactic.{Good, One, Or}
import play.api.db.Database

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package com.xsn.explorer.data.anorm

import javax.inject.Inject
import com.alexitc.playsonify.core.ApplicationResult
import com.alexitc.playsonify.models.{FieldOrdering, PaginatedQuery, PaginatedResult}
import com.alexitc.playsonify.models.ordering.FieldOrdering
import com.alexitc.playsonify.models.pagination.{PaginatedQuery, PaginatedResult}
import com.xsn.explorer.data.TransactionBlockingDataHandler
import com.xsn.explorer.data.anorm.dao.TransactionPostgresDAO
import com.xsn.explorer.models._
import com.xsn.explorer.models.fields.TransactionField
import javax.inject.Inject
import org.scalactic.{Every, Good}
import play.api.db.Database

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package com.xsn.explorer.data.anorm.dao

import java.sql.Connection
import javax.inject.Inject

import anorm._
import com.alexitc.playsonify.models.{Count, FieldOrdering, PaginatedQuery}
import com.xsn.explorer.data.anorm.interpreters.FieldOrderingSQLInterpreter
import com.alexitc.playsonify.models.ordering.FieldOrdering
import com.alexitc.playsonify.models.pagination.{Count, PaginatedQuery}
import com.alexitc.playsonify.sql.FieldOrderingSQLInterpreter
import com.xsn.explorer.data.anorm.parsers.BalanceParsers._
import com.xsn.explorer.models.fields.BalanceField
import com.xsn.explorer.models.{Address, Balance}
import javax.inject.Inject
import org.slf4j.LoggerFactory

class BalancePostgresDAO @Inject() (fieldOrderingSQLInterpreter: FieldOrderingSQLInterpreter) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package com.xsn.explorer.data.anorm.dao

import java.sql.Connection
import javax.inject.Inject

import anorm._
import com.alexitc.playsonify.models._
import com.xsn.explorer.data.anorm.interpreters.FieldOrderingSQLInterpreter
import com.alexitc.playsonify.models.ordering.{FieldOrdering, OrderingCondition}
import com.alexitc.playsonify.models.pagination.{Count, Limit, Offset, PaginatedQuery}
import com.alexitc.playsonify.sql.FieldOrderingSQLInterpreter
import com.xsn.explorer.data.anorm.parsers.BlockParsers._
import com.xsn.explorer.models.fields.BlockField
import com.xsn.explorer.models.rpc.Block
import com.xsn.explorer.models.{Blockhash, Height}
import javax.inject.Inject

class BlockPostgresDAO @Inject() (fieldOrderingSQLInterpreter: FieldOrderingSQLInterpreter) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package com.xsn.explorer.data.anorm.dao

import java.sql.Connection

import javax.inject.Inject
import anorm._
import com.alexitc.playsonify.models.{Count, FieldOrdering, PaginatedQuery}
import com.xsn.explorer.data.anorm.interpreters.FieldOrderingSQLInterpreter
import com.alexitc.playsonify.models.ordering.FieldOrdering
import com.alexitc.playsonify.models.pagination.{Count, PaginatedQuery}
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 javax.inject.Inject
import org.scalactic.Every

class TransactionPostgresDAO @Inject() (fieldOrderingSQLInterpreter: FieldOrderingSQLInterpreter) {
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.xsn.explorer.data.async

import javax.inject.Inject

import com.alexitc.playsonify.core.{FutureApplicationResult, FuturePaginatedResult}
import com.alexitc.playsonify.models.{FieldOrdering, PaginatedQuery}
import com.alexitc.playsonify.models.ordering.FieldOrdering
import com.alexitc.playsonify.models.pagination.PaginatedQuery
import com.xsn.explorer.data.{BalanceBlockingDataHandler, BalanceDataHandler}
import com.xsn.explorer.executors.DatabaseExecutionContext
import com.xsn.explorer.models.fields.BalanceField
import com.xsn.explorer.models.{Address, Balance}
import javax.inject.Inject

import scala.concurrent.Future

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.xsn.explorer.data.async

import javax.inject.Inject

import com.alexitc.playsonify.core.FutureApplicationResult
import com.alexitc.playsonify.models.{FieldOrdering, PaginatedQuery, PaginatedResult}
import com.alexitc.playsonify.core.{FutureApplicationResult, FuturePaginatedResult}
import com.alexitc.playsonify.models.ordering.FieldOrdering
import com.alexitc.playsonify.models.pagination.PaginatedQuery
import com.xsn.explorer.data.{BlockBlockingDataHandler, BlockDataHandler}
import com.xsn.explorer.executors.DatabaseExecutionContext
import com.xsn.explorer.models.fields.BlockField
import com.xsn.explorer.models.rpc.Block
import com.xsn.explorer.models.{Blockhash, Height}
import javax.inject.Inject

import scala.concurrent.Future

Expand All @@ -25,7 +25,7 @@ class BlockFutureDataHandler @Inject() (
blockBlockingDataHandler.getBy(height)
}

override def getBy(paginatedQuery: PaginatedQuery, ordering: FieldOrdering[BlockField]): FutureApplicationResult[PaginatedResult[Block]] = Future {
override def getBy(paginatedQuery: PaginatedQuery, ordering: FieldOrdering[BlockField]): FuturePaginatedResult[Block] = Future {
blockBlockingDataHandler.getBy(paginatedQuery, ordering)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package com.xsn.explorer.data.async

import javax.inject.Inject
import com.alexitc.playsonify.core.{FutureApplicationResult, FuturePaginatedResult}
import com.alexitc.playsonify.models.{FieldOrdering, PaginatedQuery, PaginatedResult}
import com.alexitc.playsonify.models.ordering.FieldOrdering
import com.alexitc.playsonify.models.pagination.PaginatedQuery
import com.xsn.explorer.data.{TransactionBlockingDataHandler, TransactionDataHandler}
import com.xsn.explorer.executors.DatabaseExecutionContext
import com.xsn.explorer.models._
import com.xsn.explorer.models.fields.TransactionField
import javax.inject.Inject
import org.scalactic.Every

import scala.concurrent.Future
Expand All @@ -31,7 +32,7 @@ class TransactionFutureDataHandler @Inject() (
override def getByBlockhash(
blockhash: Blockhash,
paginatedQuery: PaginatedQuery,
ordering: FieldOrdering[TransactionField]): FutureApplicationResult[PaginatedResult[TransactionWithValues]] = Future {
ordering: FieldOrdering[TransactionField]): FuturePaginatedResult[TransactionWithValues] = Future {

blockingDataHandler.getByBlockhash(blockhash, paginatedQuery, ordering)
}
Expand Down
6 changes: 3 additions & 3 deletions server/app/com/xsn/explorer/errors/addressErrors.scala
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.xsn.explorer.errors

import com.alexitc.playsonify.core.I18nService
import com.alexitc.playsonify.models.{FieldValidationError, InputValidationError, PublicError}
import play.api.i18n.{Lang, MessagesApi}

sealed trait AddressError

case object AddressFormatError extends AddressError with InputValidationError {

override def toPublicErrorList(messagesApi: MessagesApi)(implicit lang: Lang): List[PublicError] = {
val message = messagesApi("error.address.format")
override def toPublicErrorList[L](i18nService: I18nService[L])(implicit lang: L): List[PublicError] = {
val message = i18nService.render("error.address.format")
val error = FieldValidationError("address", message)
List(error)
}
Expand Down
8 changes: 5 additions & 3 deletions server/app/com/xsn/explorer/errors/balanceErrors.scala
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package com.xsn.explorer.errors

import com.alexitc.playsonify.models.{PublicError, ServerError}
import play.api.i18n.{Lang, MessagesApi}
import com.alexitc.playsonify.core.I18nService
import com.alexitc.playsonify.models.{ErrorId, PublicError, ServerError}

sealed trait BalanceError

case object BalanceUnknownError extends BalanceError with ServerError {

val id = ErrorId.create

override def cause: Option[Throwable] = None

override def toPublicErrorList(messagesApi: MessagesApi)(implicit lang: Lang): List[PublicError] = List.empty
override def toPublicErrorList[L](i18nService: I18nService[L])(implicit lang: L): List[PublicError] = List.empty
}
15 changes: 8 additions & 7 deletions server/app/com/xsn/explorer/errors/blockErrors.scala
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
package com.xsn.explorer.errors

import com.alexitc.playsonify.models.{FieldValidationError, InputValidationError, PublicError, ServerError}
import play.api.i18n.{Lang, MessagesApi}
import com.alexitc.playsonify.core.I18nService
import com.alexitc.playsonify.models._

sealed trait BlockError

case object BlockhashFormatError extends BlockError with InputValidationError {

override def toPublicErrorList(messagesApi: MessagesApi)(implicit lang: Lang): List[PublicError] = {
val message = messagesApi("error.block.format")
override def toPublicErrorList[L](i18nService: I18nService[L])(implicit lang: L): List[PublicError] = {
val message = i18nService.render("error.block.format")
val error = FieldValidationError("blockhash", message)
List(error)
}
}

case object BlockNotFoundError extends BlockError with InputValidationError {

override def toPublicErrorList(messagesApi: MessagesApi)(implicit lang: Lang): List[PublicError] = {
val message = messagesApi("error.block.notFound")
override def toPublicErrorList[L](i18nService: I18nService[L])(implicit lang: L): List[PublicError] = {
val message = i18nService.render("error.block.notFound")
val error = FieldValidationError("blockhash", message)
List(error)
}
}

case object BlockUnknownError extends BlockError with ServerError {
val id = ErrorId.create
override def cause: Option[Throwable] = None
override def toPublicErrorList(messagesApi: MessagesApi)(implicit lang: Lang): List[PublicError] = List.empty
override def toPublicErrorList[L](i18nService: I18nService[L])(implicit lang: L): List[PublicError] = List.empty
}
6 changes: 3 additions & 3 deletions server/app/com/xsn/explorer/errors/ipAddressErrors.scala
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.xsn.explorer.errors

import com.alexitc.playsonify.core.I18nService
import com.alexitc.playsonify.models.{FieldValidationError, InputValidationError, PublicError}
import play.api.i18n.{Lang, MessagesApi}

trait IPAddressError

case object IPAddressFormatError extends IPAddressError with InputValidationError {

override def toPublicErrorList(messagesApi: MessagesApi)(implicit lang: Lang): List[PublicError] = {
val message = messagesApi("error.ipAddress.invalid")
override def toPublicErrorList[L](i18nService: I18nService[L])(implicit lang: L): List[PublicError] = {
val message = i18nService.render("error.ipAddress.invalid")
val error = FieldValidationError("ip", message)
List(error)
}
Expand Down
4 changes: 2 additions & 2 deletions server/app/com/xsn/explorer/errors/ledgerErrors.scala
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.xsn.explorer.errors

import com.alexitc.playsonify.core.I18nService
import com.alexitc.playsonify.models.{ApplicationError, PublicError}
import play.api.i18n.{Lang, MessagesApi}

trait LedgerError extends ApplicationError {

override def toPublicErrorList(messagesApi: MessagesApi)(implicit lang: Lang): List[PublicError] = List.empty
override def toPublicErrorList[L](i18nService: I18nService[L])(implicit lang: L): List[PublicError] = List.empty
}

case object PreviousBlockMissingError extends LedgerError
Expand Down
6 changes: 3 additions & 3 deletions server/app/com/xsn/explorer/errors/masternodeErrors.scala
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.xsn.explorer.errors

import com.alexitc.playsonify.core.I18nService
import com.alexitc.playsonify.models.{FieldValidationError, NotFoundError, PublicError}
import play.api.i18n.{Lang, MessagesApi}

trait MasternodeError

case object MasternodeNotFoundError extends MasternodeError with NotFoundError {

override def toPublicErrorList(messagesApi: MessagesApi)(implicit lang: Lang): List[PublicError] = {
val message = messagesApi("error.masternode.notFound")
override def toPublicErrorList[L](i18nService: I18nService[L])(implicit lang: L): List[PublicError] = {
val message = i18nService.render("error.masternode.notFound")
val error = FieldValidationError("ip", message)
List(error)
}
Expand Down
Loading

0 comments on commit f4738ba

Please sign in to comment.