type.ex (3285B)
1 # Zenflows is designed to implement the Valueflows vocabulary, 2 # written and maintained by srfsh <info@dyne.org>. 3 # Copyright (C) 2021-2023 Dyne.org foundation <foundation@dyne.org>. 4 # 5 # This program is free software: you can redistribute it and/or modify 6 # it under the terms of the GNU Affero General Public License as published by 7 # the Free Software Foundation, either version 3 of the License, or 8 # (at your option) any later version. 9 # 10 # This program is distributed in the hope that it will be useful, 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 # GNU Affero General Public License for more details. 14 # 15 # You should have received a copy of the GNU Affero General Public License 16 # along with this program. If not, see <https://www.gnu.org/licenses/>. 17 18 defmodule Zenflows.VF.Plan.Type do 19 @moduledoc false 20 21 use Absinthe.Schema.Notation 22 23 alias Zenflows.VF.Plan.Resolv 24 25 @name """ 26 An informal or formal textual identifier for a plan. Does not imply 27 uniqueness. 28 """ 29 @note "A textual description or comment." 30 @created "The time the plan was made." 31 @due "The time the plan is expected to be complete." 32 @deletable "The plan is able to be deleted or not." 33 @refinement_of "This plan refines a scenario, making it operational." 34 @refinement_of_id "(`Scenario`) #{@refinement_of}" 35 36 @desc """ 37 A logical collection of processes that constitute a body of planned work 38 with defined deliverable(s). 39 """ 40 object :plan do 41 field :id, non_null(:id) 42 43 @desc @name 44 field :name, non_null(:string) 45 46 @desc @note 47 field :note, :string 48 49 @desc @created 50 field :created, non_null(:datetime), resolve: &Resolv.created/3 51 52 @desc @due 53 field :due, :datetime 54 55 @desc @deletable 56 field :deletable, non_null(:boolean) 57 58 @desc @refinement_of 59 field :refinement_of, :scenario, resolve: &Resolv.refinement_of/3 60 end 61 62 input_object :plan_create_params do 63 @desc @name 64 field :name, non_null(:string) 65 66 @desc @note 67 field :note, :string 68 69 @desc @due 70 field :due, :datetime 71 72 @desc @refinement_of_id 73 field :refinement_of_id, :id, name: "refinement_of" 74 end 75 76 input_object :plan_update_params do 77 field :id, non_null(:id) 78 79 @desc @name 80 field :name, :string 81 82 @desc @note 83 field :note, :string 84 85 @desc @due 86 field :due, :datetime 87 88 @desc @refinement_of_id 89 field :refinement_of_id, :id, name: "refinement_of" 90 end 91 92 object :plan_response do 93 field :plan, non_null(:plan) 94 end 95 96 object :plan_edge do 97 field :cursor, non_null(:id) 98 field :node, non_null(:plan) 99 end 100 101 object :plan_connection do 102 field :page_info, non_null(:page_info) 103 field :edges, non_null(list_of(non_null(:plan_edge))) 104 end 105 106 object :query_plan do 107 field :plan, :plan do 108 arg :id, non_null(:id) 109 resolve &Resolv.plan/2 110 end 111 112 field :plans, :plan_connection do 113 arg :first, :integer 114 arg :after, :id 115 arg :last, :integer 116 arg :before, :id 117 resolve &Resolv.plans/2 118 end 119 end 120 121 object :mutation_plan do 122 field :create_plan, non_null(:plan_response) do 123 arg :plan, non_null(:plan_create_params) 124 resolve &Resolv.create_plan/2 125 end 126 127 field :update_plan, non_null(:plan_response) do 128 arg :plan, non_null(:plan_update_params) 129 resolve &Resolv.update_plan/2 130 end 131 132 field :delete_plan, non_null(:boolean) do 133 arg :id, non_null(:id) 134 resolve &Resolv.delete_plan/2 135 end 136 end 137 end