execute

Executes the user registration process.

This method checks if a user with the given ID already exists. If the user is not registered, it saves the user and their credentials into the respective repositories. If an error occurs during the process, it returns a failure result.

Return

A RegisterUserResult indicating the outcome of the registration process:

  • UserIsAlreadyRegistered if the user already exists.

  • Success if the user and credentials are successfully saved.

  • Failure if an error occurs during the process.

Parameters

user

The user entity to be registered.

credentials

The credentials associated with the user.