zf

zenflows testing
git clone https://s.sonu.ch/~srfsh/zf.git
Log | Files | Refs | Submodules | README | LICENSE

commit 7d48e0bb16461a3bce5416b6e99b0130fa115182
parent c27088c9037840715530ce5d2b4d1a772381dbfa
Author: srfsh <dev@srf.sh>
Date:   Fri, 28 Oct 2022 14:27:28 +0300

Zenflows.VF.Person.Domain: use id instead of email, and fix bugs

Diffstat:
Msrc/zenflows/vf/person/domain.ex | 9+++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/zenflows/vf/person/domain.ex b/src/zenflows/vf/person/domain.ex @@ -54,13 +54,14 @@ def exists?(conds) do where(Person, ^conds) |> where(type: :per) |> Repo.exists?() end -@spec pubkey(Keyword.t()) :: {:ok, String.t()} | {:error, String.t()} -def pubkey(email) do - where(Person, email: ^email) +@spec pubkey(id()) :: {:ok, String.t()} | {:error, String.t()} +def pubkey(id) do + where(Person, id: ^id) + |> where(type: :per) |> select([:eddsa_public_key]) |> Repo.one() |> case do nil -> {:error, "not found"} - found -> {:ok, found.eddsa_public_key} + %{eddsa_public_key: pkey} -> {:ok, pkey} end end