ecoportal-api-graphql 0.1.10 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -3
  3. data/ecoportal-api-graphql.gemspec +2 -2
  4. data/lib/ecoportal/api/common/graphql/patches.rb +1 -1
  5. data/lib/ecoportal/api/common/graphql/query_integration.rb +5 -4
  6. data/lib/ecoportal/api/graphql/base/location_node.rb +15 -0
  7. data/lib/ecoportal/api/graphql/base/location_structure.rb +21 -0
  8. data/lib/ecoportal/api/graphql/base.rb +2 -9
  9. data/lib/ecoportal/api/graphql/builder/location_structure.rb +29 -0
  10. data/lib/ecoportal/api/graphql/builder.rb +10 -0
  11. data/lib/ecoportal/api/graphql/connection/action.rb +1 -1
  12. data/lib/ecoportal/api/graphql/connection/contractor_entity.rb +1 -1
  13. data/lib/ecoportal/api/graphql/connection/person_member.rb +1 -1
  14. data/lib/ecoportal/api/graphql/error/locations_error.rb +13 -0
  15. data/lib/ecoportal/api/graphql/error/locations_validation_error.rb +11 -0
  16. data/lib/ecoportal/api/graphql/{base → error}/validation_errors.rb +1 -1
  17. data/lib/ecoportal/api/graphql/error.rb +12 -0
  18. data/lib/ecoportal/api/graphql/fragment/location_node.rb +20 -0
  19. data/lib/ecoportal/api/graphql/fragment.rb +1 -1
  20. data/lib/ecoportal/api/graphql/helpers/{tag_tree.rb → locations_tree.rb} +10 -3
  21. data/lib/ecoportal/api/graphql/helpers.rb +1 -1
  22. data/lib/ecoportal/api/graphql/input/contractor_entity/create.rb +16 -0
  23. data/lib/ecoportal/api/graphql/input/contractor_entity/destroy.rb +13 -0
  24. data/lib/ecoportal/api/graphql/input/{update_contractor_entity.rb → contractor_entity/update.rb} +1 -1
  25. data/lib/ecoportal/api/graphql/input/contractor_entity.rb +14 -0
  26. data/lib/ecoportal/api/graphql/{base/id_diff_input.rb → input/id_diff.rb} +2 -2
  27. data/lib/ecoportal/api/graphql/input/location_structure/apply_commands.rb +48 -0
  28. data/lib/ecoportal/api/graphql/input/location_structure/archive_command.rb +13 -0
  29. data/lib/ecoportal/api/graphql/input/location_structure/command_interface.rb +26 -0
  30. data/lib/ecoportal/api/graphql/input/location_structure/delete_command.rb +13 -0
  31. data/lib/ecoportal/api/graphql/input/location_structure/insert_command.rb +13 -0
  32. data/lib/ecoportal/api/graphql/input/location_structure/move_command.rb +14 -0
  33. data/lib/ecoportal/api/graphql/input/location_structure/reorder_command.rb +13 -0
  34. data/lib/ecoportal/api/graphql/input/location_structure/unarchive_command.rb +13 -0
  35. data/lib/ecoportal/api/graphql/input/location_structure/update_command.rb +14 -0
  36. data/lib/ecoportal/api/graphql/input/location_structure.rb +20 -0
  37. data/lib/ecoportal/api/graphql/input.rb +3 -3
  38. data/lib/ecoportal/api/graphql/{base → logic}/connection.rb +1 -1
  39. data/lib/ecoportal/api/graphql/logic/mutation.rb +107 -0
  40. data/lib/ecoportal/api/graphql/{base → logic}/payload.rb +2 -2
  41. data/lib/ecoportal/api/graphql/{base → logic}/query.rb +9 -5
  42. data/lib/ecoportal/api/graphql/{base → logic}/query_array.rb +2 -2
  43. data/lib/ecoportal/api/graphql/{base → logic}/query_connection.rb +3 -3
  44. data/lib/ecoportal/api/graphql/logic.rb +15 -0
  45. data/lib/ecoportal/api/graphql/model/location_node.rb +11 -0
  46. data/lib/ecoportal/api/graphql/model/{tag_tree.rb → location_structure.rb} +2 -2
  47. data/lib/ecoportal/api/graphql/model/organization.rb +2 -2
  48. data/lib/ecoportal/api/graphql/model.rb +2 -2
  49. data/lib/ecoportal/api/graphql/mutation/contractor_entity/create.rb +40 -0
  50. data/lib/ecoportal/api/graphql/mutation/contractor_entity.rb +14 -0
  51. data/lib/ecoportal/api/graphql/mutation/location_structure/apply_commands.rb +61 -0
  52. data/lib/ecoportal/api/graphql/mutation/location_structure.rb +12 -0
  53. data/lib/ecoportal/api/graphql/mutation.rb +11 -0
  54. data/lib/ecoportal/api/graphql/payload/contractor_entity/create.rb +13 -0
  55. data/lib/ecoportal/api/graphql/payload/contractor_entity/destroy.rb +12 -0
  56. data/lib/ecoportal/api/graphql/payload/contractor_entity/update.rb +12 -0
  57. data/lib/ecoportal/api/graphql/payload/contractor_entity.rb +14 -0
  58. data/lib/ecoportal/api/graphql/payload/location_structure/apply_commands.rb +25 -0
  59. data/lib/ecoportal/api/graphql/payload/location_structure/command_execution_result.rb +15 -0
  60. data/lib/ecoportal/api/graphql/payload/location_structure/command_interface.rb +14 -0
  61. data/lib/ecoportal/api/graphql/payload/location_structure.rb +14 -0
  62. data/lib/ecoportal/api/graphql/payload.rb +2 -3
  63. data/lib/ecoportal/api/graphql/query/actions.rb +1 -1
  64. data/lib/ecoportal/api/graphql/query/contractor_entities.rb +1 -1
  65. data/lib/ecoportal/api/graphql/query/{tag_tree.rb → location_structure.rb} +12 -8
  66. data/lib/ecoportal/api/graphql/query/location_structures.rb +46 -0
  67. data/lib/ecoportal/api/graphql/query.rb +2 -2
  68. data/lib/ecoportal/api/graphql.rb +19 -0
  69. data/lib/ecoportal/api/graphql_version.rb +1 -1
  70. data/tests/contractor_entity_create.rb +19 -0
  71. data/tests/loc_structure_get.rb +11 -0
  72. data/tests/loc_structure_update.rb +51 -0
  73. data/tests/loc_structures_get.rb +15 -0
  74. data/tests/local_libs.rb +2 -2
  75. metadata +68 -39
  76. data/lib/ecoportal/api/common/graphql/patches/query.rb +0 -49
  77. data/lib/ecoportal/api/graphql/base/tag_tree.rb +0 -20
  78. data/lib/ecoportal/api/graphql/base/tag_tree_node.rb +0 -13
  79. data/lib/ecoportal/api/graphql/fragment/tag_tree_node.rb +0 -16
  80. data/lib/ecoportal/api/graphql/input/create_contractor_entity.rb +0 -14
  81. data/lib/ecoportal/api/graphql/input/destroy_contractor_entity.rb +0 -11
  82. data/lib/ecoportal/api/graphql/model/tag_tree_node.rb +0 -10
  83. data/lib/ecoportal/api/graphql/payload/create_contractor_entity.rb +0 -11
  84. data/lib/ecoportal/api/graphql/payload/destroy_contractor_entity.rb +0 -10
  85. data/lib/ecoportal/api/graphql/payload/update_contractor_entity.rb +0 -10
  86. data/lib/ecoportal/api/graphql/query/tag_trees.rb +0 -37
  87. data/tests/tagtree_get.rb +0 -7
  88. data/tests/tagtrees_get.rb +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 76cdada612c878305f9e858213257fc1a9f92ebc2997ed71295b81e987344cb3
4
- data.tar.gz: 9554e3751ad19aa4de5b66d4d949f8fd77d9e5ad63c15ad2b17c1806e02d5c8b
3
+ metadata.gz: 4dd9eeecfae002b0c6e3324daaaf607a420a659e28c3356ccc4bfccad3585c68
4
+ data.tar.gz: 4b20881fe6cf9870bc718cbf2d9f0c97d532ea140c9d08278fcf046144aaecae
5
5
  SHA512:
6
- metadata.gz: d5f0a0fcf7e9e123ec91387f07084e0d92bebe6e5ec4d642a2a1906b382e4eeece58caeac8543938ebb04da22bf67f8eb89082e7062b2b7f990f81674f0dbb5e
7
- data.tar.gz: 8dee0453e5d49178e107bc567ceb93d5150cfd0e2f024a1db3e36e928718f3dece27bdceb2c17a2fe10bb34e6bec62bd217d62ed490f18f3ea2eb9aa92983c08
6
+ metadata.gz: e9cec604868b4f55f350b62ad00325c71ca23d3e5c31c7039c2faad7a20d24bcb921ae40eaebc5c89d020862452b1e4d85cb76d0a665b3d65ac87086cc27c061
7
+ data.tar.gz: 59340e77fd87773691e8581aee13e86f1b7380ecfadc1af8df174a6b64dfc2e2f98f3d6d78ca1ee63d7844918bfd27233bc543fc32107d0cdda820184d2a3384
data/CHANGELOG.md CHANGED
@@ -1,19 +1,40 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
- ## [0.1.10] - 2022-09-xx
4
+ ## [0.2.2] - 2022-11-xx
5
5
 
