mirror of
https://github.com/arcan1s/ffxivbis.git
synced 2025-04-24 17:27:17 +00:00
rename property
This commit is contained in:
parent
6e8b64feef
commit
557038c262
@ -132,7 +132,7 @@ class BiSEndpoint(override val storage: ActorRef, ariyala: ActorRef)(implicit ti
|
||||
authenticateBasicBCrypt(s"party $partyId", authPost(partyId)) { _ =>
|
||||
post {
|
||||
entity(as[PieceActionResponse]) { action =>
|
||||
val playerId = action.playerIdResponse.withPartyId(partyId)
|
||||
val playerId = action.playerId.withPartyId(partyId)
|
||||
onComplete(doModifyBiS(action.action, playerId, action.piece.toPiece)) {
|
||||
case Success(_) => complete(StatusCodes.Accepted, HttpEntity.Empty)
|
||||
case Failure(exception) => throw exception
|
||||
|
@ -95,7 +95,7 @@ class LootEndpoint(override val storage: ActorRef)(implicit timeout: Timeout)
|
||||
authenticateBasicBCrypt(s"party $partyId", authPost(partyId)) { _ =>
|
||||
post {
|
||||
entity(as[PieceActionResponse]) { action =>
|
||||
val playerId = action.playerIdResponse.withPartyId(partyId)
|
||||
val playerId = action.playerId.withPartyId(partyId)
|
||||
onComplete(doModifyLoot(action.action, playerId, action.piece.toPiece)) {
|
||||
case Success(_) => complete(StatusCodes.Accepted, HttpEntity.Empty)
|
||||
case Failure(exception) => throw exception
|
||||
|
@ -94,7 +94,7 @@ class PlayerEndpoint(override val storage: ActorRef, ariyala: ActorRef)(implicit
|
||||
extractExecutionContext { implicit executionContext =>
|
||||
authenticateBasicBCrypt(s"party $partyId", authPost(partyId)) { _ =>
|
||||
entity(as[PlayerActionResponse]) { action =>
|
||||
val player = action.playerIdResponse.toPlayer.copy(partyId = partyId)
|
||||
val player = action.playerId.toPlayer.copy(partyId = partyId)
|
||||
onComplete(doModifyPlayer(action.action, player)) {
|
||||
case Success(_) => complete(StatusCodes.Accepted, HttpEntity.Empty)
|
||||
case Failure(exception) => throw exception
|
||||
|
@ -13,4 +13,4 @@ import io.swagger.v3.oas.annotations.media.Schema
|
||||
case class PieceActionResponse(
|
||||
@Schema(description = "action to perform", required = true, `type` = "string", allowableValues = Array("add", "remove")) action: ApiAction.Value,
|
||||
@Schema(description = "piece description", required = true) piece: PieceResponse,
|
||||
@Schema(description = "player description", required = true) playerIdResponse: PlayerIdResponse)
|
||||
@Schema(description = "player description", required = true) playerId: PlayerIdResponse)
|
||||
|
@ -12,4 +12,4 @@ import io.swagger.v3.oas.annotations.media.Schema
|
||||
|
||||
case class PlayerActionResponse(
|
||||
@Schema(description = "action to perform", required = true, `type` = "string", allowableValues = Array("add", "remove"), example = "add") action: ApiAction.Value,
|
||||
@Schema(description = "player description", required = true) playerIdResponse: PlayerResponse)
|
||||
@Schema(description = "player description", required = true) playerId: PlayerResponse)
|
||||
|
@ -16,13 +16,13 @@ object Settings {
|
||||
replace(default, values.toList)
|
||||
}
|
||||
|
||||
def clearDatabase(config: Config): Unit = {
|
||||
val databasePath =
|
||||
config.getString("me.arcanis.ffxivbis.database.sqlite.db.url").split(":").last
|
||||
val databaseFile = new File(databasePath)
|
||||
if (databaseFile.exists)
|
||||
databaseFile.delete()
|
||||
}
|
||||
def clearDatabase(config: Config): Unit =
|
||||
config.getString("me.arcanis.ffxivbis.database.sqlite.db.url").split(":")
|
||||
.lastOption.foreach { databasePath =>
|
||||
val databaseFile = new File(databasePath)
|
||||
if (databaseFile.exists)
|
||||
databaseFile.delete()
|
||||
}
|
||||
def randomDatabasePath: String = File.createTempFile("ffxivdb-",".db").toPath.toString
|
||||
def withRandomDatabase: Config =
|
||||
config(Map("me.arcanis.ffxivbis.database.sqlite.db.url" -> s"jdbc:sqlite:$randomDatabasePath"))
|
||||
|
Loading…
Reference in New Issue
Block a user