~wegtam/smederee

Showing details for patch d03cdb66d48854eb00fdf664282fd938a7663d70.
2024-09-26 (Thu), 4:33 PM - Jens Grassel - d03cdb66d48854eb00fdf664282fd938a7663d70

Chore: migrate from Quicklens to the Monocle optics library.

Summary of changes
2 files modified with 14 lines added and 6 lines removed
  • build.sbt with 5 added and 3 removed lines
  • modules/hub/src/test/scala/de/smederee/tickets/DoobieTicketRepositoryTest.scala with 9 added and 3 removed lines
diff -rN -u old-smederee/build.sbt new-smederee/build.sbt
--- old-smederee/build.sbt	2024-11-22 16:04:33.928005956 +0000
+++ new-smederee/build.sbt	2024-11-22 16:04:33.928005956 +0000
@@ -164,10 +164,11 @@
                 library.jclOverSlf4j, // Bridge Java Commons Logging to SLF4J.
                 library.log4catsSlf4j,
                 library.logback,
+                library.monocleCore,
+                library.monocleMacro,
                 library.osLib,
                 library.postgresql,
                 library.pureConfig,
-                library.quickLens,
                 library.springSecurityCrypto,
                 library.munit            % Test,
                 library.munitCatsEffect  % Test,
@@ -289,13 +290,13 @@
             val laika            = "1.2.0"
             val log4cats         = "2.7.0"
             val logback          = "1.5.8"
+            val monocle          = "3.3.0"
             val munit            = "1.0.2"
             val munitCatsEffect  = "2.0.0"
             val munitScalaCheck  = "1.0.0"
             val osLib            = "0.10.7"
             val postgresql       = "42.7.4"
             val pureConfig       = "0.17.7"
-            val quickLens        = "1.9.9"
             val scalaCheck       = "1.18.1"
             val scalaCheckEffect = "1.0.4"
             val simpleJavaMail   = "8.11.3"
@@ -330,13 +331,14 @@
         val laikaCore            = "org.typelevel"               %% "laika-core"                 % Version.laika
         val log4catsSlf4j        = "org.typelevel"               %% "log4cats-slf4j"             % Version.log4cats
         val logback              = "ch.qos.logback"               % "logback-classic"            % Version.logback
+        val monocleCore          = "dev.optics"                  %% "monocle-core"               % Version.monocle
+        val monocleMacro         = "dev.optics"                  %% "monocle-macro"              % Version.monocle
         val munit                = "org.scalameta"               %% "munit"                      % Version.munit
         val munitCatsEffect      = "org.typelevel"               %% "munit-cats-effect"          % Version.munitCatsEffect
         val munitScalaCheck      = "org.scalameta"               %% "munit-scalacheck"           % Version.munitScalaCheck
         val osLib                = "com.lihaoyi"                 %% "os-lib"                     % Version.osLib
         val postgresql           = "org.postgresql"               % "postgresql"                 % Version.postgresql
         val pureConfig           = "com.github.pureconfig"       %% "pureconfig-core"            % Version.pureConfig
-        val quickLens            = "com.softwaremill.quicklens"  %% "quicklens"                  % Version.quickLens
         val scalaCheck           = "org.scalacheck"              %% "scalacheck"                 % Version.scalaCheck
         val scalaCheckEffect     = "org.typelevel"               %% "scalacheck-effect-munit"    % Version.scalaCheckEffect
         val simpleJavaMail       = "org.simplejavamail"           % "simple-java-mail"           % Version.simpleJavaMail
diff -rN -u old-smederee/modules/hub/src/test/scala/de/smederee/tickets/DoobieTicketRepositoryTest.scala new-smederee/modules/hub/src/test/scala/de/smederee/tickets/DoobieTicketRepositoryTest.scala
--- old-smederee/modules/hub/src/test/scala/de/smederee/tickets/DoobieTicketRepositoryTest.scala	2024-11-22 16:04:33.928005956 +0000
+++ new-smederee/modules/hub/src/test/scala/de/smederee/tickets/DoobieTicketRepositoryTest.scala	2024-11-22 16:04:33.928005956 +0000
@@ -12,10 +12,11 @@
 import cats.data.NonEmptyList
 import cats.effect.*
 import cats.syntax.all.*
-import com.softwaremill.quicklens.*
 import de.smederee.TestTags.*
 import de.smederee.tickets.Generators.given
 import doobie.*
+import monocle.*
+import monocle.syntax.all.*
 
 import org.scalacheck.effect.PropF
 
@@ -674,8 +675,13 @@
             ) =>
                 // Avoid time zone trouble.
                 val comments = genComments.toList
-                    .modifyAll(_.each.createdAt, _.each.updatedAt)
-                    .using(_.withOffsetSameInstant(ZoneOffset.UTC))
+                    .focus(_.each)
+                    .modify(comment =>
+                        comment.copy(
+                            createdAt = comment.createdAt.withOffsetSameInstant(ZoneOffset.UTC),
+                            updatedAt = comment.updatedAt.withOffsetSameInstant(ZoneOffset.UTC)
+                        )
+                    )
                 val project  = generatedProject.copy(owner = owner)
                 val dbConfig = configuration.database
                 val tx = Transactor.fromDriverManager[IO](