type.ex (3275B)
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.ScenarioDefinition.Type do 19 @moduledoc false 20 21 use Absinthe.Schema.Notation 22 23 alias Zenflows.VF.ScenarioDefinition.Resolv 24 25 @name """ 26 An informal or formal textual identifier for a scenario definition. 27 Does not imply uniqueness. 28 """ 29 @note "A textual description or comment." 30 @has_duration """ 31 The planned calendar duration of the process as defined for the recipe 32 batch. 33 """ 34 35 @desc "The type definition of one or more scenarios, such as Yearly Budget." 36 object :scenario_definition do 37 field :id, non_null(:id) 38 39 @desc @name 40 field :name, non_null(:string) 41 42 @desc @has_duration 43 field :has_duration, :duration, resolve: &Resolv.has_duration/3 44 45 @desc @note 46 field :note, :string 47 end 48 49 input_object :scenario_definition_create_params do 50 @desc @name 51 field :name, non_null(:string) 52 53 @desc @note 54 field :note, :string 55 56 @desc @has_duration 57 field :has_duration, :iduration 58 end 59 60 input_object :scenario_definition_update_params do 61 field :id, non_null(:id) 62 63 @desc @name 64 field :name, :string 65 66 @desc @note 67 field :note, :string 68 69 @desc @has_duration 70 field :has_duration, :iduration 71 end 72 73 object :scenario_definition_response do 74 field :scenario_definition, non_null(:scenario_definition) 75 end 76 77 object :scenario_definition_edge do 78 field :cursor, non_null(:id) 79 field :node, non_null(:scenario_definition) 80 end 81 82 object :scenario_definition_connection do 83 field :page_info, non_null(:page_info) 84 field :edges, non_null(list_of(non_null(:scenario_definition_edge))) 85 end 86 87 object :query_scenario_definition do 88 field :scenario_definition, :scenario_definition do 89 arg :id, non_null(:id) 90 resolve &Resolv.scenario_definition/2 91 end 92 93 field :scenario_definitions, :scenario_definition_connection do 94 arg :first, :integer 95 arg :after, :id 96 arg :last, :integer 97 arg :before, :id 98 resolve &Resolv.scenario_definitions/2 99 end 100 end 101 102 object :mutation_scenario_definition do 103 field :create_scenario_definition, non_null(:scenario_definition_response) do 104 arg :scenario_definition, non_null(:scenario_definition_create_params) 105 resolve &Resolv.create_scenario_definition/2 106 end 107 108 field :update_scenario_definition, non_null(:scenario_definition_response) do 109 arg :scenario_definition, non_null(:scenario_definition_update_params) 110 resolve &Resolv.update_scenario_definition/2 111 end 112 113 field :delete_scenario_definition, non_null(:boolean) do 114 arg :id, non_null(:id) 115 resolve &Resolv.delete_scenario_definition/2 116 end 117 end 118 end