Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
package first
import first.usecase.{CreateUserInput, CreateUserOutput, CreateUserUseCase}
final class CreateUserInteractor(userService: UserService, userRepository: UserRepository) extends CreateUserUseCase {
override def handle(input: CreateUserInput): CreateUserOutput = {
val newUser = User.create(
userService.exists(newUser) match { // このバリデーションが必ず必要だが、知らないとできない。
case Left(_) => CreateUserOutput.UserNameConflict(
case Right(_) =>
val insertedUser = userRepository.insert(newUser)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment