diff --git a/api/src/lu/foyer/App.scala b/api/src/lu/foyer/App.scala index 8463a3c..0a4020b 100644 --- a/api/src/lu/foyer/App.scala +++ b/api/src/lu/foyer/App.scala @@ -61,19 +61,19 @@ object App extends ZIOAppDefault: override def run = app.provide( Server.default, JwtScalaTokenService.live, - CommandEngine.layer[ClientCommand, ClientEvent, ClientState], - CommandEngine.layer[ContractCommand, ContractEvent, ContractState], - ClientHandlers.layer, - ContractHandlers.layer, - ClientReducer.layer, - ContractReducer.layer, - ClientEventRepositoryInMemory.layer, - ContractEventRepositoryInMemory.layer, - ClientStateRepositoryInMemory.layer, - ContractStateRepositoryInMemory.layer, - ClientController.layer, - ContractController.layer, - PremiumServiceImpl.layer, - EmployeeServiceImpl.layer + CommandEngine.live[ClientCommand, ClientEvent, ClientState], + CommandEngine.live[ContractCommand, ContractEvent, ContractState], + ClientHandlers.live, + ContractHandlers.live, + ClientReducer.live, + ContractReducer.live, + ClientEventRepositoryInMemory.live, + ContractEventRepositoryInMemory.live, + ClientStateRepositoryInMemory.live, + ContractStateRepositoryInMemory.live, + ClientController.live, + ContractController.live, + PremiumServiceImpl.live, + EmployeeServiceImpl.live ) end App diff --git a/api/src/lu/foyer/CommandEngineController.scala b/api/src/lu/foyer/CommandEngineController.scala index c0f677d..2a8f01a 100644 --- a/api/src/lu/foyer/CommandEngineController.scala +++ b/api/src/lu/foyer/CommandEngineController.scala @@ -7,8 +7,6 @@ import zio.http.codec.PathCodec.path import zio.http.endpoint.* import zio.schema.* -import lu.foyer.auth.UserInfo - trait CommandEngineController[Command, Event: Schema, State: Schema] extends JsonApiController: def commandEngine: CommandEngine[Command, Event, State] diff --git a/api/src/lu/foyer/clients/ClientController.scala b/api/src/lu/foyer/clients/ClientController.scala index cfba862..26351f1 100644 --- a/api/src/lu/foyer/clients/ClientController.scala +++ b/api/src/lu/foyer/clients/ClientController.scala @@ -10,4 +10,4 @@ class ClientController(val commandEngine: CommandEngine[ClientCommand, ClientEve override val allEntities = List("clients", "contracts") object ClientController: - val layer = ZLayer.fromFunction(ClientController.apply) + val live = ZLayer.fromFunction(ClientController.apply) diff --git a/api/src/lu/foyer/clients/ClientEventRepositoryInMemory.scala b/api/src/lu/foyer/clients/ClientEventRepositoryInMemory.scala index 4ca8796..bb9df95 100644 --- a/api/src/lu/foyer/clients/ClientEventRepositoryInMemory.scala +++ b/api/src/lu/foyer/clients/ClientEventRepositoryInMemory.scala @@ -19,4 +19,4 @@ class ClientEventRepositoryInMemory(events: Ref[Map[String, Event[ClientEvent]]] ) object ClientEventRepositoryInMemory: - val layer = ZLayer.fromZIO(Ref.make(Map.empty).map(ClientEventRepositoryInMemory(_))) + val live = ZLayer.fromZIO(Ref.make(Map.empty).map(ClientEventRepositoryInMemory(_))) diff --git a/api/src/lu/foyer/clients/ClientStateRepositoryInMemory.scala b/api/src/lu/foyer/clients/ClientStateRepositoryInMemory.scala index fdb9fc6..d41d254 100644 --- a/api/src/lu/foyer/clients/ClientStateRepositoryInMemory.scala +++ b/api/src/lu/foyer/clients/ClientStateRepositoryInMemory.scala @@ -8,4 +8,4 @@ class ClientStateRepositoryInMemory(clients: Ref[Map[String, Entity[ClientState] with InMemoryRepository[Entity[ClientState]](clients) object ClientStateRepositoryInMemory: - val layer = ZLayer.fromZIO(Ref.make(Map.empty).map(ClientStateRepositoryInMemory(_))) + val live = ZLayer.fromZIO(Ref.make(Map.empty).map(ClientStateRepositoryInMemory(_))) diff --git a/api/src/lu/foyer/contracts/ContractController.scala b/api/src/lu/foyer/contracts/ContractController.scala index 1eda322..3bf969f 100644 --- a/api/src/lu/foyer/contracts/ContractController.scala +++ b/api/src/lu/foyer/contracts/ContractController.scala @@ -11,4 +11,4 @@ class ContractController( override val allEntities = List("clients", "contracts") object ContractController: - val layer = ZLayer.fromFunction(ContractController.apply) + val live = ZLayer.fromFunction(ContractController.apply) diff --git a/api/src/lu/foyer/contracts/ContractEventRepositoryInMemory.scala b/api/src/lu/foyer/contracts/ContractEventRepositoryInMemory.scala index c9881cd..16d56b7 100644 --- a/api/src/lu/foyer/contracts/ContractEventRepositoryInMemory.scala +++ b/api/src/lu/foyer/contracts/ContractEventRepositoryInMemory.scala @@ -19,4 +19,4 @@ class ContractEventRepositoryInMemory(events: Ref[Map[String, Event[ContractEven ) object ContractEventRepositoryInMemory: - val layer = ZLayer.fromZIO(Ref.make(Map.empty).map(ContractEventRepositoryInMemory(_))) + val live = ZLayer.fromZIO(Ref.make(Map.empty).map(ContractEventRepositoryInMemory(_))) diff --git a/api/src/lu/foyer/contracts/ContractStateRepositoryInMemory.scala b/api/src/lu/foyer/contracts/ContractStateRepositoryInMemory.scala index fa3ee64..1bdc200 100644 --- a/api/src/lu/foyer/contracts/ContractStateRepositoryInMemory.scala +++ b/api/src/lu/foyer/contracts/ContractStateRepositoryInMemory.scala @@ -8,4 +8,4 @@ class ContractStateRepositoryInMemory(clients: Ref[Map[String, Entity[ContractSt with InMemoryRepository[Entity[ContractState]](clients) object ContractStateRepositoryInMemory: - val layer = ZLayer.fromZIO(Ref.make(Map.empty).map(ContractStateRepositoryInMemory(_))) + val live = ZLayer.fromZIO(Ref.make(Map.empty).map(ContractStateRepositoryInMemory(_))) diff --git a/api/src/lu/foyer/contracts/EmployeeServiceImpl.scala b/api/src/lu/foyer/contracts/EmployeeServiceImpl.scala index faf96bd..7c2740f 100644 --- a/api/src/lu/foyer/contracts/EmployeeServiceImpl.scala +++ b/api/src/lu/foyer/contracts/EmployeeServiceImpl.scala @@ -16,4 +16,4 @@ object EmployeeServiceImpl extends EmployeeService: ) else Left("Invalid Employee") - val layer = ZLayer.succeed(EmployeeServiceImpl) + val live = ZLayer.succeed(EmployeeServiceImpl) diff --git a/api/src/lu/foyer/contracts/PremiumServiceImpl.scala b/api/src/lu/foyer/contracts/PremiumServiceImpl.scala index b90f122..884023b 100644 --- a/api/src/lu/foyer/contracts/PremiumServiceImpl.scala +++ b/api/src/lu/foyer/contracts/PremiumServiceImpl.scala @@ -50,5 +50,5 @@ object PremiumServiceImpl extends PremiumService: ) ) - val layer = ZLayer.succeed(PremiumServiceImpl) + val live = ZLayer.succeed(PremiumServiceImpl) end PremiumServiceImpl diff --git a/core/src/lu/foyer/EventSourcing.scala b/core/src/lu/foyer/EventSourcing.scala index c4b0bc3..27a0557 100644 --- a/core/src/lu/foyer/EventSourcing.scala +++ b/core/src/lu/foyer/EventSourcing.scala @@ -92,5 +92,5 @@ class CommandEngine[Command, Event, State]( end CommandEngine object CommandEngine: - def layer[Command: Tag, Event: Tag, State: Tag] = + def live[Command: Tag, Event: Tag, State: Tag] = ZLayer.fromFunction(CommandEngine[Command, Event, State](_, _, _, _)) diff --git a/core/src/lu/foyer/clients/ClientHandlers.scala b/core/src/lu/foyer/clients/ClientHandlers.scala index 4d9c122..f6ae059 100644 --- a/core/src/lu/foyer/clients/ClientHandlers.scala +++ b/core/src/lu/foyer/clients/ClientHandlers.scala @@ -4,7 +4,7 @@ package clients import zio.* object ClientHandlers: - val layer: ULayer[List[CommandHandler[ClientCommand, ClientEvent, ClientState]]] = + val live: ULayer[List[CommandHandler[ClientCommand, ClientEvent, ClientState]]] = ZLayer.succeed( List( CreateHandler, diff --git a/core/src/lu/foyer/clients/ClientReducer.scala b/core/src/lu/foyer/clients/ClientReducer.scala index 1188b02..039678d 100644 --- a/core/src/lu/foyer/clients/ClientReducer.scala +++ b/core/src/lu/foyer/clients/ClientReducer.scala @@ -13,4 +13,4 @@ class ClientReducer() extends Reducer[ClientEvent, ClientState]: case (s: ClientState.Actif, _: ClientEvent.Disabled) => s.disable() object ClientReducer: - val layer: ULayer[Reducer[ClientEvent, ClientState]] = ZLayer.succeed(ClientReducer()) + val live: ULayer[Reducer[ClientEvent, ClientState]] = ZLayer.succeed(ClientReducer()) diff --git a/core/src/lu/foyer/contracts/ContractHandlers.scala b/core/src/lu/foyer/contracts/ContractHandlers.scala index 087c9da..d2c682e 100644 --- a/core/src/lu/foyer/contracts/ContractHandlers.scala +++ b/core/src/lu/foyer/contracts/ContractHandlers.scala @@ -7,7 +7,7 @@ import lu.foyer.auth.UserInfo import lu.foyer.clients.* object ContractHandlers: - val layer = + val live = ZLayer.fromFunction( ( clientStateRepo: StateRepository[ClientState], diff --git a/core/src/lu/foyer/contracts/ContractReducer.scala b/core/src/lu/foyer/contracts/ContractReducer.scala index 136edd0..28a278b 100644 --- a/core/src/lu/foyer/contracts/ContractReducer.scala +++ b/core/src/lu/foyer/contracts/ContractReducer.scala @@ -23,4 +23,4 @@ class ContractReducer() extends Reducer[ContractEvent, ContractState]: case (s: ContractState.PendingAmendment, _: ContractEvent.Terminated) => s.terminate() object ContractReducer: - val layer: ULayer[Reducer[ContractEvent, ContractState]] = ZLayer.succeed(ContractReducer()) + val live: ULayer[Reducer[ContractEvent, ContractState]] = ZLayer.succeed(ContractReducer())