~jan0sch/smederee
Showing details for patch b988fee1b48cbddff28d62537bd93c15bc16c929.
diff -rN -u old-smederee/build.sbt new-smederee/build.sbt --- old-smederee/build.sbt 2025-01-16 00:01:53.876744247 +0000 +++ new-smederee/build.sbt 2025-01-16 00:01:53.880744256 +0000 @@ -430,10 +430,10 @@ val apacheSshd = "2.10.0" val bouncyCastle = "1.75" val cats = "2.9.0" - val catsEffect = "3.4.11" + val catsEffect = "3.5.0" val circe = "0.14.5" val commonMark = "0.21.0" - val doobie = "1.0.0-RC2" + val doobie = "1.0.0-RC4" val flyway = "9.19.4" val fs2 = "3.5.0" val http4s = "1.0.0-M39" diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/HubServer.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/HubServer.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/hub/HubServer.scala 2025-01-16 00:01:53.876744247 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/HubServer.scala 2025-01-16 00:01:53.880744256 +0000 @@ -203,10 +203,11 @@ } yield ExitCode.Success case commandString :: parameters => val hubTransactor = Transactor.fromDriverManager[IO]( - hubConfiguration.database.driver, - hubConfiguration.database.url, - hubConfiguration.database.user, - hubConfiguration.database.pass + driver = hubConfiguration.database.driver, + url = hubConfiguration.database.url, + user = hubConfiguration.database.user, + password = hubConfiguration.database.pass, + logHandler = None ) val authenticationRepo = new DoobieAuthenticationRepository[IO](hubTransactor) HubCommand.valueOf(commandString.toLowerCase(Locale.ROOT)) match { @@ -347,16 +348,18 @@ case Right(message) => IO(log.info(message)) } hubTransactor = Transactor.fromDriverManager[IO]( - hubConfiguration.database.driver, - hubConfiguration.database.url, - hubConfiguration.database.user, - hubConfiguration.database.pass + driver = hubConfiguration.database.driver, + url = hubConfiguration.database.url, + user = hubConfiguration.database.user, + password = hubConfiguration.database.pass, + logHandler = None ) ticketsTransactor = Transactor.fromDriverManager[IO]( - ticketsConfiguration.database.driver, - ticketsConfiguration.database.url, - ticketsConfiguration.database.user, - ticketsConfiguration.database.pass + driver = ticketsConfiguration.database.driver, + url = ticketsConfiguration.database.url, + user = ticketsConfiguration.database.user, + password = ticketsConfiguration.database.pass, + logHandler = None ) ticketServiceApi = new DoobieTicketServiceApi[IO](ticketsTransactor) ticketLabelsRepo = new DoobieLabelRepository[IO](ticketsTransactor) diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/ssh/SshServer.scala new-smederee/modules/hub/src/main/scala/de/smederee/ssh/SshServer.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/ssh/SshServer.scala 2025-01-16 00:01:53.876744247 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/ssh/SshServer.scala 2025-01-16 00:01:53.880744256 +0000 @@ -134,10 +134,11 @@ */ private def createServer(): SshServer = { val transactor = Transactor.fromDriverManager[IO]( - databaseConfiguration.driver, - databaseConfiguration.url, - databaseConfiguration.user, - databaseConfiguration.pass + driver = databaseConfiguration.driver, + url = databaseConfiguration.url, + user = databaseConfiguration.user, + password = databaseConfiguration.pass, + logHandler = None ) val repository = new DoobieSshAuthenticationRepository[IO](transactor) val server = SshServer.setUpDefaultServer() diff -rN -u old-smederee/modules/hub/src/test/scala/de/smederee/hub/AuthenticationMiddlewareTest.scala new-smederee/modules/hub/src/test/scala/de/smederee/hub/AuthenticationMiddlewareTest.scala --- old-smederee/modules/hub/src/test/scala/de/smederee/hub/AuthenticationMiddlewareTest.scala 2025-01-16 00:01:53.876744247 +0000 +++ new-smederee/modules/hub/src/test/scala/de/smederee/hub/AuthenticationMiddlewareTest.scala 2025-01-16 00:01:53.880744256 +0000 @@ -56,8 +56,14 @@ val session = s.copy(uid = account.uid, createdAt = createdAt) val timeouts = AuthenticationTimeouts(duration, duration, duration) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val repo = new DoobieAuthenticationRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) _ <- createUserSession(session) @@ -81,8 +87,14 @@ val session = s.copy(uid = account.uid, createdAt = createdAt) val timeouts = AuthenticationTimeouts(duration, duration, duration) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val repo = new DoobieAuthenticationRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) _ <- createUserSession(session) @@ -101,8 +113,14 @@ val session = s.copy(uid = account.uid) val timeouts = AuthenticationTimeouts(duration, duration, duration) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val repo = new DoobieAuthenticationRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) user <- resolveUser[IO](repo)(timeouts).run(session.id) diff -rN -u old-smederee/modules/hub/src/test/scala/de/smederee/hub/DoobieAccountManagementRepositoryTest.scala new-smederee/modules/hub/src/test/scala/de/smederee/hub/DoobieAccountManagementRepositoryTest.scala --- old-smederee/modules/hub/src/test/scala/de/smederee/hub/DoobieAccountManagementRepositoryTest.scala 2025-01-16 00:01:53.876744247 +0000 +++ new-smederee/modules/hub/src/test/scala/de/smederee/hub/DoobieAccountManagementRepositoryTest.scala 2025-01-16 00:01:53.880744256 +0000 @@ -65,7 +65,13 @@ (genValidAccount.sample, sshKeyWithComment()) match { case (Some(account), Some(sshKey)) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val repo = new DoobieAccountManagementRepository[IO](tx) val attempts = scala.util.Random.nextInt(128) val hash = PasswordHash("Yet another weak password!") @@ -87,7 +93,13 @@ (genValidAccount.sample, sshKeyWithoutComment()) match { case (Some(account), Some(sshKey)) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val repo = new DoobieAccountManagementRepository[IO](tx) val attempts = scala.util.Random.nextInt(128) val hash = PasswordHash("Yet another weak password!") @@ -108,7 +120,13 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val repo = new DoobieAccountManagementRepository[IO](tx) val attempts = scala.util.Random.nextInt(128) val hash = PasswordHash("Yet another weak password!") @@ -128,9 +146,15 @@ val account = ac.copy(validatedEmail = true) val token = ValidationToken.generate val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAccountManagementRepository[IO](tx) - val hash = PasswordHash("Yet another weak password!") + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val repo = new DoobieAccountManagementRepository[IO](tx) + val hash = PasswordHash("Yet another weak password!") val test = for { _ <- createAccount(account, hash, validationToken = token.some) o <- repo.findByValidationToken(token) @@ -144,7 +168,13 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val repo = new DoobieAccountManagementRepository[IO](tx) val attempts = scala.util.Random.nextInt(128) val hash = PasswordHash("Yet another weak password!") @@ -160,7 +190,13 @@ (genValidAccount.sample, sshKeyWithComment(), sshKeyWithoutComment()) match { case (Some(account), Some(sshKeyA), Some(sshKeyB)) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val repo = new DoobieAccountManagementRepository[IO](tx) val attempts = scala.util.Random.nextInt(128) val hash = PasswordHash("Yet another weak password!") @@ -186,9 +222,15 @@ val account = ac.copy(validatedEmail = true) val token = ValidationToken.generate val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAccountManagementRepository[IO](tx) - val hash = PasswordHash("Yet another weak password!") + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val repo = new DoobieAccountManagementRepository[IO](tx) + val hash = PasswordHash("Yet another weak password!") val test = for { _ <- createAccount(account, hash, validationToken = token.some) _ <- repo.markAsValidated(account.uid) @@ -206,9 +248,15 @@ case Some(account) => val language = genLanguageCode.sample val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAccountManagementRepository[IO](tx) - val hash = PasswordHash("Yet another weak password!") + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val repo = new DoobieAccountManagementRepository[IO](tx) + val hash = PasswordHash("Yet another weak password!") val test = for { _ <- createAccount(account, hash) _ <- repo.setLanguage(account.uid, language) @@ -226,9 +274,15 @@ case Some(account) => val token = ValidationToken.generate val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAccountManagementRepository[IO](tx) - val hash = PasswordHash("Yet another weak password!") + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val repo = new DoobieAccountManagementRepository[IO](tx) + val hash = PasswordHash("Yet another weak password!") val test = for { _ <- createAccount(account, hash) _ <- repo.setValidationToken(account.uid, token) diff -rN -u old-smederee/modules/hub/src/test/scala/de/smederee/hub/DoobieAuthenticationRepositoryTest.scala new-smederee/modules/hub/src/test/scala/de/smederee/hub/DoobieAuthenticationRepositoryTest.scala --- old-smederee/modules/hub/src/test/scala/de/smederee/hub/DoobieAuthenticationRepositoryTest.scala 2025-01-16 00:01:53.876744247 +0000 +++ new-smederee/modules/hub/src/test/scala/de/smederee/hub/DoobieAuthenticationRepositoryTest.scala 2025-01-16 00:01:53.880744256 +0000 @@ -48,8 +48,14 @@ case Some(accounts) => val expected = accounts.map(_.copy(language = None)) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val repo = new DoobieAuthenticationRepository[IO](tx) val test = for { _ <- accounts.traverse(account => createAccount(account, PasswordHash("I am not a password hash!"), None, None) @@ -69,8 +75,14 @@ case (Some(s), Some(account)) => val session = s.copy(uid = account.uid) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val repo = new DoobieAuthenticationRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) w <- repo.createUserSession(session) @@ -89,8 +101,14 @@ genValidSession.sample match { case Some(session) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val repo = new DoobieAuthenticationRepository[IO](tx) val test = for { _ <- repo.createUserSession(session) _ <- repo.findUserSession(session.id) @@ -105,8 +123,14 @@ case (Some(s), Some(account)) => val session = s.copy(uid = account.uid) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val repo = new DoobieAuthenticationRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) _ <- createUserSession(session) @@ -129,8 +153,14 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val repo = new DoobieAuthenticationRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) o <- repo.findAccount(account.uid) @@ -146,8 +176,14 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val repo = new DoobieAuthenticationRepository[IO](tx) val test = for { _ <- createAccount( account, @@ -168,8 +204,14 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val repo = new DoobieAuthenticationRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) o <- repo.findAccountByEmail(account.email) @@ -185,8 +227,14 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val repo = new DoobieAuthenticationRepository[IO](tx) val test = for { _ <- createAccount( account, @@ -207,8 +255,14 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val repo = new DoobieAuthenticationRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) o <- repo.findAccountByName(account.name) @@ -224,8 +278,14 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val repo = new DoobieAuthenticationRepository[IO](tx) val test = for { _ <- createAccount( account, @@ -246,9 +306,15 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) - val token = UnlockToken.generate + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val repo = new DoobieAuthenticationRepository[IO](tx) + val token = UnlockToken.generate val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), Option(token), None) o <- repo.findLockedAccount(account.name)(token.some) @@ -264,9 +330,15 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) - val token = UnlockToken.generate + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val repo = new DoobieAuthenticationRepository[IO](tx) + val token = UnlockToken.generate val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), Option(token), None) o <- repo.findLockedAccount(account.name)(None) @@ -282,7 +354,13 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val repo = new DoobieAuthenticationRepository[IO](tx) val attempts = scala.util.Random.nextInt(128) val hash = PasswordHash("Yet another weak password!") @@ -306,7 +384,13 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val repo = new DoobieAuthenticationRepository[IO](tx) val attempts = scala.util.Random.nextInt(128) val hash = PasswordHash("Yet another weak password!") @@ -325,8 +409,14 @@ case (Some(s), Some(account)) => val session = s.copy(uid = account.uid) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val repo = new DoobieAuthenticationRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) _ <- createUserSession(session) @@ -344,7 +434,13 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val repo = new DoobieAuthenticationRepository[IO](tx) val attempts = scala.util.Random.nextInt(128) val hash = PasswordHash("Yet another weak password!") @@ -369,9 +465,15 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) - val token = UnlockToken.generate + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val repo = new DoobieAuthenticationRepository[IO](tx) + val token = UnlockToken.generate val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) before <- repo.findAccount(account.uid) diff -rN -u old-smederee/modules/hub/src/test/scala/de/smederee/hub/DoobieSignupRepositoryTest.scala new-smederee/modules/hub/src/test/scala/de/smederee/hub/DoobieSignupRepositoryTest.scala --- old-smederee/modules/hub/src/test/scala/de/smederee/hub/DoobieSignupRepositoryTest.scala 2025-01-16 00:01:53.876744247 +0000 +++ new-smederee/modules/hub/src/test/scala/de/smederee/hub/DoobieSignupRepositoryTest.scala 2025-01-16 00:01:53.880744256 +0000 @@ -30,8 +30,14 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieSignupRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val repo = new DoobieSignupRepository[IO](tx) val test = for { w <- repo.createAccount(account, PasswordHash("I am not a password hash!")) o <- loadAccount(account.uid) @@ -50,7 +56,13 @@ val existingAccount = a val newAccount = b.copy(email = a.email) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val repo = new DoobieSignupRepository[IO](tx) val test = for { c <- createAccount(existingAccount, PasswordHash("I am not a password hash!"), None, None) @@ -74,7 +86,13 @@ val existingAccount = a val newAccount = b.copy(name = a.name) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val repo = new DoobieSignupRepository[IO](tx) val test = for { c <- createAccount(existingAccount, PasswordHash("I am not a password hash!"), None, None) @@ -97,8 +115,14 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieSignupRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val repo = new DoobieSignupRepository[IO](tx) val test = for { c <- repo.createAccount(account, PasswordHash("I am not a password hash!")) e <- repo.findEmail(account.email) @@ -116,8 +140,14 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieSignupRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val repo = new DoobieSignupRepository[IO](tx) val test = for { c <- repo.createAccount(account, PasswordHash("I am not a password hash!")) n <- repo.findUsername(account.name) diff -rN -u old-smederee/modules/hub/src/test/scala/de/smederee/hub/DoobieVcsMetadataRepositoryTest.scala new-smederee/modules/hub/src/test/scala/de/smederee/hub/DoobieVcsMetadataRepositoryTest.scala --- old-smederee/modules/hub/src/test/scala/de/smederee/hub/DoobieVcsMetadataRepositoryTest.scala 2025-01-16 00:01:53.876744247 +0000 +++ new-smederee/modules/hub/src/test/scala/de/smederee/hub/DoobieVcsMetadataRepositoryTest.scala 2025-01-16 00:01:53.880744256 +0000 @@ -68,8 +68,14 @@ repo.copy(owner = account.toVcsRepositoryOwner) } val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieVcsMetadataRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val repo = new DoobieVcsMetadataRepository[IO](tx) val test = for { _ <- accounts.traverse(account => createAccount(account, PasswordHash("I am not a password hash!"), None, None) @@ -105,7 +111,13 @@ case (Some(account), Some(repository)) => val vcsRepository = repository.copy(owner = account.toVcsRepositoryOwner) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val repo = new DoobieVcsMetadataRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) @@ -122,8 +134,14 @@ genValidVcsRepository.sample match { case Some(repository) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieVcsMetadataRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val repo = new DoobieVcsMetadataRepository[IO](tx) val test = for { written <- repo.createVcsRepository(repository) } yield written @@ -137,7 +155,13 @@ case (Some(account), Some(repository)) => val vcsRepository = repository.copy(owner = account.toVcsRepositoryOwner) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val repo = new DoobieVcsMetadataRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) @@ -154,7 +178,13 @@ case (Some(account), Some(repository)) => val vcsRepository = repository.copy(owner = account.toVcsRepositoryOwner) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val repo = new DoobieVcsMetadataRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) @@ -181,8 +211,14 @@ repo.copy(owner = account.toVcsRepositoryOwner) } val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieVcsMetadataRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val repo = new DoobieVcsMetadataRepository[IO](tx) val test = for { _ <- accounts.traverse(account => createAccount(account, PasswordHash("I am not a password hash!"), None, None) @@ -223,7 +259,13 @@ case (Some(account), Some(repository)) => val vcsRepository = repository.copy(owner = account.toVcsRepositoryOwner) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val repo = new DoobieVcsMetadataRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) @@ -247,7 +289,13 @@ case Some(accounts) => val expectedOwner = accounts(scala.util.Random.nextInt(accounts.size)).toVcsRepositoryOwner val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val repo = new DoobieVcsMetadataRepository[IO](tx) val test = for { written <- accounts.traverse(account => @@ -278,8 +326,14 @@ repo.copy(owner = account.toVcsRepositoryOwner) } val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieVcsMetadataRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val repo = new DoobieVcsMetadataRepository[IO](tx) val test = for { _ <- accounts.traverse(account => createAccount(account, PasswordHash("I am not a password hash!"), None, None) @@ -324,7 +378,13 @@ ) val expectedRepoList = vcsRepositories.filter(_.isPrivate === false) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val repo = new DoobieVcsMetadataRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) @@ -362,7 +422,13 @@ ) val expectedRepoList = vcsRepositories.filter(_.isPrivate === false) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val repo = new DoobieVcsMetadataRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) @@ -403,7 +469,13 @@ ) val expectedRepoList = vcsRepositories val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val repo = new DoobieVcsMetadataRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) @@ -432,7 +504,13 @@ val vcsRepositories = repositories.map(_.copy(owner = account.toVcsRepositoryOwner)) val expectedRepoList = vcsRepositories.filter(_.isPrivate === false).sortBy(_.name) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val repo = new DoobieVcsMetadataRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) @@ -459,7 +537,13 @@ val vcsRepositories = repositories.map(_.copy(owner = account.toVcsRepositoryOwner)) val expectedRepoList = vcsRepositories.sortBy(_.name) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val repo = new DoobieVcsMetadataRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) @@ -486,7 +570,13 @@ val vcsRepositories = repositories.map(_.copy(owner = account.toVcsRepositoryOwner)) val expectedRepoList = vcsRepositories.filter(_.isPrivate === false).sortBy(_.name) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val repo = new DoobieVcsMetadataRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) @@ -521,8 +611,14 @@ website = Option(uri"https://updated.example.com") ) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieVcsMetadataRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val repo = new DoobieVcsMetadataRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) written <- vcsRepositories.traverse(vcsRepository => repo.createVcsRepository(vcsRepository)) diff -rN -u old-smederee/modules/hub/src/test/scala/de/smederee/ssh/DoobieSshAuthenticationRepositoryTest.scala new-smederee/modules/hub/src/test/scala/de/smederee/ssh/DoobieSshAuthenticationRepositoryTest.scala --- old-smederee/modules/hub/src/test/scala/de/smederee/ssh/DoobieSshAuthenticationRepositoryTest.scala 2025-01-16 00:01:53.876744247 +0000 +++ new-smederee/modules/hub/src/test/scala/de/smederee/ssh/DoobieSshAuthenticationRepositoryTest.scala 2025-01-16 00:01:53.880744256 +0000 @@ -30,8 +30,14 @@ genValidAccount.sample match { case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieSshAuthenticationRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val repo = new DoobieSshAuthenticationRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) owner <- repo.findVcsRepositoryOwner(account.name) diff -rN -u old-smederee/modules/tickets/src/main/scala/de/smederee/tickets/DoobieLabelRepository.scala new-smederee/modules/tickets/src/main/scala/de/smederee/tickets/DoobieLabelRepository.scala --- old-smederee/modules/tickets/src/main/scala/de/smederee/tickets/DoobieLabelRepository.scala 2025-01-16 00:01:53.876744247 +0000 +++ new-smederee/modules/tickets/src/main/scala/de/smederee/tickets/DoobieLabelRepository.scala 2025-01-16 00:01:53.880744256 +0000 @@ -26,7 +26,7 @@ final class DoobieLabelRepository[F[_]: Sync](tx: Transactor[F]) extends LabelRepository[F] { private val log = LoggerFactory.getLogger(getClass) - given LogHandler = Slf4jLogHandler.createLogHandler(log) + given LogHandler[F] = Slf4jLogHandler.createLogHandler[F](log) given Meta[ColourCode] = Meta[String].timap(ColourCode.apply)(_.toString) given Meta[LabelDescription] = Meta[String].timap(LabelDescription.apply)(_.toString) diff -rN -u old-smederee/modules/tickets/src/main/scala/de/smederee/tickets/DoobieMilestoneRepository.scala new-smederee/modules/tickets/src/main/scala/de/smederee/tickets/DoobieMilestoneRepository.scala --- old-smederee/modules/tickets/src/main/scala/de/smederee/tickets/DoobieMilestoneRepository.scala 2025-01-16 00:01:53.876744247 +0000 +++ new-smederee/modules/tickets/src/main/scala/de/smederee/tickets/DoobieMilestoneRepository.scala 2025-01-16 00:01:53.880744256 +0000 @@ -27,7 +27,7 @@ final class DoobieMilestoneRepository[F[_]: Sync](tx: Transactor[F]) extends MilestoneRepository[F] { private val log = LoggerFactory.getLogger(getClass) - given LogHandler = Slf4jLogHandler.createLogHandler(log) + given LogHandler[F] = Slf4jLogHandler.createLogHandler[F](log) given Meta[MilestoneDescription] = Meta[String].timap(MilestoneDescription.apply)(_.toString) given Meta[MilestoneId] = Meta[Long].timap(MilestoneId.apply)(_.toLong) diff -rN -u old-smederee/modules/tickets/src/main/scala/de/smederee/tickets/DoobieProjectRepository.scala new-smederee/modules/tickets/src/main/scala/de/smederee/tickets/DoobieProjectRepository.scala --- old-smederee/modules/tickets/src/main/scala/de/smederee/tickets/DoobieProjectRepository.scala 2025-01-16 00:01:53.876744247 +0000 +++ new-smederee/modules/tickets/src/main/scala/de/smederee/tickets/DoobieProjectRepository.scala 2025-01-16 00:01:53.880744256 +0000 @@ -29,7 +29,7 @@ final class DoobieProjectRepository[F[_]: Sync](tx: Transactor[F]) extends ProjectRepository[F] { private val log = LoggerFactory.getLogger(getClass) - given LogHandler = Slf4jLogHandler.createLogHandler(log) + given LogHandler[F] = Slf4jLogHandler.createLogHandler[F](log) given Meta[EmailAddress] = Meta[String].timap(EmailAddress.apply)(_.toString) given Meta[ProjectDescription] = Meta[String].timap(ProjectDescription.apply)(_.toString) diff -rN -u old-smederee/modules/tickets/src/main/scala/de/smederee/tickets/DoobieTicketRepository.scala new-smederee/modules/tickets/src/main/scala/de/smederee/tickets/DoobieTicketRepository.scala --- old-smederee/modules/tickets/src/main/scala/de/smederee/tickets/DoobieTicketRepository.scala 2025-01-16 00:01:53.876744247 +0000 +++ new-smederee/modules/tickets/src/main/scala/de/smederee/tickets/DoobieTicketRepository.scala 2025-01-16 00:01:53.884744264 +0000 @@ -33,7 +33,7 @@ final class DoobieTicketRepository[F[_]: Sync](tx: Transactor[F]) extends TicketRepository[F] { private val log = LoggerFactory.getLogger(getClass) - given LogHandler = Slf4jLogHandler.createLogHandler(log) + given LogHandler[F] = Slf4jLogHandler.createLogHandler[F](log) given Meta[AssigneeId] = Meta[UUID].timap(AssigneeId.apply)(_.toUUID) given Meta[AssigneeName] = Meta[String].timap(AssigneeName.apply)(_.toString) diff -rN -u old-smederee/modules/tickets/src/main/scala/de/smederee/tickets/DoobieTicketServiceApi.scala new-smederee/modules/tickets/src/main/scala/de/smederee/tickets/DoobieTicketServiceApi.scala --- old-smederee/modules/tickets/src/main/scala/de/smederee/tickets/DoobieTicketServiceApi.scala 2025-01-16 00:01:53.876744247 +0000 +++ new-smederee/modules/tickets/src/main/scala/de/smederee/tickets/DoobieTicketServiceApi.scala 2025-01-16 00:01:53.884744264 +0000 @@ -31,7 +31,7 @@ final class DoobieTicketServiceApi[F[_]: Sync](tx: Transactor[F]) extends TicketServiceApi[F] { private val log = LoggerFactory.getLogger(getClass) - given LogHandler = Slf4jLogHandler.createLogHandler(log) + given LogHandler[F] = Slf4jLogHandler.createLogHandler[F](log) given Meta[EmailAddress] = Meta[String].timap(EmailAddress.apply)(_.toString) given Meta[LanguageCode] = Meta[String].timap(LanguageCode.apply)(_.toString) diff -rN -u old-smederee/modules/tickets/src/main/scala/de/smederee/tickets/Slf4jLogHandler.scala new-smederee/modules/tickets/src/main/scala/de/smederee/tickets/Slf4jLogHandler.scala --- old-smederee/modules/tickets/src/main/scala/de/smederee/tickets/Slf4jLogHandler.scala 2025-01-16 00:01:53.876744247 +0000 +++ new-smederee/modules/tickets/src/main/scala/de/smederee/tickets/Slf4jLogHandler.scala 2025-01-16 00:01:53.884744264 +0000 @@ -17,7 +17,8 @@ package de.smederee.tickets -import doobie.util.log.{ ExecFailure, LogHandler, ProcessingFailure, Success } +import cats.effect._ +import doobie.util.log._ import org.slf4j.Logger object Slf4jLogHandler { @@ -39,44 +40,52 @@ * @return * A log handler as expected by doobie. */ - def createLogHandler(log: Logger): LogHandler = - LogHandler { - case Success(sqlQuery, arguments, executionTime, processingTime) => - log.debug(s"""SQL command successful: - | - | ${sqlQueryToLogString(sqlQuery)} - | - | arguments: [${sqlArgumentsToLogString(arguments)}] - | - | execution time : ${executionTime.toMillis} ms - | processing time: ${processingTime.toMillis} ms - | total time : ${(executionTime + processingTime).toMillis} ms - |""".stripMargin) - case ProcessingFailure(sqlQuery, arguments, executionTime, processingTime, failure) => - log.error( - s"""SQL PROCESSING FAILURE: - | - | ${sqlQueryToLogString(sqlQuery)} - | - | arguments: [${sqlArgumentsToLogString(arguments)}] - | - | execution time : ${executionTime.toMillis} ms - | processing time: ${processingTime.toMillis} ms - | total time : ${(executionTime + processingTime).toMillis} ms - |""".stripMargin, - failure - ) - case ExecFailure(sqlQuery, arguments, executionTime, failure) => - log.error( - s"""SQL EXECUTION FAILURE: - | - | ${sqlQueryToLogString(sqlQuery)} - | - | arguments: [${sqlArgumentsToLogString(arguments)}] - | - | execution time : ${executionTime.toMillis} ms - |""".stripMargin, - failure - ) + def createLogHandler[F[_]: Sync](log: Logger): LogHandler[F] = + new LogHandler[F] { + def run(logEvent: LogEvent): F[Unit] = + Sync[F].delay { + logEvent match { + case Success(sqlQuery, arguments, label, executionTime, processingTime) => + log.debug(s"""SQL command successful: + | + | ${sqlQueryToLogString(sqlQuery)} + | + | arguments: [${sqlArgumentsToLogString(arguments)}] + | label: $label + | + | execution time : ${executionTime.toMillis} ms + | processing time: ${processingTime.toMillis} ms + | total time : ${(executionTime + processingTime).toMillis} ms + |""".stripMargin) + case ProcessingFailure(sqlQuery, arguments, label, executionTime, processingTime, failure) => + log.error( + s"""SQL PROCESSING FAILURE: + | + | ${sqlQueryToLogString(sqlQuery)} + | + | arguments: [${sqlArgumentsToLogString(arguments)}] + | label: $label + | + | execution time : ${executionTime.toMillis} ms + | processing time: ${processingTime.toMillis} ms + | total time : ${(executionTime + processingTime).toMillis} ms + |""".stripMargin, + failure + ) + case ExecFailure(sqlQuery, arguments, label, executionTime, failure) => + log.error( + s"""SQL EXECUTION FAILURE: + | + | ${sqlQueryToLogString(sqlQuery)} + | + | arguments: [${sqlArgumentsToLogString(arguments)}] + | label: $label + | + | execution time : ${executionTime.toMillis} ms + |""".stripMargin, + failure + ) + } + } } } diff -rN -u old-smederee/modules/tickets/src/test/scala/de/smederee/tickets/DoobieLabelRepositoryTest.scala new-smederee/modules/tickets/src/test/scala/de/smederee/tickets/DoobieLabelRepositoryTest.scala --- old-smederee/modules/tickets/src/test/scala/de/smederee/tickets/DoobieLabelRepositoryTest.scala 2025-01-16 00:01:53.880744256 +0000 +++ new-smederee/modules/tickets/src/test/scala/de/smederee/tickets/DoobieLabelRepositoryTest.scala 2025-01-16 00:01:53.884744264 +0000 @@ -69,9 +69,15 @@ test("allLabels must return all labels".tag(NeedsDatabase)) { (genProjectOwner.sample, genProject.sample, genLabels.sample) match { case (Some(owner), Some(generatedProject), Some(labels)) => - val project = generatedProject.copy(owner = owner) - val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val project = generatedProject.copy(owner = owner) + val dbConfig = configuration.database + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val labelRepo = new DoobieLabelRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) @@ -99,9 +105,15 @@ test("createLabel must create the label".tag(NeedsDatabase)) { (genProjectOwner.sample, genProject.sample, genLabel.sample) match { case (Some(owner), Some(generatedProject), Some(label)) => - val project = generatedProject.copy(owner = owner) - val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val project = generatedProject.copy(owner = owner) + val dbConfig = configuration.database + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val labelRepo = new DoobieLabelRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) @@ -131,9 +143,15 @@ test("createLabel must fail if the label name already exists".tag(NeedsDatabase)) { (genProjectOwner.sample, genProject.sample, genLabel.sample) match { case (Some(owner), Some(generatedProject), Some(label)) => - val project = generatedProject.copy(owner = owner) - val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val project = generatedProject.copy(owner = owner) + val dbConfig = configuration.database + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val labelRepo = new DoobieLabelRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) @@ -150,9 +168,15 @@ test("deleteLabel must delete an existing label".tag(NeedsDatabase)) { (genProjectOwner.sample, genProject.sample, genLabel.sample) match { case (Some(owner), Some(generatedProject), Some(label)) => - val project = generatedProject.copy(owner = owner) - val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val project = generatedProject.copy(owner = owner) + val dbConfig = configuration.database + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val labelRepo = new DoobieLabelRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) @@ -181,7 +205,13 @@ val project = generatedProject.copy(owner = owner) val dbConfig = configuration.database val expectedLabel = labels(scala.util.Random.nextInt(labels.size)) - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val labelRepo = new DoobieLabelRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) @@ -208,9 +238,15 @@ description = Option(LabelDescription("I am an updated label description...")), colour = ColourCode("#abcdef") ) - val project = generatedProject.copy(owner = owner) - val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val project = generatedProject.copy(owner = owner) + val dbConfig = configuration.database + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val labelRepo = new DoobieLabelRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) @@ -245,9 +281,15 @@ description = Option(LabelDescription("I am an updated label description...")), colour = ColourCode("#abcdef") ) - val project = generatedProject.copy(owner = owner) - val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val project = generatedProject.copy(owner = owner) + val dbConfig = configuration.database + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val labelRepo = new DoobieLabelRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) diff -rN -u old-smederee/modules/tickets/src/test/scala/de/smederee/tickets/DoobieMilestoneRepositoryTest.scala new-smederee/modules/tickets/src/test/scala/de/smederee/tickets/DoobieMilestoneRepositoryTest.scala --- old-smederee/modules/tickets/src/test/scala/de/smederee/tickets/DoobieMilestoneRepositoryTest.scala 2025-01-16 00:01:53.880744256 +0000 +++ new-smederee/modules/tickets/src/test/scala/de/smederee/tickets/DoobieMilestoneRepositoryTest.scala 2025-01-16 00:01:53.884744264 +0000 @@ -71,7 +71,13 @@ case (Some(owner), Some(generatedProject), Some(milestones)) => val project = generatedProject.copy(owner = owner) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val milestoneRepo = new DoobieMilestoneRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) @@ -101,7 +107,13 @@ case (Some(owner), Some(generatedProject), Some(milestone)) => val project = generatedProject.copy(owner = owner) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val milestoneRepo = new DoobieMilestoneRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) @@ -129,7 +141,13 @@ case (Some(owner), Some(generatedProject), Some(milestone)) => val project = generatedProject.copy(owner = owner) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val milestoneRepo = new DoobieMilestoneRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) @@ -148,7 +166,13 @@ case (Some(owner), Some(generatedProject), Some(milestone)) => val project = generatedProject.copy(owner = owner) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val milestoneRepo = new DoobieMilestoneRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) @@ -177,7 +201,13 @@ val project = generatedProject.copy(owner = owner) val dbConfig = configuration.database val expectedMilestone = milestones(scala.util.Random.nextInt(milestones.size)) - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val milestoneRepo = new DoobieMilestoneRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) @@ -206,7 +236,13 @@ ) val project = generatedProject.copy(owner = owner) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val milestoneRepo = new DoobieMilestoneRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) @@ -245,7 +281,13 @@ ) val project = generatedProject.copy(owner = owner) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val milestoneRepo = new DoobieMilestoneRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) diff -rN -u old-smederee/modules/tickets/src/test/scala/de/smederee/tickets/DoobieProjectRepositoryTest.scala new-smederee/modules/tickets/src/test/scala/de/smederee/tickets/DoobieProjectRepositoryTest.scala --- old-smederee/modules/tickets/src/test/scala/de/smederee/tickets/DoobieProjectRepositoryTest.scala 2025-01-16 00:01:53.880744256 +0000 +++ new-smederee/modules/tickets/src/test/scala/de/smederee/tickets/DoobieProjectRepositoryTest.scala 2025-01-16 00:01:53.884744264 +0000 @@ -27,9 +27,15 @@ test("createProject must create a project".tag(NeedsDatabase)) { (genProjectOwner.sample, genProject.sample) match { case (Some(owner), Some(generatedProject)) => - val project = generatedProject.copy(owner = owner) - val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val project = generatedProject.copy(owner = owner) + val dbConfig = configuration.database + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val projectRepo = new DoobieProjectRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) @@ -46,9 +52,15 @@ test("deleteProject must delete a project".tag(NeedsDatabase)) { (genProjectOwner.sample, genProject.sample) match { case (Some(owner), Some(generatedProject)) => - val project = generatedProject.copy(owner = owner) - val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val project = generatedProject.copy(owner = owner) + val dbConfig = configuration.database + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val projectRepo = new DoobieProjectRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) @@ -68,9 +80,15 @@ test("findProject must return the matching project".tag(NeedsDatabase)) { (genProjectOwner.sample, genProjects.sample) match { case (Some(owner), Some(generatedProject :: projects)) => - val project = generatedProject.copy(owner = owner) - val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val project = generatedProject.copy(owner = owner) + val dbConfig = configuration.database + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val projectRepo = new DoobieProjectRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) @@ -88,9 +106,15 @@ test("findProjectId must return the matching id".tag(NeedsDatabase)) { (genProjectOwner.sample, genProjects.sample) match { case (Some(owner), Some(generatedProject :: projects)) => - val project = generatedProject.copy(owner = owner) - val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val project = generatedProject.copy(owner = owner) + val dbConfig = configuration.database + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val projectRepo = new DoobieProjectRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) @@ -110,8 +134,14 @@ test("findProjectOwner must return the matching project owner".tag(NeedsDatabase)) { genProjectOwners.sample match { case Some(owner :: owners) => - val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val dbConfig = configuration.database + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val projectRepo = new DoobieProjectRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) @@ -128,9 +158,15 @@ test("incrementNextTicketNumber must return and increment the old value".tag(NeedsDatabase)) { (genProjectOwner.sample, genProject.sample) match { case (Some(owner), Some(firstProject)) => - val project = firstProject.copy(owner = owner) - val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val project = firstProject.copy(owner = owner) + val dbConfig = configuration.database + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val projectRepo = new DoobieProjectRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) @@ -161,7 +197,13 @@ val project = firstProject.copy(owner = owner) val updatedProject = project.copy(description = secondProject.description, isPrivate = secondProject.isPrivate) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val projectRepo = new DoobieProjectRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) diff -rN -u old-smederee/modules/tickets/src/test/scala/de/smederee/tickets/DoobieTicketRepositoryTest.scala new-smederee/modules/tickets/src/test/scala/de/smederee/tickets/DoobieTicketRepositoryTest.scala --- old-smederee/modules/tickets/src/test/scala/de/smederee/tickets/DoobieTicketRepositoryTest.scala 2025-01-16 00:01:53.880744256 +0000 +++ new-smederee/modules/tickets/src/test/scala/de/smederee/tickets/DoobieTicketRepositoryTest.scala 2025-01-16 00:01:53.884744264 +0000 @@ -96,10 +96,16 @@ test("addAssignee must save the assignee relation to the database".tag(NeedsDatabase)) { (genProjectOwner.sample, genProject.sample, genTicket.sample, genTicketsUser.sample) match { case (Some(owner), Some(generatedProject), Some(ticket), Some(user)) => - val assignee = Assignee(AssigneeId(user.uid.toUUID), AssigneeName(user.name.toString)) - val project = generatedProject.copy(owner = owner) - val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val assignee = Assignee(AssigneeId(user.uid.toUUID), AssigneeName(user.name.toString)) + val project = generatedProject.copy(owner = owner) + val dbConfig = configuration.database + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val ticketRepo = new DoobieTicketRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) @@ -123,9 +129,15 @@ test("addLabel must save the label relation to the database".tag(NeedsDatabase)) { (genProjectOwner.sample, genProject.sample, genTicket.sample, genLabel.sample) match { case (Some(owner), Some(generatedProject), Some(ticket), Some(label)) => - val project = generatedProject.copy(owner = owner) - val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val project = generatedProject.copy(owner = owner) + val dbConfig = configuration.database + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val labelRepo = new DoobieLabelRepository[IO](tx) val ticketRepo = new DoobieTicketRepository[IO](tx) val test = for { @@ -162,7 +174,13 @@ case (Some(owner), Some(generatedProject), Some(ticket), Some(milestone)) => val project = generatedProject.copy(owner = owner) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val milestoneRepo = new DoobieMilestoneRepository[IO](tx) val ticketRepo = new DoobieTicketRepository[IO](tx) val test = for { @@ -203,7 +221,13 @@ val submitters = tickets.map(_.submitter).flatten val project = generatedProject.copy(owner = owner) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val ticketRepo = new DoobieTicketRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) @@ -247,7 +271,13 @@ val submitters = tickets.map(_.submitter).flatten val project = generatedProject.copy(owner = owner) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val ticketRepo = new DoobieTicketRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) @@ -287,7 +317,13 @@ val submitters = tickets.map(_.submitter).flatten val project = generatedProject.copy(owner = owner) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val ticketRepo = new DoobieTicketRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) @@ -327,7 +363,13 @@ val submitters = tickets.map(_.submitter).flatten val project = generatedProject.copy(owner = owner) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val ticketRepo = new DoobieTicketRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) @@ -367,7 +409,13 @@ val filter = TicketFilter(Nil, Nil, Nil, submitter = wantedSubmitters) val project = generatedProject.copy(owner = owner) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val ticketRepo = new DoobieTicketRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) @@ -398,9 +446,15 @@ test("createTicket must save the ticket to the database".tag(NeedsDatabase)) { (genProjectOwner.sample, genProject.sample, genTicket.sample) match { case (Some(owner), Some(generatedProject), Some(ticket)) => - val project = generatedProject.copy(owner = owner) - val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val project = generatedProject.copy(owner = owner) + val dbConfig = configuration.database + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val ticketRepo = new DoobieTicketRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) @@ -427,9 +481,15 @@ test("deleteTicket must remove the ticket from the database".tag(NeedsDatabase)) { (genProjectOwner.sample, genProject.sample, genTicket.sample) match { case (Some(owner), Some(generatedProject), Some(ticket)) => - val project = generatedProject.copy(owner = owner) - val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val project = generatedProject.copy(owner = owner) + val dbConfig = configuration.database + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val ticketRepo = new DoobieTicketRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) @@ -454,7 +514,13 @@ val submitters = tickets.map(_.submitter).flatten val project = generatedProject.copy(owner = owner) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val ticketRepo = new DoobieTicketRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) @@ -488,7 +554,13 @@ val submitters = tickets.map(_.submitter).flatten val project = generatedProject.copy(owner = owner) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val ticketRepo = new DoobieTicketRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) @@ -517,10 +589,16 @@ test("loadAssignees must return all assignees of a ticket".tag(NeedsDatabase)) { (genProjectOwner.sample, genProject.sample, genTicket.sample, genTicketsUsers.sample) match { case (Some(owner), Some(generatedProject), Some(ticket), Some(users)) => - val assignees = users.map(user => Assignee(AssigneeId(user.uid.toUUID), AssigneeName(user.name.toString))) - val project = generatedProject.copy(owner = owner) - val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val assignees = users.map(user => Assignee(AssigneeId(user.uid.toUUID), AssigneeName(user.name.toString))) + val project = generatedProject.copy(owner = owner) + val dbConfig = configuration.database + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val ticketRepo = new DoobieTicketRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) @@ -548,9 +626,15 @@ test("loadLabels must return all labels of a ticket".tag(NeedsDatabase)) { (genProjectOwner.sample, genProject.sample, genTicket.sample, genLabels.sample) match { case (Some(owner), Some(generatedProject), Some(ticket), Some(labels)) => - val project = generatedProject.copy(owner = owner) - val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val project = generatedProject.copy(owner = owner) + val dbConfig = configuration.database + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val labelRepo = new DoobieLabelRepository[IO](tx) val ticketRepo = new DoobieTicketRepository[IO](tx) val test = for { @@ -583,7 +667,13 @@ case (Some(owner), Some(generatedProject), Some(ticket), Some(milestones)) => val project = generatedProject.copy(owner = owner) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val milestoneRepo = new DoobieMilestoneRepository[IO](tx) val ticketRepo = new DoobieTicketRepository[IO](tx) val test = for { @@ -614,10 +704,16 @@ test("removeAssignee must remove the assignees from the ticket".tag(NeedsDatabase)) { (genProjectOwner.sample, genProject.sample, genTicket.sample, genTicketsUser.sample) match { case (Some(owner), Some(generatedProject), Some(ticket), Some(user)) => - val assignee = Assignee(AssigneeId(user.uid.toUUID), AssigneeName(user.name.toString)) - val project = generatedProject.copy(owner = owner) - val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val assignee = Assignee(AssigneeId(user.uid.toUUID), AssigneeName(user.name.toString)) + val project = generatedProject.copy(owner = owner) + val dbConfig = configuration.database + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val ticketRepo = new DoobieTicketRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) @@ -646,9 +742,15 @@ test("removeLabel must remove the label from the ticket".tag(NeedsDatabase)) { (genProjectOwner.sample, genProject.sample, genTicket.sample, genLabel.sample) match { case (Some(owner), Some(generatedProject), Some(ticket), Some(label)) => - val project = generatedProject.copy(owner = owner) - val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val project = generatedProject.copy(owner = owner) + val dbConfig = configuration.database + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val labelRepo = new DoobieLabelRepository[IO](tx) val ticketRepo = new DoobieTicketRepository[IO](tx) val test = for { @@ -681,7 +783,13 @@ case (Some(owner), Some(generatedProject), Some(ticket), Some(milestone)) => val project = generatedProject.copy(owner = owner) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val milestoneRepo = new DoobieMilestoneRepository[IO](tx) val ticketRepo = new DoobieTicketRepository[IO](tx) val test = for { @@ -715,8 +823,14 @@ val project = generatedProject.copy(owner = owner) val updatedTicket = ticket.copy(title = anotherTicket.title, content = anotherTicket.content, submitter = anotherTicket.submitter) - val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val dbConfig = configuration.database + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) val ticketRepo = new DoobieTicketRepository[IO](tx) val test = for { _ <- createProjectOwner(owner) diff -rN -u old-smederee/modules/tickets/src/test/scala/de/smederee/tickets/DoobieTicketServiceApiTest.scala new-smederee/modules/tickets/src/test/scala/de/smederee/tickets/DoobieTicketServiceApiTest.scala --- old-smederee/modules/tickets/src/test/scala/de/smederee/tickets/DoobieTicketServiceApiTest.scala 2025-01-16 00:01:53.880744256 +0000 +++ new-smederee/modules/tickets/src/test/scala/de/smederee/tickets/DoobieTicketServiceApiTest.scala 2025-01-16 00:01:53.884744264 +0000 @@ -27,8 +27,14 @@ genTicketsUser.sample match { case Some(user) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val api = new DoobieTicketServiceApi[IO](tx) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val api = new DoobieTicketServiceApi[IO](tx) val test = for { written <- api.createOrUpdateUser(user) foundUser <- loadTicketsUser(user.uid) @@ -48,8 +54,14 @@ case (Some(user), Some(anotherUser)) => val updatedUser = anotherUser.copy(uid = user.uid) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val api = new DoobieTicketServiceApi[IO](tx) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val api = new DoobieTicketServiceApi[IO](tx) val test = for { created <- api.createOrUpdateUser(user) updated <- api.createOrUpdateUser(updatedUser) @@ -70,8 +82,14 @@ genTicketsUser.sample match { case Some(user) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val api = new DoobieTicketServiceApi[IO](tx) + val tx = Transactor.fromDriverManager[IO]( + driver = dbConfig.driver, + url = dbConfig.url, + user = dbConfig.user, + password = dbConfig.pass, + logHandler = None + ) + val api = new DoobieTicketServiceApi[IO](tx) val test = for { _ <- api.createOrUpdateUser(user) deleted <- api.deleteUser(user.uid)