ecoportal-api-graphql 0.1.11 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -10
  3. data/ecoportal-api-graphql.gemspec +1 -1
  4. data/lib/ecoportal/api/common/graphql/query_integration.rb +5 -4
  5. data/lib/ecoportal/api/graphql/base/location_node.rb +15 -0
  6. data/lib/ecoportal/api/graphql/base/location_structure.rb +21 -0
  7. data/lib/ecoportal/api/graphql/base.rb +2 -10
  8. data/lib/ecoportal/api/graphql/builder/location_structure.rb +29 -0
  9. data/lib/ecoportal/api/graphql/builder.rb +10 -0
  10. data/lib/ecoportal/api/graphql/connection/action.rb +1 -1
  11. data/lib/ecoportal/api/graphql/connection/contractor_entity.rb +1 -1
  12. data/lib/ecoportal/api/graphql/connection/person_member.rb +1 -1
  13. data/lib/ecoportal/api/graphql/error/locations_error.rb +13 -0
  14. data/lib/ecoportal/api/graphql/error/locations_validation_error.rb +11 -0
  15. data/lib/ecoportal/api/graphql/{base → error}/validation_errors.rb +1 -1
  16. data/lib/ecoportal/api/graphql/error.rb +12 -0
  17. data/lib/ecoportal/api/graphql/fragment/location_node.rb +20 -0
  18. data/lib/ecoportal/api/graphql/fragment.rb +1 -1
  19. data/lib/ecoportal/api/graphql/helpers/{tag_tree.rb → locations_tree.rb} +10 -3
  20. data/lib/ecoportal/api/graphql/helpers.rb +1 -1
  21. data/lib/ecoportal/api/graphql/input/contractor_entity/create.rb +16 -0
  22. data/lib/ecoportal/api/graphql/input/contractor_entity/destroy.rb +13 -0
  23. data/lib/ecoportal/api/graphql/input/{update_contractor_entity.rb → contractor_entity/update.rb} +1 -1
  24. data/lib/ecoportal/api/graphql/input/contractor_entity.rb +14 -0
  25. data/lib/ecoportal/api/graphql/{base/id_diff_input.rb → input/id_diff.rb} +2 -2
  26. data/lib/ecoportal/api/graphql/input/location_structure/apply_commands.rb +48 -0
  27. data/lib/ecoportal/api/graphql/input/location_structure/archive_command.rb +13 -0
  28. data/lib/ecoportal/api/graphql/input/location_structure/command_interface.rb +26 -0
  29. data/lib/ecoportal/api/graphql/input/location_structure/delete_command.rb +13 -0
  30. data/lib/ecoportal/api/graphql/input/location_structure/insert_command.rb +13 -0
  31. data/lib/ecoportal/api/graphql/input/location_structure/move_command.rb +14 -0
  32. data/lib/ecoportal/api/graphql/input/location_structure/reorder_command.rb +13 -0
  33. data/lib/ecoportal/api/graphql/input/location_structure/unarchive_command.rb +13 -0
  34. data/lib/ecoportal/api/graphql/input/location_structure/update_command.rb +14 -0
  35. data/lib/ecoportal/api/graphql/input/location_structure.rb +20 -0
  36. data/lib/ecoportal/api/graphql/input.rb +3 -3
  37. data/lib/ecoportal/api/graphql/{base → logic}/connection.rb +1 -1
  38. data/lib/ecoportal/api/graphql/{base → logic}/mutation.rb +10 -1
  39. data/lib/ecoportal/api/graphql/{base → logic}/payload.rb +2 -2
  40. data/lib/ecoportal/api/graphql/{base → logic}/query.rb +3 -2
  41. data/lib/ecoportal/api/graphql/{base → logic}/query_array.rb +2 -2
  42. data/lib/ecoportal/api/graphql/{base → logic}/query_connection.rb +3 -3
  43. data/lib/ecoportal/api/graphql/logic.rb +15 -0
  44. data/lib/ecoportal/api/graphql/model/location_node.rb +11 -0
  45. data/lib/ecoportal/api/graphql/model/{tag_tree.rb → location_structure.rb} +2 -2
  46. data/lib/ecoportal/api/graphql/model/organization.rb +2 -2
  47. data/lib/ecoportal/api/graphql/model.rb +2 -2
  48. data/lib/ecoportal/api/graphql/mutation/contractor_entity/create.rb +40 -0
  49. data/lib/ecoportal/api/graphql/mutation/contractor_entity.rb +14 -0
  50. data/lib/ecoportal/api/graphql/mutation/location_structure/apply_commands.rb +61 -0
  51. data/lib/ecoportal/api/graphql/mutation/location_structure.rb +12 -0
  52. data/lib/ecoportal/api/graphql/mutation.rb +2 -1
  53. data/lib/ecoportal/api/graphql/payload/contractor_entity/create.rb +13 -0
  54. data/lib/ecoportal/api/graphql/payload/contractor_entity/destroy.rb +12 -0
  55. data/lib/ecoportal/api/graphql/payload/contractor_entity/update.rb +12 -0
  56. data/lib/ecoportal/api/graphql/payload/contractor_entity.rb +14 -0
  57. data/lib/ecoportal/api/graphql/payload/location_structure/apply_commands.rb +25 -0
  58. data/lib/ecoportal/api/graphql/payload/location_structure/command_execution_result.rb +15 -0
  59. data/lib/ecoportal/api/graphql/payload/location_structure/command_interface.rb +14 -0
  60. data/lib/ecoportal/api/graphql/payload/location_structure.rb +14 -0
  61. data/lib/ecoportal/api/graphql/payload.rb +2 -3
  62. data/lib/ecoportal/api/graphql/query/actions.rb +1 -1
  63. data/lib/ecoportal/api/graphql/query/contractor_entities.rb +1 -1
  64. data/lib/ecoportal/api/graphql/query/{tag_tree.rb → location_structure.rb} +12 -8
  65. data/lib/ecoportal/api/graphql/query/location_structures.rb +46 -0
  66. data/lib/ecoportal/api/graphql/query.rb +2 -2
  67. data/lib/ecoportal/api/graphql.rb +9 -2
  68. data/lib/ecoportal/api/graphql_version.rb +1 -1
  69. data/tests/loc_structure_get.rb +11 -0
  70. data/tests/loc_structure_update.rb +51 -0
  71. data/tests/loc_structures_get.rb +15 -0
  72. data/tests/local_libs.rb +2 -2
  73. metadata +58 -32
  74. data/lib/ecoportal/api/graphql/base/tag_tree.rb +0 -20
  75. data/lib/ecoportal/api/graphql/base/tag_tree_node.rb +0 -13
  76. data/lib/ecoportal/api/graphql/fragment/tag_tree_node.rb +0 -16
  77. data/lib/ecoportal/api/graphql/input/create_contractor_entity.rb +0 -14
  78. data/lib/ecoportal/api/graphql/input/destroy_contractor_entity.rb +0 -11
  79. data/lib/ecoportal/api/graphql/model/tag_tree_node.rb +0 -10
  80. data/lib/ecoportal/api/graphql/mutation/create_contractor_entity.rb +0 -38
  81. data/lib/ecoportal/api/graphql/payload/create_contractor_entity.rb +0 -11
  82. data/lib/ecoportal/api/graphql/payload/destroy_contractor_entity.rb +0 -10
  83. data/lib/ecoportal/api/graphql/payload/update_contractor_entity.rb +0 -10
  84. data/lib/ecoportal/api/graphql/query/tag_trees.rb +0 -37
  85. data/tests/tagtree_get.rb +0 -7
  86. data/tests/tagtrees_get.rb +0 -7
  87. /data/tests/{create_contractor_entity.rb → contractor_entity_create.rb} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f2fc73626ffb4955b88d20778e32206ad4b989fc47bcc6abbdaf748c035244a6
4
- data.tar.gz: c00e9f570f81de6520ef738c8cd059dbfb6d80fe18613599d2a6f7ad53556416
3
+ metadata.gz: 56e997e7d33caae3a3a1bf496d213ba3647c1184122639091edf011575458787
4
+ data.tar.gz: ef337365f05a6dee924d31e5719d0639eb0f9192e512aa668e6fe6734fe819ea
5
5
  SHA512:
6
- metadata.gz: 04477f6f4c8014bccd9f1fc93625f031991e0f0bd979af476ec859f1802832726686a06f1dfa665c9d0ec8762d38eb03aa5bb621a51a28112b513b0b80ef7f37
7
- data.tar.gz: 249e23c774b1ee031c18d7e53a5be53948c3bf7f5bfffcb2fe4d679a4ab249d81ab59498878a0e2b209720cf6e0b556fef555b0d8dab1bf710be4b2dd243b0d4
6
+ metadata.gz: e54ca789c32d646416e4bcc7e83d774347573a9dd5702ed538bf9bd6f7bca87a69ebe0291e737ad151672c231a8e3e26ce2e80a94742785751a9525881e8877b
7
+ data.tar.gz: 0d3e30f27e5fb00ff5951e6149235916f4636d987a742cae12c41c2a1c0ff009c8074b32765e726d7effb188d837d762df9a4fe32d922e90d1f58a8268e8c111
data/CHANGELOG.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
- ## [0.1.13] - 2022-11-xx
4
+ ## [0.2.3] - 2022-11-xx
5
5
 
6
6
  ### Added
7
7
  ### Changed
@@ -13,24 +13,30 @@ All notable changes to this project will be documented in this file.
13
13
  - Analyse how to "DSL" currentOrganization.action.activities
14
14
  - review `path` tracking
15
15
 
16
- ## [0.1.12] - 2022-11-xx
16
+ ## [0.2.2] - 2023-02-24
17
17
 
18
- ### Added
19
- - `Ecoportal::API::GraphQL::Base::Mutation`
20
- - Added `createContractorEntity`
18
+ ### Fixed
19
+ - Build gem correctly
20
+
21
+ ## [0.2.1] - 2023-02-24
21
22
 
22
23
  ### Changed
23
- - Slight internal refactor of `Ecoportal::API::GraphQL::Base::Query`
24
- - Upgraded `ecoportal-api-v2` **gem** dependency
24
+ - Migrate from TagTrees to **reporting structures** (breaking change)
25
+
26
+ ### Added
27
+ - Basics for reporting structure mutations
25
28
 
26
- ## [0.1.11] - 2022-11-02
29
+ ## [0.1.11] - 2022-11-29
27
30
 
28
31
  ### Added
32
+ - `Ecoportal::API::GraphQL::Base::Mutation`
33
+ - Added `createContractorEntity`
34
+
29
35
  ### Changed
30
36
  - **upgraded** `graphlient` gem dependency (support for framents)
31
37
  - removed patch in this gem
32
-
33
- ### Fixed
38
+ - Slight internal refactor of `Ecoportal::API::GraphQL::Base::Query`
39
+ - Upgraded `ecoportal-api-v2` **gem** dependency
34
40
 
35
41
  ## [0.1.10] - 2022-09-29
36
42
 
@@ -29,6 +29,6 @@ Gem::Specification.new do |spec|
29
29
  spec.add_development_dependency "redcarpet", ">= 3.5.1", "< 3.6"
30
30
  spec.add_development_dependency "pry" , ">= 0.14"
31
31
 
32
- spec.add_dependency 'ecoportal-api-v2', '>= 0.9.7', '< 0.10'
32
+ spec.add_dependency 'ecoportal-api-v2', '>= 1.0.1', '< 1.1'
33
33
  spec.add_dependency 'graphlient', '>= 0.7.0', '< 0.8'
34
34
  end
@@ -13,7 +13,7 @@ module Ecoportal
13
13
  # The $1 query integration
14
14
  # @return [Collection::$1, $1]
15
15
  # @return [Connection::$1, $1]
16
- def query(method, query_klass:)
16
+ def query(method, query_klass:, subpath: [])
17
17
  method = method.to_sym
18
18
  class_method = "#{method}_query_class".to_sym
19
19
 
@@ -26,11 +26,12 @@ module Ecoportal
26
26
  end
27
27
 
28
28
  define_method(class_method) do
29
+ final_path = path + [subpath].flatten.compact
29
30
  resolve_class(query_klass).tap do |klass|
30
- unless klass <= Ecoportal::API::GraphQL::Base::Query
31
- raise "Expected query_klass to be of type Ecoportal::API::GraphQL::Base::Query. Given: #{klass}"
31
+ unless klass <= Ecoportal::API::GraphQL::Logic::Query
32
+ raise "Expected query_klass to be of type Ecoportal::API::GraphQL::Logic::Query. Given: #{klass}"
32
33
  end
33
- end.new(client, base_path: path)
34
+ end.new(client, base_path: final_path)
34
35
  end
35
36
  private class_method
36
37
  end
@@ -0,0 +1,15 @@
1
+ module Ecoportal
2
+ module API
3
+ class GraphQL
4
+ module Base
5
+ class LocationNode < Ecoportal::API::GraphQL::Base::Model
6
+ passkey :id
7
+ passthrough :name, :parent, :parentId
8
+ passthrough :weight
9
+ embeds_one :parent, klass: Base::LocationNode, nullable: true
10
+ passboolean :archived
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,21 @@
1
+ module Ecoportal
2
+ module API
3
+ class GraphQL
4
+ module Base
5
+ class LocationStructure < Ecoportal::API::GraphQL::Base::Model
6
+ extend Ecoportal::API::GraphQL::Helpers::LocationsTree
7
+
8
+ passkey :id
9
+ passthrough :name, :weight
10
+ passboolean :archived, :published, :visitorManagementEnabled
11
+ embeds_many :nodes, klass: Ecoportal::API::GraphQL::Base::LocationNode, order_key: :weight
12
+ passthrough :draft
13
+
14
+ def treeify
15
+ self.class.treeify(nodes)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -9,17 +9,9 @@ end
9
9
 
10
10
  require 'ecoportal/api/graphql/base/model'
11
11
  require 'ecoportal/api/graphql/base/date_time'
12
- require 'ecoportal/api/graphql/base/id_diff_input'
13
12
  require 'ecoportal/api/graphql/base/page_info'
14
- require 'ecoportal/api/graphql/base/query'
15
- require 'ecoportal/api/graphql/base/mutation'
16
- require 'ecoportal/api/graphql/base/connection'
17
- require 'ecoportal/api/graphql/base/query_array'
18
- require 'ecoportal/api/graphql/base/query_connection'
19
- require 'ecoportal/api/graphql/base/validation_errors'
20
- require 'ecoportal/api/graphql/base/payload'
21
- require 'ecoportal/api/graphql/base/tag_tree_node'
22
- require 'ecoportal/api/graphql/base/tag_tree'
13
+ require 'ecoportal/api/graphql/base/location_node'
14
+ require 'ecoportal/api/graphql/base/location_structure'
23
15
  require 'ecoportal/api/graphql/base/person_member'
24
16
  require 'ecoportal/api/graphql/base/file_attachment'
25
17
  require 'ecoportal/api/graphql/base/file_container'
@@ -0,0 +1,29 @@
1
+ module Ecoportal
2
+ module API
3
+ class GraphQL
4
+ module Builder
5
+ class LocationStructure
6
+ attr_reader :client
7
+
8
+ def initialize(client)
9
+ @client = client
10
+ end
11
+
12
+ def applyCommandsInput
13
+ Ecoportal::API::GraphQL::Input::LocationStructure::ApplyCommands.new
14
+ end
15
+
16
+ def applyCommands(**kargs, &block)
17
+ applyCommandsMutation.query(**kargs, &block)
18
+ end
19
+
20
+ private
21
+
22
+ def applyCommandsMutation
23
+ Ecoportal::API::GraphQL::Mutation::LocationStructure::ApplyCommands.new(client)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,10 @@
1
+ module Ecoportal
2
+ module API
3
+ class GraphQL
4
+ module Builder
5
+ end
6
+ end
7
+ end
8
+ end
9
+
10
+ require 'ecoportal/api/graphql/builder/location_structure'
@@ -2,7 +2,7 @@ module Ecoportal
2
2
  module API
3
3
  class GraphQL
4
4
  module Connection
5
- class Action < Ecoportal::API::GraphQL::Base::Connection
5
+ class Action < Ecoportal::API::GraphQL::Logic::Connection
6
6
  class_resolver :node_class, Ecoportal::API::GraphQL::Model::Action
7
7
  end
8
8
  end
@@ -2,7 +2,7 @@ module Ecoportal
2
2
  module API
3
3
  class GraphQL
4
4
  module Connection
5
- class ContractorEntity < Ecoportal::API::GraphQL::Base::Connection
5
+ class ContractorEntity < Ecoportal::API::GraphQL::Logic::Connection
6
6
  class_resolver :node_class, Ecoportal::API::GraphQL::Model::ContractorEntity
7
7
  end
8
8
  end
@@ -2,7 +2,7 @@ module Ecoportal
2
2
  module API
3
3
  class GraphQL
4
4
  module Connection
5
- class PersonMemberConnection < Ecoportal::API::GraphQL::Base::Connection
5
+ class PersonMemberConnection < Ecoportal::API::GraphQL::Logic::Connection
6
6
  class_resolver :node_class, Ecoportal::API::GraphQL::Model::PersonMember
7
7
  end
8
8
  end
@@ -0,0 +1,13 @@
1
+ module Ecoportal
2
+ module API
3
+ class GraphQL
4
+ module Error
5
+ class LocationsError < Ecoportal::API::GraphQL::Base::Model
6
+ passthrough :message, :conflictingIds
7
+ passthrough :type
8
+ embeds_many :validationErrors, klass: Ecoportal::API::GraphQL::Error::LocationsValidationError
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,11 @@
1
+ module Ecoportal
2
+ module API
3
+ class GraphQL
4
+ module Error
5
+ class LocationsValidationError < Ecoportal::API::GraphQL::Base::Model
6
+ passthrough :error, :message, :property
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -1,7 +1,7 @@
1
1
  module Ecoportal
2
2
  module API
3
3
  class GraphQL
4
- module Base
4
+ module Error
5
5
  class ValidationErrors < Ecoportal::API::GraphQL::Base::Model
6
6
  include Enumerable
7
7
 
@@ -0,0 +1,12 @@
1
+ module Ecoportal
2
+ module API
3
+ class GraphQL
4
+ module Error
5
+ end
6
+ end
7
+ end
8
+ end
9
+
10
+ require 'ecoportal/api/graphql/error/locations_validation_error'
11
+ require 'ecoportal/api/graphql/error/validation_errors'
12
+ require 'ecoportal/api/graphql/error/locations_error'
@@ -0,0 +1,20 @@
1
+ module Ecoportal
2
+ module API
3
+ class GraphQL
4
+ class Fragment
5
+ fragment :LocationNode, <<~'GRAPHQL'
6
+ fragment on LocationNodeInterface {
7
+ id
8
+ name
9
+ weight
10
+ archived
11
+ parent {
12
+ id
13
+ name
14
+ }
15
+ }
16
+ GRAPHQL
17
+ end
18
+ end
19
+ end
20
+ end
@@ -47,6 +47,6 @@ module Ecoportal
47
47
  end
48
48
 
49
49
  require 'ecoportal/api/graphql/fragment/pagination'
50
- require 'ecoportal/api/graphql/fragment/tag_tree_node'
50
+ require 'ecoportal/api/graphql/fragment/location_node'
51
51
  require 'ecoportal/api/graphql/fragment/action'
52
52
  require 'ecoportal/api/graphql/fragment/contractor_entity'
@@ -2,10 +2,14 @@ module Ecoportal
2
2
  module API
3
3
  class GraphQL
4
4
  module Helpers
5
- module TagTree
5
+ module LocationsTree
6
6
  def treeify(nodes)
7
7
  parents = nodes.each_with_object({}) do |node, parents|
8
- (parents[node.parentId] ||= []).push(node)
8
+ parent = node.parent
9
+ # puts "Node '#{node.name}' with ID: '#{node.id}'. "
10
+ # puts " • Parent '#{parent.name}' with ID: '#{parent.id}'." if parent
11
+ parentId = parent && parent.id.upcase
12
+ (parents[parentId] ||= []).push(node)
9
13
  end
10
14
  get_children(nil, parents)
11
15
  end
@@ -15,7 +19,10 @@ module Ecoportal
15
19
  def get_children(node_id, parents)
16
20
  (parents[node_id] ||= []).each_with_object([]) do |child, results|
17
21
  results << {
18
- "tag" => child.tag,
22
+ "id" => child.id,
23
+ "name" => child.name,
24
+ "weight" => child.weight,
25
+ "archived" => child.archived,
19
26
  "nodes" => get_children(child.id, parents).compact
20
27
  }
21
28
  end
@@ -7,4 +7,4 @@ module Ecoportal
7
7
  end
8
8
  end
9
9
 
10
- require 'ecoportal/api/graphql/helpers/tag_tree'
10
+ require 'ecoportal/api/graphql/helpers/locations_tree'
@@ -0,0 +1,16 @@
1
+ module Ecoportal
2
+ module API
3
+ class GraphQL
4
+ module Input
5
+ module ContractorEntity
6
+ class Create < Ecoportal::API::GraphQL::Base::ContractorEntity
7
+ passthrough :clientMutationId
8
+ class_resolver :id_diff_input, "Ecoportal::API::GraphQL::Input::IdDiff"
9
+ embeds_one :associatedPeopleIds, klass: :id_diff_input
10
+ embeds_one :leadContractorIds, klass: :id_diff_input
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,13 @@
1
+ module Ecoportal
2
+ module API
3
+ class GraphQL
4
+ module Input
5
+ module ContractorEntity
6
+ class Destroy < Ecoportal::API::GraphQL::Base::Model
7
+ passkey :id
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -2,7 +2,7 @@ module Ecoportal
2
2
  module API
3
3
  class GraphQL
4
4
  module Input
5
- class UpdateContractorEntity < Ecoportal::API::GraphQL::Input::CreateContractorEntity
5
+ class Update < Ecoportal::API::GraphQL::Input::ContractorEntity::Create
6
6
  end
7
7
  end
8
8
  end
@@ -0,0 +1,14 @@
1
+ module Ecoportal
2
+ module API
3
+ class GraphQL
4
+ module Input
5
+ module ContractorEntity
6
+ end
7
+ end
8
+ end
9
+ end
10
+ end
11
+
12
+ require_relative 'contractor_entity/create'
13
+ require_relative 'contractor_entity/destroy'
14
+ require_relative 'contractor_entity/update'
@@ -1,8 +1,8 @@
1
1
  module Ecoportal
2
2
  module API
3
3
  class GraphQL
4
- module Base
5
- class IdDiffInput < Ecoportal::API::GraphQL::Base::Model
4
+ module Input
5
+ class IdDiff < Ecoportal::API::GraphQL::Base::Model
6
6
  passarray :additions, :removals
7
7
  end
8
8
  end
