From e8430145025e1ee0c7d20c3639beb39ef3194e6e Mon Sep 17 00:00:00 2001 From: shibao Date: Fri, 23 Feb 2024 21:13:34 -0500 Subject: [PATCH] fix credo check for is_admin? --- lib/cannery/accounts.ex | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/cannery/accounts.ex b/lib/cannery/accounts.ex index a94d72b..ccac032 100644 --- a/lib/cannery/accounts.ex +++ b/lib/cannery/accounts.ex @@ -404,15 +404,15 @@ defmodule Cannery.Accounts do ## Examples - iex> is_admin?(%User{role: :admin}) + iex> admin?(%User{role: :admin}) true - iex> is_admin?(%User{}) + iex> admin?(%User{}) false """ - @spec is_admin?(User.t()) :: boolean() - def is_admin?(%User{id: user_id}) do + @spec admin?(User.t()) :: boolean() + def admin?(%User{id: user_id}) do Repo.exists?(from u in User, where: u.id == ^user_id, where: u.role == :admin) end