Fakultas Ilmu Komputer UI

Commit eb4727ae authored by Muhammad Rafif Elfazri's avatar Muhammad Rafif Elfazri
Browse files

Add get_by_username

parent 28814338
......@@ -46,6 +46,19 @@ defmodule Diskuy.Account do
def get_by_email!(email), do: Repo.get_by(User, email: email)
def get_by_username(username) do
case Repo.get_by(User, username: username) do
nil ->
{:error, :not_found}
user ->
{:ok, user}
def get_by_username!(username), do: Repo.get_by(User, username: username)
@doc """
Creates a user.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment