NEW: user accounts (#3)

This commit is contained in:
Matthew Ryan Dillon 2020-06-13 19:12:02 -07:00 committed by GitHub
parent d02c491028
commit 9990771c18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 1640 additions and 207 deletions

View file

@ -0,0 +1,20 @@
defmodule Mix.Tasks.Planner.Register do
use Mix.Task
alias Planner.Accounts
@shortdoc "Register a new Planner user"
def run([email, password]) do
Mix.Task.run("app.start")
case Accounts.register_user(%{email: email, password: password}) do
{:ok, _} ->
Mix.shell().info("User created successfully.")
{:error, %Ecto.Changeset{} = changeset} ->
IO.inspect(changeset)
Mix.shell().error("There was a problem.")
end
end
end