diff --git a/modules/doobie/src/main/scala/DoobieCQRSRepository.scala b/modules/doobie/src/main/scala/DoobieCQRSRepository.scala index bf370f40..698d1ab1 100644 --- a/modules/doobie/src/main/scala/DoobieCQRSRepository.scala +++ b/modules/doobie/src/main/scala/DoobieCQRSRepository.scala @@ -85,6 +85,8 @@ private final class DoobieCQRSRepository[F[_]: Concurrent: Clock, S, N]( .fromFoldable(events.map((_, ctx.address, now, ctx.metadata))) .fold(FC.unit)(n => o.insertAll(n.toList).assertInserted(n.size)) + _ <- NonEmptyChain.fromChain(events).fold(FC.unit)(handler) + _ <- cmds.insert(ctx).run.assertInserted } yield ()