code_corps v0.0.1 CodeCorps.Services.UserService View Source

Handles CRUD operations for users.

When operations happen on CodeCorps.User, we need to make sure changes are propagated to related records, ex., CodeCorps.StripePlatformCustomer and CodeCorps.StripeConnectCustomer

Link to this section Summary

Link to this section Functions

Link to this function update(user, attributes) View Source

Updates a CodeCorps.User record and, if necessary, associated CodeCorps.StripePlatformCustomer and CodeCorps.StripeConnectCustomer records.

These related records inherit the email field from the user, so they need to be kept in sync, both locally, and on the Stripe platform.

Returns one of:

  • {:ok, %CodeCorps.User{}, nil, nil}
  • {:ok, %CodeCorps.User{}, %CodeCorps.StripePlatformCustomer{}, nil}
  • {:ok, %CodeCorps.User{}, %CodeCorps.StripePlatformCustomer{}, %CodeCorps.StripeConnectCustomer{}}
  • {:error, %Ecto.Changeset{}}
  • {:error, :unhandled}