fix credo check for is_admin?
This commit is contained in:
parent
5d146ce6af
commit
e843014502
@ -404,15 +404,15 @@ defmodule Cannery.Accounts do
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
iex> is_admin?(%User{role: :admin})
|
iex> admin?(%User{role: :admin})
|
||||||
true
|
true
|
||||||
|
|
||||||
iex> is_admin?(%User{})
|
iex> admin?(%User{})
|
||||||
false
|
false
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec is_admin?(User.t()) :: boolean()
|
@spec admin?(User.t()) :: boolean()
|
||||||
def is_admin?(%User{id: user_id}) do
|
def admin?(%User{id: user_id}) do
|
||||||
Repo.exists?(from u in User, where: u.id == ^user_id, where: u.role == :admin)
|
Repo.exists?(from u in User, where: u.id == ^user_id, where: u.role == :admin)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user