Fix indentation

This commit is contained in:
Christoph Hagen 2022-10-11 12:07:41 +02:00
parent e5a879966d
commit b00f0826b9

View File

@ -82,8 +82,8 @@ func deletePlayer(_ app: Application) {
app.post("player", "delete", ":name") { req -> EventLoopFuture<String> in app.post("player", "delete", ":name") { req -> EventLoopFuture<String> in
guard let name = req.parameters.get("name"), guard let name = req.parameters.get("name"),
let password = req.body.string else { let password = req.body.string else {
throw Abort(.badRequest) // 400 throw Abort(.badRequest) // 400
} }
return server.passwordHashForExistingPlayer(named: name, in: req.db) return server.passwordHashForExistingPlayer(named: name, in: req.db)
.guard({ hash in .guard({ hash in
(try? req.password.verify(password, created: hash)) ?? false (try? req.password.verify(password, created: hash)) ?? false
@ -107,8 +107,8 @@ func loginPlayer(_ app: Application) {
app.post("player", "login", ":name") { req -> EventLoopFuture<String> in app.post("player", "login", ":name") { req -> EventLoopFuture<String> in
guard let name = req.parameters.get("name"), guard let name = req.parameters.get("name"),
let password = req.body.string else { let password = req.body.string else {
throw Abort(.badRequest) // 400 throw Abort(.badRequest) // 400
} }
return server.passwordHashForExistingPlayer(named: name, in: req.db) return server.passwordHashForExistingPlayer(named: name, in: req.db)
.guard({ hash in .guard({ hash in
(try? req.password.verify(password, created: hash)) ?? false (try? req.password.verify(password, created: hash)) ?? false
@ -270,8 +270,8 @@ func joinTable(_ app: Application) {
guard let string = req.parameters.get("table"), guard let string = req.parameters.get("table"),
let table = UUID(uuidString: string), let table = UUID(uuidString: string),
let token = req.body.string else { let token = req.body.string else {
throw Abort(.badRequest) throw Abort(.badRequest)
} }
return server.join(tableId: table, playerToken: token, in: req.db) return server.join(tableId: table, playerToken: token, in: req.db)
.flatMapThrowing(encodeJSON) .flatMapThrowing(encodeJSON)
} }