Skip to content

Instantly share code, notes, and snippets.

@theboreddev
Created October 10, 2022 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theboreddev/0a99c83d8b76dc4bb3c0d2740638ac47 to your computer and use it in GitHub Desktop.
Save theboreddev/0a99c83d8b76dc4bb3c0d2740638ac47 to your computer and use it in GitHub Desktop.
class UserService(private val userRepository: UserRepository, private val eventsEngine: UserEventsEngine) {
fun create(user: User): User {
val savedUser = userRepository.save(user)
eventsEngine.send(UserCreated(UUID.randomUUID().toString(), user))
return User.create(savedUser)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment