zf

zenflows testing
git clone https://s.sonu.ch/~srfsh/zf.git
Log | Files | Refs | Submodules | README | LICENSE

type.ex (2722B)


      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.Agreement.Type do
     19 @moduledoc false
     20 
     21 use Absinthe.Schema.Notation
     22 
     23 alias Zenflows.VF.Agreement.Resolv
     24 
     25 @name """
     26 An informal or formal textual identifier for an agreement.  Does not
     27 imply uniqueness.
     28 """
     29 @note "A textual description or comment."
     30 @created "The date and time the agreement was created."
     31 
     32 @desc ""
     33 object :agreement do
     34 	field :id, non_null(:id)
     35 
     36 	@desc @name
     37 	field :name, non_null(:string)
     38 
     39 	@desc @note
     40 	field :note, :string
     41 
     42 	@desc @created
     43 	field :created, non_null(:datetime), resolve: &Resolv.created/3
     44 end
     45 
     46 input_object :agreement_create_params do
     47 	@desc @name
     48 	field :name, non_null(:string)
     49 
     50 	@desc @note
     51 	field :note, :string
     52 end
     53 
     54 input_object :agreement_update_params do
     55 	field :id, non_null(:id)
     56 
     57 	@desc @name
     58 	field :name, :string
     59 
     60 	@desc @note
     61 	field :note, :string
     62 end
     63 
     64 object :agreement_response do
     65 	field :agreement, non_null(:agreement)
     66 end
     67 
     68 object :agreement_edge do
     69 	field :cursor, non_null(:id)
     70 	field :node, non_null(:agreement)
     71 end
     72 
     73 object :agreement_connection do
     74 	field :page_info, non_null(:page_info)
     75 	field :edges, non_null(list_of(non_null(:agreement_edge)))
     76 end
     77 
     78 object :query_agreement do
     79 	field :agreement, :agreement do
     80 		arg :id, non_null(:id)
     81 		resolve &Resolv.agreement/2
     82 	end
     83 
     84 	field :agreements, :agreement_connection do
     85 		arg :first, :integer
     86 		arg :after, :id
     87 		arg :last, :integer
     88 		arg :before, :id
     89 		resolve &Resolv.agreements/2
     90 	end
     91 end
     92 
     93 object :mutation_agreement do
     94 	field :create_agreement, non_null(:agreement_response) do
     95 		arg :agreement, non_null(:agreement_create_params)
     96 		resolve &Resolv.create_agreement/2
     97 	end
     98 
     99 	field :update_agreement, non_null(:agreement_response) do
    100 		arg :agreement, non_null(:agreement_update_params)
    101 		resolve &Resolv.update_agreement/2
    102 	end
    103 
    104 	field :delete_agreement, non_null(:boolean) do
    105 		arg :id, non_null(:id)
    106 		resolve &Resolv.delete_agreement/2
    107 	end
    108 end
    109 end