zf

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

commit 19eb84f3d69908b511d997bcad736d80ad5534dd
parent eff8673f22099d54eff951d7f582df3518a87011
Author: srfsh <dev@srf.sh>
Date:   Mon, 18 Jul 2022 15:06:50 +0300

vf/person: require admin key from the middleware

Diffstat:
Msrc/zenflows/vf/person/resolv.ex | 11++++-------
Msrc/zenflows/vf/person/type.ex | 8--------
2 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/src/zenflows/vf/person/resolv.ex b/src/zenflows/vf/person/resolv.ex @@ -1,16 +1,14 @@ defmodule Zenflows.VF.Person.Resolv do @moduledoc "Resolvers of Persons." -alias Zenflows.Admin alias Zenflows.VF.{Agent, Person, Person.Domain} def person(%{id: id}, _info) do {:ok, Domain.by_id(id)} end -def create_person(%{admin_key: key, person: params}, _info) do - with :ok <- Admin.auth(key), - {:ok, per} <- Domain.create(params) do +def create_person(%{person: params}, _info) do + with {:ok, per} <- Domain.create(params) do {:ok, %{agent: per}} end end @@ -21,9 +19,8 @@ def update_person(%{person: %{id: id} = params}, _info) do end end -def delete_person(%{admin_key: key, id: id}, _info) do - with :ok <- Admin.auth(key), - {:ok, _} <- Domain.delete(id) do +def delete_person(%{id: id}, _info) do + with {:ok, _} <- Domain.delete(id) do {:ok, true} end end diff --git a/src/zenflows/vf/person/type.ex b/src/zenflows/vf/person/type.ex @@ -116,10 +116,6 @@ object :mutation_person do @desc "Registers a new (human) person with the collaboration space." field :create_person, non_null(:person_response) do arg :person, non_null(:person_create_params) - - @desc "The configuration-defined key to authenticate admin calls." - arg :admin_key, non_null(:string) - resolve &Resolv.create_person/2 end @@ -135,10 +131,6 @@ object :mutation_person do """ field :delete_person, non_null(:boolean) do arg :id, non_null(:id) - - @desc "The configuration-defined key to authenticate admin calls." - arg :admin_key, non_null(:string) - resolve &Resolv.delete_person/2 end end