@@ -0,0 +1,48 @@
1
+ module Ecoportal
2
+ module API
3
+ class GraphQL
4
+ module Input
5
+ module LocationStructure
6
+ class ApplyCommands < Ecoportal::API::GraphQL::Base::Model
7
+ passkey :id
8
+ passthrough :clientMutationId
9
+ passboolean :force
10
+ embeds_many :commands, klass: Ecoportal::API::GraphQL::Input::LocationStructure::CommandInterface
11
+ passboolean :preview
12
+
13
+ def add(type, **kargs)
14
+ if command = new_command(type)
15
+ command.set_values(**kargs) unless kargs.empty?
16
+ yield(command) if block_given?
17
+ end
18
+ command
19
+ end
20
+
21
+ private
22
+
23
+ def new_command(type)
24
+ case type
25
+ when :archive
26
+ Input::LocationStructure::ArchiveCommand.new
27
+ when :unarchive
28
+ Input::LocationStructure::UnarchiveCommand.new
29
+ when :delete
30
+ Input::LocationStructure::DeleteCommand.new
31
+ when :move
32
+ Input::LocationStructure::MoveCommand.new
33
+ when :insert
34
+ Input::LocationStructure::InsertCommand.new
35
+ when :update
36
+ Input::LocationStructure::UpdateCommand.new
37
+ when :reoder
38
+ Input::LocationStructure::ReoderCommand.new
39
+ else
40
+ raise "Unknown command type: '#{type}'"
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,13 @@
1
+ module Ecoportal
2
+ module API
3
+ class GraphQL
4
+ module Input
5
+ module LocationStructure
6
+ class ArchiveCommand < Ecoportal::API::GraphQL::Input::LocationStructure::CommandInterface
7
+ passthrough :nodeId
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,26 @@
1
+ module Ecoportal
2
+ module API
3
+ class GraphQL
4
+ module Input
5
+ module LocationStructure
6
+ class CommandInterface < Ecoportal::API::GraphQL::Base::Model
7
+ passkey :id
8
+ passthrough :state
9
+
10
+ def initialize(*args, **kargs, &block)
11
+ self.id = self.class.new_uuid
12
+ super
13
+ end
14
+
15
+ def set_values(**kargs)
16
+ kargs.each do |key, value|
17
+ self.send(key, value) if self.respond_to?(key, true)
18
+ end
19
+ self
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,13 @@
1
+ module Ecoportal
2
+ module API
3
+ class GraphQL
4
+ module Input
5
+ module LocationStructure
6
+ class DeleteCommand < Ecoportal::API::GraphQL::Input::LocationStructure::CommandInterface
7
+ passthrough :nodeId
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ module Ecoportal
2
+ module API
3
+ class GraphQL
4
+ module Input
5
+ module LocationStructure
6
+ class InsertCommand < Ecoportal::API::GraphQL::Input::LocationStructure::MoveCommand
7
+ passthrough :classificationIds
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ module Ecoportal
2
+ module API
3
+ class GraphQL
4
+ module Input
5
+ module LocationStructure
6
+ class MoveCommand < Ecoportal::API::GraphQL::Input::LocationStructure::CommandInterface
7
+ passthrough :nodeId, :parentId
8
+ passthrough :insertBefore
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ module Ecoportal
2
+ module API
3
+ class GraphQL
4
+ module Input
5
+ module LocationStructure
6
+ class ReorderCommand < Ecoportal::API::GraphQL::Input::LocationStructure::CommandInterface
7
+ passthrough :parentId, :orderedIds
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ module Ecoportal
2
+ module API
3
+ class GraphQL
4
+ module Input
5
+ module LocationStructure
6
+ class UnarchiveCommand < Ecoportal::API::GraphQL::Input::LocationStructure::CommandInterface
7
+ passthrough :nodeId
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ module Ecoportal
2
+ module API
3
+ class GraphQL
4
+ module Input
5
+ module LocationStructure
6
+ class UpdateCommand < Ecoportal::API::GraphQL::Input::LocationStructure::CommandInterface
7
+ passthrough :nodeId, :newId
8
+ passthrough :name, :classificationIds
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,20 @@
1
+ module Ecoportal
2
+ module API
3
+ class GraphQL
4
+ module Input
5
+ module LocationStructure
6
+ end
7
+ end
8
+ end
9
+ end
10
+ end
11
+
12
+ require_relative 'location_structure/command_interface'
13
+ require_relative 'location_structure/delete_command'
14
+ require_relative 'location_structure/archive_command'
15
+ require_relative 'location_structure/unarchive_command'
16
+ require_relative 'location_structure/move_command'
17
+ require_relative 'location_structure/insert_command'
18
+ require_relative 'location_structure/reorder_command'
19
+ require_relative 'location_structure/update_command'
20
+ require_relative 'location_structure/apply_commands'
@@ -7,9 +7,9 @@ module Ecoportal
7
7
  end
8
8
  end
9
9
 
10
+ require 'ecoportal/api/graphql/input/id_diff'
10
11
  require 'ecoportal/api/graphql/input/search_filter'
11
12
  require 'ecoportal/api/graphql/input/search_sorter'
12
13
  require 'ecoportal/api/graphql/input/search'
13
- require 'ecoportal/api/graphql/input/create_contractor_entity'
14
- require 'ecoportal/api/graphql/input/update_contractor_entity'
15
- require 'ecoportal/api/graphql/input/destroy_contractor_entity'
14
+ require 'ecoportal/api/graphql/input/location_structure'
15
+ require 'ecoportal/api/graphql/input/contractor_entity'
@@ -1,7 +1,7 @@
1
1
  module Ecoportal
2
2
  module API
3
3
  class GraphQL
4
- module Base
4
+ module Logic
5
5
  class Connection < Ecoportal::API::GraphQL::Base::Model
6
6
  class GenericNode
7
7
  def initialize(*args, **kargs)