type.ex (4969B)
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.Process.Type do 19 @moduledoc false 20 21 use Absinthe.Schema.Notation 22 23 alias Zenflows.VF.Process.Resolv 24 25 @name """ 26 An informal or formal textual identifier for a process. Does not imply 27 uniqueness. 28 """ 29 @note "A textual description or comment." 30 @has_beginning "The planned beginning of the process." 31 @has_end "The planned end of the process." 32 @finished """ 33 The process is complete or not. This is irrespective of if the original 34 goal has been met, and indicates that no more will be done. 35 """ 36 @deletable """ 37 The process can be safely deleted, has no dependent information. 38 """ 39 @classified_as """ 40 References one or more concepts in a common taxonomy or other 41 classification scheme for purposes of categorization or grouping. 42 """ 43 @based_on "The definition or specification for a process." 44 @based_on_id "(`ProcesssSpecification`) #{@based_on}" 45 @planned_within """ 46 The process with its inputs and outputs is part of the plan. 47 """ 48 @planned_within_id "(`Plan`) #{@planned_within}" 49 @nested_in """ 50 The process with its inputs and outputs is part of the scenario. 51 """ 52 @nested_in_id "(`Scenario`) #{@nested_in}" 53 54 @desc """ 55 A logical collection of processes that constitute a body of processned work 56 with defined deliverable(s). 57 """ 58 object :process do 59 field :id, non_null(:id) 60 61 @desc @name 62 field :name, non_null(:string) 63 64 @desc @note 65 field :note, :string 66 67 @desc @has_beginning 68 field :has_beginning, :datetime 69 70 @desc @has_end 71 field :has_end, :datetime 72 73 @desc @finished 74 field :finished, non_null(:boolean) 75 76 @desc @deletable 77 field :deletable, non_null(:boolean) 78 79 @desc @classified_as 80 field :classified_as, list_of(non_null(:uri)) 81 82 @desc @based_on 83 field :based_on, :process_specification, 84 resolve: &Resolv.based_on/3 85 86 @desc @planned_within 87 field :planned_within, :plan, 88 resolve: &Resolv.planned_within/3 89 90 @desc @nested_in 91 field :nested_in, :scenario, resolve: &Resolv.nested_in/3 92 93 field :previous, list_of(non_null(:economic_event)), 94 resolve: &Resolv.previous/3 95 end 96 97 input_object :process_create_params do 98 @desc @name 99 field :name, non_null(:string) 100 101 @desc @note 102 field :note, :string 103 104 @desc @has_beginning 105 field :has_beginning, :datetime 106 107 @desc @has_end 108 field :has_end, :datetime 109 110 @desc @finished 111 field :finished, :boolean 112 113 @desc @classified_as 114 field :classified_as, list_of(non_null(:uri)) 115 116 @desc @based_on_id 117 field :based_on_id, :id, name: "based_on" 118 119 @desc @planned_within_id 120 field :planned_within_id, :id, name: "planned_within" 121 122 @desc @nested_in_id 123 field :nested_in_id, :id, name: "nested_in" 124 end 125 126 input_object :process_update_params do 127 field :id, non_null(:id) 128 129 @desc @name 130 field :name, :string 131 132 @desc @note 133 field :note, :string 134 135 @desc @has_beginning 136 field :has_beginning, :datetime 137 138 @desc @has_end 139 field :has_end, :datetime 140 141 @desc @finished 142 field :finished, :boolean 143 144 @desc @classified_as 145 field :classified_as, list_of(non_null(:uri)) 146 147 @desc @based_on_id 148 field :based_on_id, :id, name: "based_on" 149 150 @desc @planned_within_id 151 field :planned_within_id, :id, name: "planned_within" 152 153 @desc @nested_in_id 154 field :nested_in_id, :id, name: "nested_in" 155 end 156 157 object :process_response do 158 field :process, non_null(:process) 159 end 160 161 object :process_edge do 162 field :cursor, non_null(:id) 163 field :node, non_null(:process) 164 end 165 166 object :process_connection do 167 field :page_info, non_null(:page_info) 168 field :edges, non_null(list_of(non_null(:process_edge))) 169 end 170 171 object :query_process do 172 field :process, :process do 173 arg :id, non_null(:id) 174 resolve &Resolv.process/2 175 end 176 177 field :processes, :process_connection do 178 arg :first, :integer 179 arg :after, :id 180 arg :last, :integer 181 arg :before, :id 182 resolve &Resolv.processes/2 183 end 184 end 185 186 object :mutation_process do 187 field :create_process, non_null(:process_response) do 188 arg :process, non_null(:process_create_params) 189 resolve &Resolv.create_process/2 190 end 191 192 field :update_process, non_null(:process_response) do 193 arg :process, non_null(:process_update_params) 194 resolve &Resolv.update_process/2 195 end 196 197 field :delete_process, non_null(:boolean) do 198 arg :id, non_null(:id) 199 resolve &Resolv.delete_process/2 200 end 201 end 202 end