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.client.{CoreCreateGameRequest, CoreGameClient, CorePlayerInfo}
import de.nowchess.account.dto.{ErrorDto, OfficialChallengeResponse} 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.annotation.security.RolesAllowed
import jakarta.enterprise.context.ApplicationScoped import jakarta.enterprise.context.ApplicationScoped
import jakarta.inject.Inject import jakarta.inject.Inject
@@ -25,7 +25,7 @@ class OfficialChallengeResource:
// scalafix:off DisableSyntax.var // scalafix:off DisableSyntax.var
@Inject var accountService: AccountService = uninitialized @Inject var accountService: AccountService = uninitialized
@Inject var jwt: JsonWebToken = uninitialized @Inject var jwt: JsonWebToken = uninitialized
@Inject var botEventPublisher: BotEventPublisher = uninitialized @Inject var botEventPublisher: EventPublisher = uninitialized
@Inject @Inject
@RestClient @RestClient
@@ -47,7 +47,7 @@ class ChallengeService:
var coreGameClient: CoreGameClient = uninitialized var coreGameClient: CoreGameClient = uninitialized
@Inject @Inject
var botEventPublisher: BotEventPublisher = uninitialized var eventPublisher: EventPublisher = uninitialized
// scalafix:on // scalafix:on
@Transactional @Transactional
@@ -74,7 +74,7 @@ class ChallengeService:
challenge.createdAt = Instant.now() challenge.createdAt = Instant.now()
challenge.expiresAt = Instant.now().plus(24, ChronoUnit.HOURS) challenge.expiresAt = Instant.now().plus(24, ChronoUnit.HOURS)
challengeRepository.persist(challenge) 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) catch case ex: Exception => log.warnf(ex, "Failed to notify dest user for challenge %s", challenge.id)
challenge challenge
@@ -90,7 +90,7 @@ class ChallengeService:
challenge.gameId = gameId challenge.gameId = gameId
challengeRepository.merge(challenge) challengeRepository.merge(challenge)
notifyBotIfNeeded(challenge, gameId) 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) catch case ex: Exception => log.warnf(ex, "Failed to notify challenger for game %s", gameId)
challenge challenge
@@ -138,7 +138,7 @@ class ChallengeService:
List(challenge.challenger, challenge.destUser).foreach { user => List(challenge.challenger, challenge.destUser).foreach { user =>
user.getBotAccounts.headOption.foreach { bot => user.getBotAccounts.headOption.foreach { bot =>
val playingAs = if white.id == user.id.toString then "white" else "black" 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) 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 import scala.compiletime.uninitialized
@ApplicationScoped @ApplicationScoped
class BotEventPublisher: class EventPublisher:
// scalafix:off DisableSyntax.var // scalafix:off DisableSyntax.var
@Inject var redisson: RedissonClient = uninitialized @Inject var redisson: RedissonClient = uninitialized