type.ex (2831B)
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.RecipeExchange.Type do 19 @moduledoc false 20 21 use Absinthe.Schema.Notation 22 23 alias Zenflows.VF.RecipeExchange.Resolv 24 25 @name """ 26 An informal or formal textual identifier for a recipe exchange. Does not 27 imply uniqueness. 28 """ 29 @note "A textual description or comment." 30 31 @desc "Specifies an exchange agreement as part of a recipe." 32 object :recipe_exchange do 33 field :id, non_null(:id) 34 35 @desc @name 36 field :name, non_null(:string) 37 38 @desc @note 39 field :note, :string 40 end 41 42 input_object :recipe_exchange_create_params do 43 @desc @name 44 field :name, non_null(:string) 45 46 @desc @note 47 field :note, :string 48 end 49 50 input_object :recipe_exchange_update_params do 51 field :id, non_null(:id) 52 53 @desc @name 54 field :name, :string 55 56 @desc @note 57 field :note, :string 58 end 59 60 object :recipe_exchange_response do 61 field :recipe_exchange, non_null(:recipe_exchange) 62 end 63 64 object :recipe_exchange_edge do 65 field :cursor, non_null(:id) 66 field :node, non_null(:recipe_exchange) 67 end 68 69 object :recipe_exchange_connection do 70 field :page_info, non_null(:page_info) 71 field :edges, non_null(list_of(non_null(:recipe_exchange_edge))) 72 end 73 74 object :query_recipe_exchange do 75 field :recipe_exchange, :recipe_exchange do 76 arg :id, non_null(:id) 77 resolve &Resolv.recipe_exchange/2 78 end 79 80 field :recipe_exchanges, :recipe_exchange_connection do 81 arg :first, :integer 82 arg :after, :id 83 arg :last, :integer 84 arg :before, :id 85 resolve &Resolv.recipe_exchanges/2 86 end 87 end 88 89 object :mutation_recipe_exchange do 90 field :create_recipe_exchange, non_null(:recipe_exchange_response) do 91 arg :recipe_exchange, non_null(:recipe_exchange_create_params) 92 resolve &Resolv.create_recipe_exchange/2 93 end 94 95 field :update_recipe_exchange, non_null(:recipe_exchange_response) do 96 arg :recipe_exchange, non_null(:recipe_exchange_update_params) 97 resolve &Resolv.update_recipe_exchange/2 98 end 99 100 field :delete_recipe_exchange, non_null(:boolean) do 101 arg :id, non_null(:id) 102 resolve &Resolv.delete_recipe_exchange/2 103 end 104 end 105 end