rename property

This commit is contained in:
Evgenii Alekseev 2019-11-05 00:28:21 +03:00
parent 6e8b64feef
commit 557038c262
6 changed files with 12 additions and 12 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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"))