ecoportal-api-graphql 0.1.11 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -9
- data/ecoportal-api-graphql.gemspec +1 -1
- data/lib/ecoportal/api/common/graphql/query_integration.rb +5 -4
- data/lib/ecoportal/api/graphql/base/location_node.rb +15 -0
- data/lib/ecoportal/api/graphql/base/location_structure.rb +21 -0
- data/lib/ecoportal/api/graphql/base.rb +2 -10
- data/lib/ecoportal/api/graphql/builder/location_structure.rb +29 -0
- data/lib/ecoportal/api/graphql/builder.rb +10 -0
- data/lib/ecoportal/api/graphql/connection/action.rb +1 -1
- data/lib/ecoportal/api/graphql/connection/contractor_entity.rb +1 -1
- data/lib/ecoportal/api/graphql/connection/person_member.rb +1 -1
- data/lib/ecoportal/api/graphql/error/locations_error.rb +13 -0
- data/lib/ecoportal/api/graphql/error/locations_validation_error.rb +11 -0
- data/lib/ecoportal/api/graphql/{base → error}/validation_errors.rb +1 -1
- data/lib/ecoportal/api/graphql/error.rb +12 -0
- data/lib/ecoportal/api/graphql/fragment/location_node.rb +20 -0
- data/lib/ecoportal/api/graphql/fragment.rb +1 -1
- data/lib/ecoportal/api/graphql/helpers/{tag_tree.rb → locations_tree.rb} +10 -3
- data/lib/ecoportal/api/graphql/helpers.rb +1 -1
- data/lib/ecoportal/api/graphql/input/contractor_entity/create.rb +16 -0
- data/lib/ecoportal/api/graphql/input/contractor_entity/destroy.rb +13 -0
- data/lib/ecoportal/api/graphql/input/{update_contractor_entity.rb → contractor_entity/update.rb} +1 -1
- data/lib/ecoportal/api/graphql/input/contractor_entity.rb +14 -0
- data/lib/ecoportal/api/graphql/{base/id_diff_input.rb → input/id_diff.rb} +2 -2
- data/lib/ecoportal/api/graphql/input/location_structure/apply_commands.rb +48 -0
- data/lib/ecoportal/api/graphql/input/location_structure/archive_command.rb +13 -0
- data/lib/ecoportal/api/graphql/input/location_structure/command_interface.rb +26 -0
- data/lib/ecoportal/api/graphql/input/location_structure/delete_command.rb +13 -0
- data/lib/ecoportal/api/graphql/input/location_structure/insert_command.rb +13 -0
- data/lib/ecoportal/api/graphql/input/location_structure/move_command.rb +14 -0
- data/lib/ecoportal/api/graphql/input/location_structure/reorder_command.rb +13 -0
- data/lib/ecoportal/api/graphql/input/location_structure/unarchive_command.rb +13 -0
- data/lib/ecoportal/api/graphql/input/location_structure/update_command.rb +14 -0
- data/lib/ecoportal/api/graphql/input/location_structure.rb +20 -0
- data/lib/ecoportal/api/graphql/input.rb +3 -3
- data/lib/ecoportal/api/graphql/{base → logic}/connection.rb +1 -1
- data/lib/ecoportal/api/graphql/{base → logic}/mutation.rb +10 -1
- data/lib/ecoportal/api/graphql/{base → logic}/payload.rb +2 -2
- data/lib/ecoportal/api/graphql/{base → logic}/query.rb +3 -2
- data/lib/ecoportal/api/graphql/{base → logic}/query_array.rb +2 -2
- data/lib/ecoportal/api/graphql/{base → logic}/query_connection.rb +3 -3
- data/lib/ecoportal/api/graphql/logic.rb +15 -0
- data/lib/ecoportal/api/graphql/model/location_node.rb +11 -0
- data/lib/ecoportal/api/graphql/model/{tag_tree.rb → location_structure.rb} +2 -2
- data/lib/ecoportal/api/graphql/model/organization.rb +2 -2
- data/lib/ecoportal/api/graphql/model.rb +2 -2
- data/lib/ecoportal/api/graphql/mutation/contractor_entity/create.rb +40 -0
- data/lib/ecoportal/api/graphql/mutation/contractor_entity.rb +14 -0
- data/lib/ecoportal/api/graphql/mutation/location_structure/apply_commands.rb +61 -0
- data/lib/ecoportal/api/graphql/mutation/location_structure.rb +12 -0
- data/lib/ecoportal/api/graphql/mutation.rb +2 -1
- data/lib/ecoportal/api/graphql/payload/contractor_entity/create.rb +13 -0
- data/lib/ecoportal/api/graphql/payload/contractor_entity/destroy.rb +12 -0
- data/lib/ecoportal/api/graphql/payload/contractor_entity/update.rb +12 -0
- data/lib/ecoportal/api/graphql/payload/contractor_entity.rb +14 -0
- data/lib/ecoportal/api/graphql/payload/location_structure/apply_commands.rb +25 -0
- data/lib/ecoportal/api/graphql/payload/location_structure/command_execution_result.rb +15 -0
- data/lib/ecoportal/api/graphql/payload/location_structure/command_interface.rb +14 -0
- data/lib/ecoportal/api/graphql/payload/location_structure.rb +14 -0
- data/lib/ecoportal/api/graphql/payload.rb +2 -3
- data/lib/ecoportal/api/graphql/query/actions.rb +1 -1
- data/lib/ecoportal/api/graphql/query/contractor_entities.rb +1 -1
- data/lib/ecoportal/api/graphql/query/{tag_tree.rb → location_structure.rb} +12 -8
- data/lib/ecoportal/api/graphql/query/location_structures.rb +46 -0
- data/lib/ecoportal/api/graphql/query.rb +2 -2
- data/lib/ecoportal/api/graphql.rb +9 -2
- data/lib/ecoportal/api/graphql_version.rb +1 -1
- data/tests/loc_structure_get.rb +11 -0
- data/tests/loc_structure_update.rb +51 -0
- data/tests/loc_structures_get.rb +15 -0
- data/tests/local_libs.rb +2 -2
- metadata +63 -37
- data/lib/ecoportal/api/graphql/base/tag_tree.rb +0 -20
- data/lib/ecoportal/api/graphql/base/tag_tree_node.rb +0 -13
- data/lib/ecoportal/api/graphql/fragment/tag_tree_node.rb +0 -16
- data/lib/ecoportal/api/graphql/input/create_contractor_entity.rb +0 -14
- data/lib/ecoportal/api/graphql/input/destroy_contractor_entity.rb +0 -11
- data/lib/ecoportal/api/graphql/model/tag_tree_node.rb +0 -10
- data/lib/ecoportal/api/graphql/mutation/create_contractor_entity.rb +0 -38
- data/lib/ecoportal/api/graphql/payload/create_contractor_entity.rb +0 -11
- data/lib/ecoportal/api/graphql/payload/destroy_contractor_entity.rb +0 -10
- data/lib/ecoportal/api/graphql/payload/update_contractor_entity.rb +0 -10
- data/lib/ecoportal/api/graphql/query/tag_trees.rb +0 -37
- data/tests/tagtree_get.rb +0 -7
- data/tests/tagtrees_get.rb +0 -7
- /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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4dd9eeecfae002b0c6e3324daaaf607a420a659e28c3356ccc4bfccad3585c68
|
|
4
|
+
data.tar.gz: 4b20881fe6cf9870bc718cbf2d9f0c97d532ea140c9d08278fcf046144aaecae
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e9cec604868b4f55f350b62ad00325c71ca23d3e5c31c7039c2faad7a20d24bcb921ae40eaebc5c89d020862452b1e4d85cb76d0a665b3d65ac87086cc27c061
|
|
7
|
+
data.tar.gz: 59340e77fd87773691e8581aee13e86f1b7380ecfadc1af8df174a6b64dfc2e2f98f3d6d78ca1ee63d7844918bfd27233bc543fc32107d0cdda820184d2a3384
|
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.
|
|
4
|
+
## [0.2.2] - 2022-11-xx
|
|
5
5
|
|
|
6
6
|
### Added
|
|
7
7
|
### Changed
|
|
@@ -13,24 +13,27 @@ 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
|
|
16
|
+
## [0.2.1] - 2023-02-23
|
|
17
17
|
|
|
18
18
|
### Added
|
|
19
|
-
- `Ecoportal::API::GraphQL::Base::Mutation`
|
|
20
|
-
- Added `createContractorEntity`
|
|
21
19
|
|
|
22
20
|
### Changed
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
- Migrate from TagTrees to **reporting structures** (breaking change)
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
|
|
25
25
|
|
|
26
|
-
## [0.1.11] - 2022-11-
|
|
26
|
+
## [0.1.11] - 2022-11-29
|
|
27
27
|
|
|
28
28
|
### Added
|
|
29
|
+
- `Ecoportal::API::GraphQL::Base::Mutation`
|
|
30
|
+
- Added `createContractorEntity`
|
|
31
|
+
|
|
29
32
|
### Changed
|
|
30
33
|
- **upgraded** `graphlient` gem dependency (support for framents)
|
|
31
34
|
- removed patch in this gem
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
- Slight internal refactor of `Ecoportal::API::GraphQL::Base::Query`
|
|
36
|
+
- Upgraded `ecoportal-api-v2` **gem** dependency
|
|
34
37
|
|
|
35
38
|
## [0.1.10] - 2022-09-29
|
|
36
39
|
|
|
@@ -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.
|
|
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::
|
|
31
|
-
raise "Expected query_klass to be of type Ecoportal::API::GraphQL::
|
|
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:
|
|
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/
|
|
15
|
-
require 'ecoportal/api/graphql/base/
|
|
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
|
|
@@ -2,7 +2,7 @@ module Ecoportal
|
|
|
2
2
|
module API
|
|
3
3
|
class GraphQL
|
|
4
4
|
module Connection
|
|
5
|
-
class ContractorEntity < Ecoportal::API::GraphQL::
|
|
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::
|
|
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,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/
|
|
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
|
|
5
|
+
module LocationsTree
|
|
6
6
|
def treeify(nodes)
|
|
7
7
|
parents = nodes.each_with_object({}) do |node, parents|
|
|
8
|
-
|
|
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
|
-
"
|
|
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
|
|
@@ -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,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'
|
|
@@ -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,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,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,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/
|
|
14
|
-
require 'ecoportal/api/graphql/input/
|
|
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'
|