arch-atlas

Register Use Case

domain/usecases

domain

Overview

Creates a new account from a registration payload (email, password, displayName) and returns the freshly-issued User on success.

User Flow

  1. Controller builds RegisterParams from the form.
  2. Use case enforces password strength + email format.
  3. Calls AuthRepository.register(payload).
  4. Repository POSTs to /auth/signup, caches the returned token and user.
  5. Returns Either<AuthFailure, User>.

Cases & Edge Cases

  • Email already taken → Left(AuthFailure.emailInUse) (HTTP 409).
  • Server-side validation rejection → Left(AuthFailure.serverValidation(messages)).
  • Network failure after token issued but before cache write — handled idempotently on next boot.

Code References

  • lib/features/auth/domain/usecases/register_usecase.dart

API Calls

Empty — fill this in later. Open the manifest and add content here.

Notes

Mirrors LoginUseCase intentionally — same shape, same return type — so the controller can reuse the same Either-handling helper.