mirror of
https://github.com/arcan1s/ffxivbis.git
synced 2025-04-25 01:37:17 +00:00
some fixes
This commit is contained in:
parent
65b9e53b66
commit
9faceb4f61
@ -61,4 +61,13 @@ me.arcanis.ffxivbis {
|
|||||||
max-count = 60
|
max-count = 60
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default-dispatcher {
|
||||||
|
type = Dispatcher
|
||||||
|
executor = "thread-pool-executor"
|
||||||
|
thread-pool-executor {
|
||||||
|
fixed-pool-size = 16
|
||||||
|
}
|
||||||
|
throughput = 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ REST json API description to interact with FFXIVBiS service.
|
|||||||
# Basic workflow
|
# Basic workflow
|
||||||
|
|
||||||
* Create party using `PUT /api/v1/party` endpoint. It consumes username and password of administrator (which can't be restored). As the result it returns unique id of created party.
|
* Create party using `PUT /api/v1/party` endpoint. It consumes username and password of administrator (which can't be restored). As the result it returns unique id of created party.
|
||||||
* Create new users which have access to this party. Note that user is belong to specific party id and in scope of the specified party it must be unique.
|
* Create new users which have access to this party. Note that user belongs to specific party id and in scope of the specified party it must be unique.
|
||||||
* Add players with their best in slot sets (probably by using ariyala links).
|
* Add players with their best in slot sets (probably by using ariyala links).
|
||||||
* Add loot items if any.
|
* Add loot items if any.
|
||||||
* By using `PUT /api/v1/party/{partyId}/loot` API find players which are better for the specified loot.
|
* By using `PUT /api/v1/party/{partyId}/loot` API find players which are better for the specified loot.
|
||||||
|
@ -40,7 +40,7 @@ class TypesEndpoint(config: Config) extends JsonSupport {
|
|||||||
def getJobs: Route =
|
def getJobs: Route =
|
||||||
path("types" / "jobs") {
|
path("types" / "jobs") {
|
||||||
get {
|
get {
|
||||||
complete(Job.available.map(_.toString))
|
complete(Job.availableWithAnyJob.map(_.toString))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ import akka.http.scaladsl.server.Directives._
|
|||||||
import akka.http.scaladsl.server.Route
|
import akka.http.scaladsl.server.Route
|
||||||
import akka.util.Timeout
|
import akka.util.Timeout
|
||||||
import me.arcanis.ffxivbis.http.{Authorization, LootHelper}
|
import me.arcanis.ffxivbis.http.{Authorization, LootHelper}
|
||||||
import me.arcanis.ffxivbis.models.{Piece, PlayerIdWithCounters}
|
import me.arcanis.ffxivbis.models.{Job, Piece, PlayerIdWithCounters}
|
||||||
|
|
||||||
import scala.concurrent.{ExecutionContext, Future}
|
import scala.concurrent.{ExecutionContext, Future}
|
||||||
import scala.util.{Failure, Success, Try}
|
import scala.util.{Failure, Success, Try}
|
||||||
@ -43,9 +43,9 @@ class LootSuggestView(override val storage: ActorRef)(implicit timeout: Timeout)
|
|||||||
extractExecutionContext { implicit executionContext =>
|
extractExecutionContext { implicit executionContext =>
|
||||||
authenticateBasicBCrypt(s"party $partyId", authGet(partyId)) { _ =>
|
authenticateBasicBCrypt(s"party $partyId", authGet(partyId)) { _ =>
|
||||||
post {
|
post {
|
||||||
formFields("piece".as[String], "is_tome".as[String].?) { (piece, maybeTome) =>
|
formFields("piece".as[String], "job".as[String], "is_tome".as[String].?) { (piece, job, maybeTome) =>
|
||||||
import me.arcanis.ffxivbis.utils.Implicits._
|
import me.arcanis.ffxivbis.utils.Implicits._
|
||||||
val maybePiece = Try(Piece(piece, maybeTome)).toOption
|
val maybePiece = Try(Piece(piece, maybeTome, Job.withName(job))).toOption
|
||||||
|
|
||||||
onComplete(suggestLootCall(partyId, maybePiece)) {
|
onComplete(suggestLootCall(partyId, maybePiece)) {
|
||||||
case Success(players) =>
|
case Success(players) =>
|
||||||
@ -90,6 +90,8 @@ object LootSuggestView {
|
|||||||
form(action:=s"/party/$partyId/suggest", method:="post")(
|
form(action:=s"/party/$partyId/suggest", method:="post")(
|
||||||
select(name:="piece", id:="piece", title:="piece")
|
select(name:="piece", id:="piece", title:="piece")
|
||||||
(for (piece <- Piece.available) yield option(piece)),
|
(for (piece <- Piece.available) yield option(piece)),
|
||||||
|
select(name:="job", id:="job", title:="job")
|
||||||
|
(for (job <- Job.availableWithAnyJob) yield option(job.toString)),
|
||||||
input(name:="is_tome", id:="is_tome", title:="is tome", `type`:="checkbox"),
|
input(name:="is_tome", id:="is_tome", title:="is tome", `type`:="checkbox"),
|
||||||
label(`for`:="is_tome")("is tome gear"),
|
label(`for`:="is_tome")("is tome gear"),
|
||||||
input(name:="suggest", id:="suggest", `type`:="submit", value:="suggest")
|
input(name:="suggest", id:="suggest", `type`:="submit", value:="suggest")
|
||||||
|
@ -113,7 +113,7 @@ object LootView {
|
|||||||
th("is tome"),
|
th("is tome"),
|
||||||
th("")
|
th("")
|
||||||
),
|
),
|
||||||
for (player <- party; piece <- player.bis.pieces) yield tr(
|
for (player <- party; piece <- player.loot) yield tr(
|
||||||
td(`class`:="include_search")(player.playerId.toString),
|
td(`class`:="include_search")(player.playerId.toString),
|
||||||
td(`class`:="include_search")(piece.piece),
|
td(`class`:="include_search")(piece.piece),
|
||||||
td(piece.isTomeToString),
|
td(piece.isTomeToString),
|
||||||
|
@ -98,6 +98,7 @@ object Job {
|
|||||||
|
|
||||||
lazy val available: Seq[Job] =
|
lazy val available: Seq[Job] =
|
||||||
Seq(PLD, WAR, DRK, GNB, WHM, SCH, AST, MNK, DRG, NIN, SAM, BRD, MCH, DNC, BLM, SMN, RDM)
|
Seq(PLD, WAR, DRK, GNB, WHM, SCH, AST, MNK, DRG, NIN, SAM, BRD, MCH, DNC, BLM, SMN, RDM)
|
||||||
|
lazy val availableWithAnyJob: Seq[Job] = available.prepended(AnyJob)
|
||||||
|
|
||||||
def withName(job: String): Job.Job = available.find(_.toString == job.toUpperCase).getOrElse(AnyJob)
|
def withName(job: String): Job.Job = available.find(_.toString == job.toUpperCase).getOrElse(AnyJob)
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,8 @@ class Ariyala extends Actor with StrictLogging {
|
|||||||
|
|
||||||
private val http = Http()(context.system)
|
private val http = Http()(context.system)
|
||||||
implicit private val materializer: ActorMaterializer = ActorMaterializer()
|
implicit private val materializer: ActorMaterializer = ActorMaterializer()
|
||||||
implicit private val executionContext: ExecutionContext = context.dispatcher
|
implicit private val executionContext: ExecutionContext =
|
||||||
|
context.system.dispatchers.lookup("me.arcanis.ffxivbis.default-dispatcher")
|
||||||
|
|
||||||
override def receive: Receive = {
|
override def receive: Receive = {
|
||||||
case GetBiS(link, job) =>
|
case GetBiS(link, job) =>
|
||||||
@ -42,6 +43,11 @@ class Ariyala extends Actor with StrictLogging {
|
|||||||
get(link, job).map(BiS(_)).pipeTo(client)
|
get(link, job).map(BiS(_)).pipeTo(client)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override def postStop(): Unit = {
|
||||||
|
http.shutdownAllConnectionPools()
|
||||||
|
super.postStop()
|
||||||
|
}
|
||||||
|
|
||||||
private def get(link: String, job: Job.Job): Future[Seq[Piece]] = {
|
private def get(link: String, job: Job.Job): Future[Seq[Piece]] = {
|
||||||
val id = Paths.get(link).normalize.getFileName.toString
|
val id = Paths.get(link).normalize.getFileName.toString
|
||||||
val uri = Uri(ariyalaUrl)
|
val uri = Uri(ariyalaUrl)
|
||||||
|
@ -23,7 +23,8 @@ class PartyService(storage: ActorRef) extends Actor with StrictLogging {
|
|||||||
|
|
||||||
private val cacheTimeout: FiniteDuration =
|
private val cacheTimeout: FiniteDuration =
|
||||||
context.system.settings.config.getDuration("me.arcanis.ffxivbis.settings.cache-timeout")
|
context.system.settings.config.getDuration("me.arcanis.ffxivbis.settings.cache-timeout")
|
||||||
implicit private val executionContext: ExecutionContext = context.dispatcher
|
implicit private val executionContext: ExecutionContext =
|
||||||
|
context.system.dispatchers.lookup("me.arcanis.ffxivbis.default-dispatcher")
|
||||||
implicit private val timeout: Timeout =
|
implicit private val timeout: Timeout =
|
||||||
context.system.settings.config.getDuration("me.arcanis.ffxivbis.settings.request-timeout")
|
context.system.settings.config.getDuration("me.arcanis.ffxivbis.settings.request-timeout")
|
||||||
|
|
||||||
|
@ -18,7 +18,8 @@ class DatabaseImpl extends Database
|
|||||||
with DatabaseBiSHandler with DatabaseLootHandler
|
with DatabaseBiSHandler with DatabaseLootHandler
|
||||||
with DatabasePartyHandler with DatabaseUserHandler {
|
with DatabasePartyHandler with DatabaseUserHandler {
|
||||||
|
|
||||||
implicit val executionContext: ExecutionContext = context.dispatcher
|
implicit val executionContext: ExecutionContext =
|
||||||
|
context.system.dispatchers.lookup("me.arcanis.ffxivbis.default-dispatcher")
|
||||||
val profile = new DatabaseProfile(executionContext, context.system.settings.config)
|
val profile = new DatabaseProfile(executionContext, context.system.settings.config)
|
||||||
|
|
||||||
override def receive: Receive =
|
override def receive: Receive =
|
||||||
|
@ -23,7 +23,7 @@ class TypesEndpointTest extends WordSpec
|
|||||||
"return all available jobs" in {
|
"return all available jobs" in {
|
||||||
Get("/types/jobs") ~> route ~> check {
|
Get("/types/jobs") ~> route ~> check {
|
||||||
status shouldEqual StatusCodes.OK
|
status shouldEqual StatusCodes.OK
|
||||||
responseAs[Seq[String]] shouldEqual Job.available.map(_.toString)
|
responseAs[Seq[String]] shouldEqual Job.availableWithAnyJob.map(_.toString)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user