Open amywong-monster opened 4 years ago
Thanks @amywong-monster for the review.
Incorporated your first two comments.
The service layer is already in traits. The "accessors" are defined in a package object as suggested in https://zio.dev/docs/howto/howto_use_layers
trait UserService {
def get(id: Long): Task[User]
def getAll: Task[List[User]]
def create(user: User): Task[User]
def delete(id: Long): Task[Boolean]
def update(user: User): Task[Boolean]
}
trait AccountService {
def getAccount(id: String): Task[Account]
def getAllAccounts: Task[List[Account]]
def createAccount(account: Account): Task[Account]
def deleteAccount(id: String): Task[Boolean]
def updateAccount(account: Account): Task[Boolean]
}
@rkoti-monster Sorry for my late reply. I didn't do anything over the weekend. It looks good and I learned a lot. Some comment
Server.runServer
, change return type toZIO[AppEnvironment, Throwable, ExitCode]
and mapbindHttp
ExitCode
tozio.ExitCode
HelloServiceSpec
, the check can be simplified asUserServiceSpec
can be simplified asAbout the service layer, given its functions are effectful, just wonder can it be a trait of something like
so that it can be mocked or whatever