6
6
  ### Added
7
7
  ### Changed
8
8
  ### Fixed
9
9
 
10
10
  ### ToDo
11
- - Make `GraphQL` default fragments work
12
- - Add update/create operations for `ContractorEntity`
11
+ - Add update operation for `ContractorEntity`
13
12
  - Add currentOrganization.action
14
13
  - Analyse how to "DSL" currentOrganization.action.activities
15
14
  - review `path` tracking
16
15
 
16
+ ## [0.2.1] - 2023-02-23
17
+
18
+ ### Added
19
+
20
+ ### Changed
21
+ - Migrate from TagTrees to **reporting structures** (breaking change)
22
+
23
+ ### Fixed
24
+
25
+
26
+ ## [0.1.11] - 2022-11-29
27
+
28
+ ### Added
29
+ - `Ecoportal::API::GraphQL::Base::Mutation`
30
+ - Added `createContractorEntity`
31
+
32
+ ### Changed
33
+ - **upgraded** `graphlient` gem dependency (support for framents)
34
+ - removed patch in this gem
35
+ - Slight internal refactor of `Ecoportal::API::GraphQL::Base::Query`
36
+ - Upgraded `ecoportal-api-v2` **gem** dependency
37
+
17
38
  ## [0.1.10] - 2022-09-29
18
39
 
19
40
  ### Changed
@@ -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.2', '< 0.10'
33
- spec.add_dependency 'graphlient', '>= 0.6.0', '< 0.7'
32
+ spec.add_dependency 'ecoportal-api-v2', '>= 1.0.1', '< 1.1'
33
+ spec.add_dependency 'graphlient', '>= 0.7.0', '< 0.8'
34
34
  end
@@ -1 +1 @@
1
- require_relative 'patches/query'
1
+ #require_relative 'patches/query'
@@ -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,16 +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/connection'
16
- require 'ecoportal/api/graphql/base/query_array'
17
- require 'ecoportal/api/graphql/base/query_connection'
18
- require 'ecoportal/api/graphql/base/validation_errors'
19
- require 'ecoportal/api/graphql/base/payload'
20
- require 'ecoportal/api/graphql/base/tag_tree_node'
21
- require 'ecoportal/api/graphql/base/tag_tree'
13
+ require 'ecoportal/api/graphql/base/location_node'
14
+ require 'ecoportal/api/graphql/base/location_structure'
22
15
  require 'ecoportal/api/graphql/base/person_member'
23
16
  require 'ecoportal/api/graphql/base/file_attachment'
24
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)