refactor: update meterRegistry usage to Option type and improve formatting
Build & Test (NowChessSystems) TeamCity build finished
Build & Test (NowChessSystems) TeamCity build finished
This commit is contained in:
@@ -61,7 +61,7 @@ class AccountService:
|
||||
def login(req: LoginRequest): Either[AccountError, String] =
|
||||
val result = authenticateUser(req)
|
||||
result match
|
||||
case Right(_) => meterRegistry.counter("nowchess.auth.logins", "result", "success").increment()
|
||||
case Right(_) => meterRegistry.counter("nowchess.auth.logins", "result", "success").increment()
|
||||
case Left(error) =>
|
||||
meterRegistry.counter("nowchess.auth.logins", "result", "failure").increment()
|
||||
meterRegistry.counter("nowchess.auth.login.failures", "reason", loginFailureReason(error)).increment()
|
||||
|
||||
@@ -118,7 +118,11 @@ class ChallengeService:
|
||||
result.foreach(_ => meterRegistry.counter("nowchess.challenges.declined").increment())
|
||||
result
|
||||
|
||||
private def declineChallenge(challengeId: UUID, userId: UUID, req: DeclineRequest): Either[ChallengeError, Challenge] =
|
||||
private def declineChallenge(
|
||||
challengeId: UUID,
|
||||
userId: UUID,
|
||||
req: DeclineRequest,
|
||||
): Either[ChallengeError, Challenge] =
|
||||
for
|
||||
challenge <- challengeRepository.findById(challengeId).toRight(ChallengeError.ChallengeNotFound)
|
||||
_ <- Either.cond(challenge.status == ChallengeStatus.Created, (), ChallengeError.ChallengeNotActive)
|
||||
|
||||
Reference in New Issue
Block a user