zf

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

commit 1ec3042ecb11b6421d76353d89c627e582bea115
parent 67827930bfc282e1e6542b8e823067f3e7378f8d
Author: srfsh <dev@srf.sh>
Date:   Sun, 21 Aug 2022 20:04:41 +0300

Zenflows.Vf.Plan.{Type,Resolv}: use the id to generate the created field

Since we switched to ULIDs, we don't use :insterted_at for this.

Diffstat:
Msrc/zenflows/vf/plan/resolv.ex | 14+++++++++-----
Msrc/zenflows/vf/plan/type.ex | 2+-
2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/zenflows/vf/plan/resolv.ex b/src/zenflows/vf/plan/resolv.ex @@ -22,6 +22,15 @@ use Absinthe.Schema.Notation alias Zenflows.VF.{Plan, Plan.Domain} +def created(%{id: id}, _, _) do + Zenflows.DB.ID.ts(id) +end + +def refinement_of(%Plan{} = plan, _args, _info) do + plan = Domain.preload(plan, :refinement_of) + {:ok, plan.refinement_of} +end + def plan(%{id: id}, _info) do Domain.one(id) end @@ -43,9 +52,4 @@ def delete_plan(%{id: id}, _info) do {:ok, true} end end - -def refinement_of(%Plan{} = plan, _args, _info) do - plan = Domain.preload(plan, :refinement_of) - {:ok, plan.refinement_of} -end end diff --git a/src/zenflows/vf/plan/type.ex b/src/zenflows/vf/plan/type.ex @@ -46,7 +46,7 @@ object :plan do field :note, :string @desc @created - field :inserted_at, non_null(:datetime), name: "created" + field :created, non_null(:datetime), resolve: &Resolv.created/3 @desc @due field :due, :datetime