Created
July 2, 2020 03:15
-
-
Save mchavezi/6c0df32bad97ca0dd8e1269802b60bef to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule MyApp.Registration do | |
| @moduledoc """ | |
| The Registration context. | |
| """ | |
| alias MyApp.Subdomain.Accounts | |
| alias MyApp.Orgs | |
| def create(attrs) do | |
| case Orgs.register_org(attrs) do | |
| {:ok, org} -> | |
| case Accounts.register_user(attrs) do | |
| {:ok, user} -> {:ok, user} | |
| {:error, %Ecto.Changeset{} = changeset} -> {:error, changeset} | |
| end | |
| {:error, %Ecto.Changeset{} = changeset} -> {:error, changeset} | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment