Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
package sample2
import usecase.create.CreateUserOutput.UserNameConflict
import usecase.create.{CreateUserInput, CreateUserOutput, CreateUserUseCase}
class CreateUserInteractor(
userNameConflictValidator: UserNameConflictValidator,
userRepository: UserRepository
) extends CreateUserUseCase {
override def handle(input: CreateUserInput): CreateUserOutput = {
val newUser: User[NotValid] = User.create(
// userRepository.insert(newUser) <--- ここでinsertしようとすると Type mismatch でエラーになる
newUser.validate(userNameConflictValidator) match {
case Left(_) => UserNameConflict(
case Right(validUser) =>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment