refactor(event): rename BotEventPublisher to EventPublisher and update references

This commit is contained in:
2026-04-28 14:23:16 +02:00
parent 1ab6532b0a
commit 4d625b013b
3 changed files with 7 additions and 7 deletions
@@ -2,7 +2,7 @@ package de.nowchess.account.resource
import de.nowchess.account.client.{CoreCreateGameRequest, CoreGameClient, CorePlayerInfo}
import de.nowchess.account.dto.{ErrorDto, OfficialChallengeResponse}
import de.nowchess.account.service.{AccountService, BotEventPublisher}
import de.nowchess.account.service.{AccountService, EventPublisher}
import jakarta.annotation.security.RolesAllowed
import jakarta.enterprise.context.ApplicationScoped
import jakarta.inject.Inject
@@ -25,7 +25,7 @@ class OfficialChallengeResource:
// scalafix:off DisableSyntax.var
@Inject var accountService: AccountService = uninitialized
@Inject var jwt: JsonWebToken = uninitialized
@Inject var botEventPublisher: BotEventPublisher = uninitialized
@Inject var botEventPublisher: EventPublisher = uninitialized
@Inject
@RestClient
@@ -47,7 +47,7 @@ class ChallengeService:
var coreGameClient: CoreGameClient = uninitialized
@Inject
var botEventPublisher: BotEventPublisher = uninitialized
var eventPublisher: EventPublisher = uninitialized
// scalafix:on
@Transactional
@@ -74,7 +74,7 @@ class ChallengeService:
challenge.createdAt = Instant.now()
challenge.expiresAt = Instant.now().plus(24, ChronoUnit.HOURS)
challengeRepository.persist(challenge)
try botEventPublisher.publishChallengeCreated(destUser.id.toString, challenge.id.toString, challenger.username)
try eventPublisher.publishChallengeCreated(destUser.id.toString, challenge.id.toString, challenger.username)
catch case ex: Exception => log.warnf(ex, "Failed to notify dest user for challenge %s", challenge.id)
challenge
@@ -90,7 +90,7 @@ class ChallengeService:
challenge.gameId = gameId
challengeRepository.merge(challenge)
notifyBotIfNeeded(challenge, gameId)
try botEventPublisher.publishChallengeAccepted(challenge.challenger.id.toString, challenge.id.toString, gameId)
try eventPublisher.publishChallengeAccepted(challenge.challenger.id.toString, challenge.id.toString, gameId)
catch case ex: Exception => log.warnf(ex, "Failed to notify challenger for game %s", gameId)
challenge
@@ -138,7 +138,7 @@ class ChallengeService:
List(challenge.challenger, challenge.destUser).foreach { user =>
user.getBotAccounts.headOption.foreach { bot =>
val playingAs = if white.id == user.id.toString then "white" else "black"
try botEventPublisher.publishGameStart(bot.id.toString, gameId, playingAs, 1400, bot.id.toString)
try eventPublisher.publishGameStart(bot.id.toString, gameId, playingAs, 1400, bot.id.toString)
catch case ex: Exception => log.warnf(ex, "Failed to notify bot for game %s", gameId)
}
}
@@ -7,7 +7,7 @@ import org.redisson.api.RedissonClient
import scala.compiletime.uninitialized
@ApplicationScoped
class BotEventPublisher:
class EventPublisher:
// scalafix:off DisableSyntax.var
@Inject var redisson: RedissonClient = uninitialized