diff --git a/modules/account/src/main/scala/de/nowchess/account/service/AccountService.scala b/modules/account/src/main/scala/de/nowchess/account/service/AccountService.scala index 0f29b36..f1d5f29 100644 --- a/modules/account/src/main/scala/de/nowchess/account/service/AccountService.scala +++ b/modules/account/src/main/scala/de/nowchess/account/service/AccountService.scala @@ -201,26 +201,22 @@ class AccountService: @Transactional def createOfficialBotAccount(botName: String): Either[AccountError, OfficialBotAccount] = - val id = UUID.randomUUID() val bot = new OfficialBotAccount() - bot.id = id bot.name = botName bot.createdAt = Instant.now() - bot.token = generateBotToken(id, botName) officialBotAccountRepository.persist(bot) + bot.token = generateBotToken(bot.id, botName) Right(bot) @Transactional def syncOfficialBots(botNames: List[String]): Unit = botNames.foreach { name => if officialBotAccountRepository.findByName(name).isEmpty then - val id = UUID.randomUUID() val bot = new OfficialBotAccount() - bot.id = id bot.name = name bot.createdAt = Instant.now() - bot.token = generateBotToken(id, name) officialBotAccountRepository.persist(bot) + bot.token = generateBotToken(bot.id, name) log.infof("Auto-registered official bot: %s", name) }