[day-02] add context to create/get a user
Create context module to create and fetch a user.
This commit is contained in:
9
lib/wabanex/users/create.ex
Normal file
9
lib/wabanex/users/create.ex
Normal file
@@ -0,0 +1,9 @@
|
||||
defmodule Wabanex.Users.Create do
|
||||
alias Wabanex.{Repo, User}
|
||||
|
||||
def call(params) do
|
||||
params
|
||||
|> User.changeset()
|
||||
|> Repo.insert()
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user