Created
April 5, 2022 06:12
-
-
Save supermanue/e0351dd2a146efea0638ec2a63ac3c0d to your computer and use it in GitHub Desktop.
User in apdater layer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import zio.experiment.domain.model.AppError | |
import zio.experiment.domain.model.User.{ User => UserDomain } | |
case class User(id: Int, name: String) | |
object User { | |
implicit class UserConversions(user: User) { | |
def toDomainUser: Either[AppError, UserDomain] = | |
UserDomain.build(user.id, user.name) | |
} | |
def fromDomainUser(domainUser: UserDomain): User = | |
User(domainUser.id.value, domainUser.name.value) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment