type.ex (2353B)
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.ProposedIntent.Type do 19 @moduledoc false 20 21 use Absinthe.Schema.Notation 22 23 alias Zenflows.VF.ProposedIntent.Resolv 24 25 @desc """ 26 Represents many-to-many relationships between Proposals and Intents, 27 supporting including intents in multiple proposals, as well as a proposal 28 including multiple intents. 29 """ 30 object :proposed_intent do 31 field :id, non_null(:id) 32 33 @desc """ 34 This is a reciprocal intent of this proposal, not primary. Not meant 35 to be used for intent matching. 36 """ 37 field :reciprocal, non_null(:boolean) 38 39 @desc "The published proposal which this intent is part of." 40 field :published_in, non_null(:proposal), resolve: &Resolv.published_in/3 41 42 @desc "The intent which is part of this published proposal." 43 field :publishes, non_null(:intent), resolve: &Resolv.publishes/3 44 end 45 46 object :proposed_intent_response do 47 field :proposed_intent, non_null(:proposed_intent) 48 end 49 50 object :mutation_proposed_intent do 51 @desc""" 52 Include an existing intent as part of a proposal. 53 @param publishedIn the (`Proposal`) to include the intent in 54 @param publishes the (`Intent`) to include as part of the proposal 55 """ 56 field :propose_intent, non_null(:proposed_intent_response) do 57 arg :published_in_id, non_null(:id), name: "published_in" 58 arg :publishes_id, non_null(:id), name: "publishes" 59 arg :reciprocal, :boolean 60 resolve &Resolv.propose_intent/2 61 end 62 63 field :delete_proposed_intent, non_null(:boolean) do 64 arg :id, non_null(:id) 65 resolve &Resolv.delete_proposed_intent/2 66 end 67 end 68 end