commit 83cca6d89c63f735390affc786621ae6ef38a824 parent a8c1af03c2f28450002b78aca886148d83267f6b Author: srfsh <dev@srf.sh> Date: Thu, 28 Jul 2022 13:44:07 +0300 Zenflows.VF.Person.Domain: add a call to check existing emails Diffstat:
M | src/zenflows/vf/person/domain.ex | | | 5 | +++++ |
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/zenflows/vf/person/domain.ex b/src/zenflows/vf/person/domain.ex @@ -40,6 +40,11 @@ def by_user(repo \\ Repo, user) do repo.get_by(Person, user: user, type: :per) end +@spec exists_email(String.t()) :: boolean() +def exists_email(email) do + where(Person, email: ^email) |> Repo.exists?() +end + @spec all() :: [Person.t()] def all() do Person