zf

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

type.ex (2890B)


      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.RoleBehavior.Type do
     19 @moduledoc false
     20 
     21 use Absinthe.Schema.Notation
     22 
     23 alias Zenflows.VF.RoleBehavior.Resolv
     24 
     25 @name """
     26 An informal or formal textual identifier for a role behavior.  Does not
     27 imply uniqueness.
     28 """
     29 @note "A textual description or comment."
     30 
     31 @desc """
     32 The general shape or behavior grouping of an agent relationship role.
     33 """
     34 object :role_behavior do
     35 	field :id, non_null(:id)
     36 
     37 	@desc @name
     38 	field :name, non_null(:string)
     39 
     40 	@desc @note
     41 	field :note, :string
     42 end
     43 
     44 input_object :role_behavior_create_params do
     45 	@desc @name
     46 	field :name, non_null(:string)
     47 
     48 	@desc @note
     49 	field :note, :string
     50 end
     51 
     52 input_object :role_behavior_update_params do
     53 	field :id, non_null(:id)
     54 
     55 	@desc @name
     56 	field :name, :string
     57 
     58 	@desc @note
     59 	field :note, :string
     60 end
     61 
     62 object :role_behavior_response do
     63 	field :role_behavior, non_null(:role_behavior)
     64 end
     65 
     66 object :role_behavior_edge do
     67 	field :cursor, non_null(:id)
     68 	field :node, non_null(:role_behavior)
     69 end
     70 
     71 object :role_behavior_connection do
     72 	field :page_info, non_null(:page_info)
     73 	field :edges, non_null(list_of(non_null(:role_behavior_edge)))
     74 end
     75 
     76 object :query_role_behavior do
     77 	field :role_behavior, :role_behavior do
     78 		arg :id, non_null(:id)
     79 		resolve &Resolv.role_behavior/2
     80 	end
     81 
     82 	field :role_behaviors, :role_behavior_connection do
     83 		arg :first, :integer
     84 		arg :after, :id
     85 		arg :last, :integer
     86 		arg :before, :id
     87 		resolve &Resolv.role_behaviors/2
     88 	end
     89 end
     90 
     91 object :mutation_role_behavior do
     92 	@desc "Creates a role behavior."
     93 	field :create_role_behavior, non_null(:role_behavior_response) do
     94 		arg :role_behavior, non_null(:role_behavior_create_params)
     95 		resolve &Resolv.create_role_behavior/2
     96 	end
     97 
     98 	@desc "Updates a role behavior."
     99 	field :update_role_behavior, non_null(:role_behavior_response) do
    100 		arg :role_behavior, non_null(:role_behavior_update_params)
    101 		resolve &Resolv.update_role_behavior/2
    102 	end
    103 
    104 	@desc "Deletes a role behavior."
    105 	field :delete_role_behavior, non_null(:boolean) do
    106 		arg :id, non_null(:id)
    107 		resolve &Resolv.delete_role_behavior/2
    108 	end
    109 end
    110 end