commit e95ce996732720a7b53a6464e7fecda4a1c5aba9
parent c3015c0e36a381e547eb401b57aa7dd5b9506ddf
Author: Alberto Lerda <albertolerda97@gmail.com>
Date: Tue, 25 Oct 2022 09:23:31 +0200
Zenflows.VF.Person: Return just a string
Diffstat:
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/zenflows/vf/person/domain.ex b/src/zenflows/vf/person/domain.ex
@@ -54,13 +54,13 @@ def exists?(conds) do
where(Person, ^conds) |> Repo.exists?()
end
-@spec pubkey(Keyword.t()) :: {:ok, Person.t()} | {:error, chgset()}
+@spec pubkey(Keyword.t()) :: {:ok, String.t()} | {:error, chgset()}
def pubkey(email) do
where(Person, email: ^email)
|> select([:eddsa_public_key]) |> Repo.one()
|> case do
nil -> {:error, "not found"}
- found -> {:ok, found}
+ found -> {:ok, found.eddsa_public_key}
end
end
diff --git a/src/zenflows/vf/person/type.ex b/src/zenflows/vf/person/type.ex
@@ -188,7 +188,7 @@ object :query_person do
resolve &Resolv.person_exists/2
end
@desc "Retrieve a person from the email (if a person with that email exists)"
- field :person_pubkey, :person_pubkey do
+ field :person_pubkey, :string do
meta only_guest?: true
arg :email, non_null(:string)
resolve &Resolv.person_pubkey/2