ecoportal-api-graphql 1.3.1 → 1.3.2
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/.rubocop.yml +1 -1
- data/CHANGELOG.md +36 -7
- data/ecoportal-api-graphql.gemspec +1 -1
- data/lib/ecoportal/api/common/graphql/client.rb +2 -1
- data/lib/ecoportal/api/common/graphql/query_integration.rb +5 -5
- data/lib/ecoportal/api/common.graphql.rb +1 -1
- data/lib/ecoportal/api/graphql/base/action.rb +1 -1
- data/lib/ecoportal/api/graphql/base/action_category.rb +1 -1
- data/lib/ecoportal/api/graphql/base/contractor_entity.rb +1 -1
- data/lib/ecoportal/api/graphql/base/date_time.rb +1 -1
- data/lib/ecoportal/api/graphql/base/field.rb +1 -1
- data/lib/ecoportal/api/graphql/base/file_attachment.rb +1 -1
- data/lib/ecoportal/api/graphql/base/file_container.rb +1 -1
- data/lib/ecoportal/api/graphql/base/location_classification_type.rb +1 -1
- data/lib/ecoportal/api/graphql/base/location_node.rb +3 -5
- data/lib/ecoportal/api/graphql/base/location_structure/draft/structure.rb +37 -0
- data/lib/ecoportal/api/graphql/base/location_structure/draft.rb +88 -0
- data/lib/ecoportal/api/graphql/base/location_structure.rb +9 -5
- data/lib/ecoportal/api/graphql/base/organization.rb +1 -1
- data/lib/ecoportal/api/graphql/base/page.rb +1 -1
- data/lib/ecoportal/api/graphql/base/page_info.rb +1 -1
- data/lib/ecoportal/api/graphql/base/person_member.rb +1 -1
- data/lib/ecoportal/api/graphql/base/resource.rb +1 -1
- data/lib/ecoportal/api/graphql/builder/action.rb +3 -3
- data/lib/ecoportal/api/graphql/builder/contractor_entity.rb +3 -3
- data/lib/ecoportal/api/graphql/builder/location_structure/draft.rb +64 -0
- data/lib/ecoportal/api/graphql/builder/location_structure.rb +9 -3
- data/lib/ecoportal/api/graphql/connection/action.rb +2 -2
- data/lib/ecoportal/api/graphql/connection/action_category.rb +2 -2
- data/lib/ecoportal/api/graphql/connection/contractor_entity.rb +2 -2
- data/lib/ecoportal/api/graphql/connection/person_member.rb +2 -2
- data/lib/ecoportal/api/graphql/error/locations_error/fetch_nested.rb +49 -0
- data/lib/ecoportal/api/graphql/error/locations_error.rb +15 -4
- data/lib/ecoportal/api/graphql/error/locations_validation_error.rb +5 -1
- data/lib/ecoportal/api/graphql/error/validation_errors.rb +5 -1
- data/lib/ecoportal/api/graphql/fragment/location_draft.rb +39 -0
- data/lib/ecoportal/api/graphql/fragment/locations_error.rb +18 -0
- data/lib/ecoportal/api/graphql/fragment.rb +4 -2
- data/lib/ecoportal/api/graphql/input/action/archive.rb +1 -2
- data/lib/ecoportal/api/graphql/input/action/create.rb +1 -1
- data/lib/ecoportal/api/graphql/input/contractor_entity/create.rb +1 -1
- data/lib/ecoportal/api/graphql/input/contractor_entity/destroy.rb +1 -2
- data/lib/ecoportal/api/graphql/input/contractor_entity/update.rb +1 -1
- data/lib/ecoportal/api/graphql/input/id_diff.rb +1 -1
- data/lib/ecoportal/api/graphql/input/location_structure/apply_commands.rb +2 -3
- data/lib/ecoportal/api/graphql/input/location_structure/archive_command.rb +1 -1
- data/lib/ecoportal/api/graphql/input/location_structure/delete_command.rb +1 -1
- data/lib/ecoportal/api/graphql/input/location_structure/draft/add_commands.rb +49 -0
- data/lib/ecoportal/api/graphql/input/location_structure/draft/create.rb +15 -0
- data/lib/ecoportal/api/graphql/input/location_structure/draft/delete.rb +15 -0
- data/lib/ecoportal/api/graphql/input/location_structure/draft/drop_bad_commands.rb +16 -0
- data/lib/ecoportal/api/graphql/input/location_structure/draft/publish.rb +16 -0
- data/lib/ecoportal/api/graphql/input/location_structure/draft.rb +19 -0
- data/lib/ecoportal/api/graphql/input/location_structure/insert_command.rb +1 -1
- data/lib/ecoportal/api/graphql/input/location_structure/move_command.rb +1 -1
- data/lib/ecoportal/api/graphql/input/location_structure/reorder_command.rb +1 -1
- data/lib/ecoportal/api/graphql/input/location_structure/unarchive_command.rb +1 -1
- data/lib/ecoportal/api/graphql/input/location_structure/update_command.rb +1 -1
- data/lib/ecoportal/api/graphql/input/location_structure.rb +1 -1
- data/lib/ecoportal/api/graphql/input/search.rb +1 -1
- data/lib/ecoportal/api/graphql/input/search_filter.rb +1 -1
- data/lib/ecoportal/api/graphql/input/search_sorter.rb +1 -1
- data/lib/ecoportal/api/graphql/interface/base_page.rb +2 -2
- data/lib/ecoportal/api/graphql/{input/location_structure/command_interface.rb → interface/location_structure/command.rb} +9 -5
- data/lib/ecoportal/api/graphql/interface/location_structure/node.rb +43 -0
- data/lib/ecoportal/api/graphql/interface/location_structure/nodes.rb +28 -0
- data/lib/ecoportal/api/graphql/interface/location_structure.rb +14 -0
- data/lib/ecoportal/api/graphql/interface.rb +1 -1
- data/lib/ecoportal/api/graphql/logic/base_model.rb +13 -0
- data/lib/ecoportal/api/graphql/logic/base_query.rb +23 -9
- data/lib/ecoportal/api/graphql/logic/connection.rb +2 -2
- data/lib/ecoportal/api/graphql/logic/input.rb +11 -0
- data/lib/ecoportal/api/graphql/logic/mutation.rb +6 -11
- data/lib/ecoportal/api/graphql/logic/payload.rb +16 -3
- data/lib/ecoportal/api/graphql/logic/query.rb +1 -1
- data/lib/ecoportal/api/graphql/logic/query_array.rb +1 -1
- data/lib/ecoportal/api/graphql/logic/query_connection.rb +6 -6
- data/lib/ecoportal/api/graphql/logic.rb +2 -0
- data/lib/ecoportal/api/graphql/model/account.rb +1 -1
- data/lib/ecoportal/api/graphql/model/action.rb +1 -1
- data/lib/ecoportal/api/graphql/model/contractor_entity.rb +1 -1
- data/lib/ecoportal/api/graphql/model/field.rb +1 -1
- data/lib/ecoportal/api/graphql/model/file_attachment.rb +1 -1
- data/lib/ecoportal/api/graphql/model/file_container.rb +2 -2
- data/lib/ecoportal/api/graphql/model/location_node.rb +3 -5
- data/lib/ecoportal/api/graphql/model/location_structure/draft/structure.rb +15 -0
- data/lib/ecoportal/api/graphql/model/location_structure/draft.rb +15 -0
- data/lib/ecoportal/api/graphql/model/location_structure.rb +5 -1
- data/lib/ecoportal/api/graphql/model/organization.rb +26 -9
- data/lib/ecoportal/api/graphql/model/page.rb +1 -1
- data/lib/ecoportal/api/graphql/model/person_member.rb +2 -2
- data/lib/ecoportal/api/graphql/model/resource.rb +1 -1
- data/lib/ecoportal/api/graphql/model/user.rb +1 -1
- data/lib/ecoportal/api/graphql/mutation/action/archive.rb +3 -3
- data/lib/ecoportal/api/graphql/mutation/action/create.rb +3 -3
- data/lib/ecoportal/api/graphql/mutation/action/update.rb +3 -3
- data/lib/ecoportal/api/graphql/mutation/contractor_entity/create.rb +3 -3
- data/lib/ecoportal/api/graphql/mutation/contractor_entity/destroy.rb +3 -3
- data/lib/ecoportal/api/graphql/mutation/location_structure/apply_commands.rb +9 -16
- data/lib/ecoportal/api/graphql/mutation/location_structure/draft/add_commands.rb +57 -0
- data/lib/ecoportal/api/graphql/mutation/location_structure/draft/create.rb +57 -0
- data/lib/ecoportal/api/graphql/mutation/location_structure/draft/delete.rb +43 -0
- data/lib/ecoportal/api/graphql/mutation/location_structure/draft/drop_bad_commands.rb +59 -0
- data/lib/ecoportal/api/graphql/mutation/location_structure/draft/publish.rb +69 -0
- data/lib/ecoportal/api/graphql/mutation/location_structure/draft.rb +18 -0
- data/lib/ecoportal/api/graphql/mutation/location_structure.rb +1 -0
- data/lib/ecoportal/api/graphql/payload/action/archive.rb +1 -1
- data/lib/ecoportal/api/graphql/payload/action/create.rb +1 -1
- data/lib/ecoportal/api/graphql/payload/action/update.rb +1 -1
- data/lib/ecoportal/api/graphql/payload/contractor_entity/create.rb +1 -1
- data/lib/ecoportal/api/graphql/payload/contractor_entity/destroy.rb +1 -1
- data/lib/ecoportal/api/graphql/payload/contractor_entity/update.rb +1 -1
- data/lib/ecoportal/api/graphql/payload/location_structure/apply_commands.rb +32 -9
- data/lib/ecoportal/api/graphql/payload/location_structure/command_execution_result.rb +26 -3
- data/lib/ecoportal/api/graphql/payload/location_structure/draft/add_commands.rb +27 -0
- data/lib/ecoportal/api/graphql/payload/location_structure/draft/create.rb +34 -0
- data/lib/ecoportal/api/graphql/payload/location_structure/draft/delete.rb +27 -0
- data/lib/ecoportal/api/graphql/payload/location_structure/draft/drop_bad_commands.rb +41 -0
- data/lib/ecoportal/api/graphql/payload/location_structure/draft/publish.rb +56 -0
- data/lib/ecoportal/api/graphql/payload/location_structure/draft.rb +18 -0
- data/lib/ecoportal/api/graphql/payload/location_structure.rb +1 -1
- data/lib/ecoportal/api/graphql/query/action.rb +2 -2
- data/lib/ecoportal/api/graphql/query/action_categories.rb +3 -3
- data/lib/ecoportal/api/graphql/query/actions.rb +3 -3
- data/lib/ecoportal/api/graphql/query/contractor_entities.rb +3 -3
- data/lib/ecoportal/api/graphql/query/location_classifications.rb +2 -2
- data/lib/ecoportal/api/graphql/query/location_structure/draft.rb +62 -0
- data/lib/ecoportal/api/graphql/query/location_structure.rb +17 -4
- data/lib/ecoportal/api/graphql/query/location_structures.rb +5 -3
- data/lib/ecoportal/api/graphql.rb +14 -14
- data/lib/ecoportal/api/graphql_version.rb +1 -1
- metadata +37 -8
- data/lib/ecoportal/api/graphql/base_model.rb +0 -11
- data/lib/ecoportal/api/graphql/interface/location_node.rb +0 -39
- data/lib/ecoportal/api/graphql/payload/location_structure/command_interface.rb +0 -14
@@ -0,0 +1,49 @@
|
|
1
|
+
module Ecoportal
|
2
|
+
module API
|
3
|
+
class GraphQL
|
4
|
+
module Error
|
5
|
+
class LocationsError < Logic::BaseModel
|
6
|
+
module FetchNested
|
7
|
+
def locations_error_doc
|
8
|
+
return unless locations_error?
|
9
|
+
|
10
|
+
if conflictingIds?
|
11
|
+
{
|
12
|
+
conflictingIds: conflictingIds.doc
|
13
|
+
}
|
14
|
+
elsif validationErrors?
|
15
|
+
{
|
16
|
+
validationErrors: validationErrors.doc
|
17
|
+
}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def locations_error?
|
22
|
+
!error.nil? && !error.empty?
|
23
|
+
end
|
24
|
+
|
25
|
+
def conflictingIds?
|
26
|
+
conflictingIds.any?
|
27
|
+
end
|
28
|
+
|
29
|
+
def validationErrors?
|
30
|
+
validationErrors.any?
|
31
|
+
end
|
32
|
+
|
33
|
+
def conflictingIds
|
34
|
+
return [] unless (err = error)
|
35
|
+
|
36
|
+
err.conflictingIds || []
|
37
|
+
end
|
38
|
+
|
39
|
+
def validationErrors
|
40
|
+
return [] unless (err = error)
|
41
|
+
|
42
|
+
err.validationErrors || []
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -2,14 +2,25 @@ module Ecoportal
|
|
2
2
|
module API
|
3
3
|
class GraphQL
|
4
4
|
module Error
|
5
|
-
class LocationsError <
|
5
|
+
class LocationsError < Logic::BaseModel
|
6
6
|
read_only!
|
7
7
|
|
8
|
-
passthrough :
|
9
|
-
|
10
|
-
embeds_many :validationErrors, klass:
|
8
|
+
passthrough :type, :message
|
9
|
+
passarray :conflictingIds
|
10
|
+
embeds_many :validationErrors, klass: LocationsValidationError
|
11
|
+
|
12
|
+
def empty?
|
13
|
+
conflictingIds.empty? && validationErrors.empty?
|
14
|
+
end
|
15
|
+
|
16
|
+
def any?
|
17
|
+
!empty?
|
18
|
+
end
|
11
19
|
end
|
12
20
|
end
|
13
21
|
end
|
14
22
|
end
|
15
23
|
end
|
24
|
+
|
25
|
+
|
26
|
+
require_relative 'locations_error/fetch_nested'
|
@@ -2,10 +2,14 @@ module Ecoportal
|
|
2
2
|
module API
|
3
3
|
class GraphQL
|
4
4
|
module Error
|
5
|
-
class LocationsValidationError <
|
5
|
+
class LocationsValidationError < Logic::BaseModel
|
6
6
|
read_only!
|
7
7
|
|
8
8
|
passthrough :error, :message, :property
|
9
|
+
|
10
|
+
def empty?
|
11
|
+
error.nil? && message.nil? && property.nil?
|
12
|
+
end
|
9
13
|
end
|
10
14
|
end
|
11
15
|
end
|
@@ -2,7 +2,7 @@ module Ecoportal
|
|
2
2
|
module API
|
3
3
|
class GraphQL
|
4
4
|
module Error
|
5
|
-
class ValidationErrors <
|
5
|
+
class ValidationErrors < Logic::BaseModel
|
6
6
|
include Enumerable
|
7
7
|
|
8
8
|
passthrough :details
|
@@ -12,6 +12,10 @@ module Ecoportal
|
|
12
12
|
count < 1
|
13
13
|
end
|
14
14
|
|
15
|
+
def any?
|
16
|
+
!empty?
|
17
|
+
end
|
18
|
+
|
15
19
|
def each(&block)
|
16
20
|
return to_enum(:each) unless block
|
17
21
|
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Ecoportal
|
2
|
+
module API
|
3
|
+
class GraphQL
|
4
|
+
class Fragment
|
5
|
+
fragment :LocationDraft, <<~GRAPHQL
|
6
|
+
fragment on Draft {
|
7
|
+
id
|
8
|
+
name
|
9
|
+
notes
|
10
|
+
committed
|
11
|
+
createdAt
|
12
|
+
ok
|
13
|
+
conflictingIds
|
14
|
+
results {
|
15
|
+
ok
|
16
|
+
command {
|
17
|
+
id
|
18
|
+
state
|
19
|
+
__typename
|
20
|
+
}
|
21
|
+
error {
|
22
|
+
message
|
23
|
+
conflictingIds
|
24
|
+
validationErrors {
|
25
|
+
error
|
26
|
+
message
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
30
|
+
commands {
|
31
|
+
id
|
32
|
+
state
|
33
|
+
}
|
34
|
+
}
|
35
|
+
GRAPHQL
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Ecoportal
|
2
|
+
module API
|
3
|
+
class GraphQL
|
4
|
+
class Fragment
|
5
|
+
fragment :LocationsError, <<~GRAPHQL
|
6
|
+
fragment on LocationsError {
|
7
|
+
message
|
8
|
+
conflictingIds
|
9
|
+
validationErrors {
|
10
|
+
error
|
11
|
+
message
|
12
|
+
}
|
13
|
+
}
|
14
|
+
GRAPHQL
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -36,6 +36,8 @@ module Ecoportal
|
|
36
36
|
::Fragment.const_set(sym, fragment) unless namespace == ::Fragment
|
37
37
|
end
|
38
38
|
end
|
39
|
+
rescue ::GraphQL::Client::ValidationError, ::Graphlient::Errors::ClientError => err
|
40
|
+
raise err.class, "On fragment #{sym} -- #{err.message}", cause: nil
|
39
41
|
end
|
40
42
|
|
41
43
|
private
|
@@ -53,8 +55,6 @@ module Ecoportal
|
|
53
55
|
@fragments = self.class.fragments.
|
54
56
|
each_with_object({}) do |(sym, heredoc), out|
|
55
57
|
out[sym] = define(sym, heredoc, namespace: self.class)
|
56
|
-
rescue ::GraphQL::Client::ValidationError, ::Graphlient::Errors::ClientError => err
|
57
|
-
raise err.class, "On fragment #{sym} -- #{err.message}", cause: nil
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
@@ -63,7 +63,9 @@ module Ecoportal
|
|
63
63
|
end
|
64
64
|
|
65
65
|
require 'ecoportal/api/graphql/fragment/pagination'
|
66
|
+
require 'ecoportal/api/graphql/fragment/locations_error'
|
66
67
|
require 'ecoportal/api/graphql/fragment/location_node'
|
68
|
+
require 'ecoportal/api/graphql/fragment/location_draft'
|
67
69
|
require 'ecoportal/api/graphql/fragment/action_category'
|
68
70
|
require 'ecoportal/api/graphql/fragment/action'
|
69
71
|
require 'ecoportal/api/graphql/fragment/contractor_entity'
|
@@ -3,7 +3,7 @@ module Ecoportal
|
|
3
3
|
class GraphQL
|
4
4
|
module Input
|
5
5
|
module ContractorEntity
|
6
|
-
class Update <
|
6
|
+
class Update < Input::ContractorEntity::Create
|
7
7
|
passthrough :clientMutationId
|
8
8
|
class_resolver :id_diff_input, "Ecoportal::API::GraphQL::Input::IdDiff"
|
9
9
|
embeds_one :associatedPeopleIds, klass: :id_diff_input
|
@@ -3,11 +3,10 @@ module Ecoportal
|
|
3
3
|
class GraphQL
|
4
4
|
module Input
|
5
5
|
module LocationStructure
|
6
|
-
class ApplyCommands <
|
6
|
+
class ApplyCommands < Logic::Input
|
7
7
|
passkey :id
|
8
|
-
passthrough :clientMutationId
|
9
8
|
passboolean :force
|
10
|
-
embeds_many :commands, klass:
|
9
|
+
embeds_many :commands, klass: Interface::LocationStructure::Command
|
11
10
|
passboolean :preview
|
12
11
|
|
13
12
|
def add(type, **kargs)
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Ecoportal
|
2
|
+
module API
|
3
|
+
class GraphQL
|
4
|
+
module Input
|
5
|
+
module LocationStructure
|
6
|
+
module Draft
|
7
|
+
class AddCommands < Logic::Input
|
8
|
+
passkey :id
|
9
|
+
|
10
|
+
passboolean :preview
|
11
|
+
embeds_many :commands, klass: Interface::LocationStructure::Command
|
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
|
49
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Ecoportal
|
2
|
+
module API
|
3
|
+
class GraphQL
|
4
|
+
module Input
|
5
|
+
module LocationStructure
|
6
|
+
module Draft
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
require_relative 'draft/create'
|
15
|
+
require_relative 'draft/publish'
|
16
|
+
require_relative 'draft/delete'
|
17
|
+
# require_relative 'draft/update'
|
18
|
+
require_relative 'draft/add_commands'
|
19
|
+
require_relative 'draft/drop_bad_commands'
|
@@ -3,7 +3,7 @@ module Ecoportal
|
|
3
3
|
class GraphQL
|
4
4
|
module Input
|
5
5
|
module LocationStructure
|
6
|
-
class InsertCommand <
|
6
|
+
class InsertCommand < Input::LocationStructure::MoveCommand
|
7
7
|
passthrough :classificationIds
|
8
8
|
end
|
9
9
|
end
|
@@ -3,7 +3,7 @@ module Ecoportal
|
|
3
3
|
class GraphQL
|
4
4
|
module Input
|
5
5
|
module LocationStructure
|
6
|
-
class MoveCommand <
|
6
|
+
class MoveCommand < Interface::LocationStructure::Command
|
7
7
|
passthrough :nodeId, :parentId
|
8
8
|
passthrough :insertBefore
|
9
9
|
end
|
@@ -3,7 +3,7 @@ module Ecoportal
|
|
3
3
|
class GraphQL
|
4
4
|
module Input
|
5
5
|
module LocationStructure
|
6
|
-
class ReorderCommand <
|
6
|
+
class ReorderCommand < Interface::LocationStructure::Command
|
7
7
|
passthrough :parentId, :orderedIds
|
8
8
|
end
|
9
9
|
end
|
@@ -3,7 +3,7 @@ module Ecoportal
|
|
3
3
|
class GraphQL
|
4
4
|
module Input
|
5
5
|
module LocationStructure
|
6
|
-
class UnarchiveCommand <
|
6
|
+
class UnarchiveCommand < Interface::LocationStructure::Command
|
7
7
|
passthrough :nodeId
|
8
8
|
end
|
9
9
|
end
|
@@ -3,7 +3,7 @@ module Ecoportal
|
|
3
3
|
class GraphQL
|
4
4
|
module Input
|
5
5
|
module LocationStructure
|
6
|
-
class UpdateCommand <
|
6
|
+
class UpdateCommand < Interface::LocationStructure::Command
|
7
7
|
passthrough :nodeId, :newId
|
8
8
|
passthrough :name, :classificationIds
|
9
9
|
end
|
@@ -9,7 +9,6 @@ module Ecoportal
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
require_relative 'location_structure/command_interface'
|
13
12
|
require_relative 'location_structure/delete_command'
|
14
13
|
require_relative 'location_structure/archive_command'
|
15
14
|
require_relative 'location_structure/unarchive_command'
|
@@ -18,3 +17,4 @@ require_relative 'location_structure/insert_command'
|
|
18
17
|
require_relative 'location_structure/reorder_command'
|
19
18
|
require_relative 'location_structure/update_command'
|
20
19
|
require_relative 'location_structure/apply_commands'
|
20
|
+
require_relative 'location_structure/draft'
|
@@ -2,7 +2,7 @@ module Ecoportal
|
|
2
2
|
module API
|
3
3
|
class GraphQL
|
4
4
|
module Input
|
5
|
-
class Search <
|
5
|
+
class Search < Logic::BaseModel
|
6
6
|
embeds_many :filters, enum_class: "Ecoportal::API::GraphQL::Input::SearchFilter"
|
7
7
|
passthrough :query
|
8
8
|
embeds_many :sorters, enum_class: "Ecoportal::API::GraphQL::Input::SearchSorter"
|
@@ -2,12 +2,12 @@ module Ecoportal
|
|
2
2
|
module API
|
3
3
|
class GraphQL
|
4
4
|
module Interface
|
5
|
-
class BasePage <
|
5
|
+
class BasePage < Logic::BaseModel
|
6
6
|
passkey :id
|
7
7
|
passthrough :name, :uid
|
8
8
|
passthrough :icon
|
9
9
|
|
10
|
-
class_resolver :location_node_class, 'Ecoportal::API::GraphQL::Interface::
|
10
|
+
class_resolver :location_node_class, 'Ecoportal::API::GraphQL::Interface::LocationStructure::Node'
|
11
11
|
class_resolver :user_class, 'Ecoportal::API::GraphQL::Base::User'
|
12
12
|
# class_resolver :force_class, 'Ecoportal::API::GraphQL::Base::Force'
|
13
13
|
# class_resolver :task_class, 'Ecoportal::API::GraphQL::Interface::Task'
|
@@ -1,21 +1,25 @@
|
|
1
1
|
module Ecoportal
|
2
2
|
module API
|
3
3
|
class GraphQL
|
4
|
-
module
|
4
|
+
module Interface
|
5
5
|
module LocationStructure
|
6
|
-
class
|
6
|
+
class Command < Logic::BaseModel
|
7
7
|
passkey :id
|
8
8
|
passthrough :state
|
9
9
|
|
10
|
-
def
|
11
|
-
|
12
|
-
|
10
|
+
def target_ids
|
11
|
+
(doc || {}).values_at(:nodeId, :newId, :id)
|
12
|
+
end
|
13
|
+
|
14
|
+
def keys
|
15
|
+
(doc || {}).keys
|
13
16
|
end
|
14
17
|
|
15
18
|
def set_values(**kargs)
|
16
19
|
kargs.each do |key, value|
|
17
20
|
send(key, value) if respond_to?(key, true)
|
18
21
|
end
|
22
|
+
|
19
23
|
self
|
20
24
|
end
|
21
25
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Ecoportal
|
2
|
+
module API
|
3
|
+
class GraphQL
|
4
|
+
module Interface
|
5
|
+
module LocationStructure
|
6
|
+
class Node < Logic::BaseModel
|
7
|
+
root!
|
8
|
+
|
9
|
+
class_resolver :location_classification_class, 'Ecoportal::API::GraphQL::Base::LocationClassificationType'
|
10
|
+
class_resolver :location_node_class, self
|
11
|
+
|
12
|
+
passkey :id
|
13
|
+
passthrough :name
|
14
|
+
embeds_many :classifications, klass: :location_classification_class
|
15
|
+
passarray :classificationObjectIds
|
16
|
+
|
17
|
+
passthrough :weight
|
18
|
+
|
19
|
+
passboolean :archived
|
20
|
+
passthrough :archivedToken
|
21
|
+
|
22
|
+
passthrough :structureId
|
23
|
+
|
24
|
+
embeds_one :parent, klass: :location_node_class, nullable: true
|
25
|
+
passthrough :parentObjectId
|
26
|
+
|
27
|
+
def parentId
|
28
|
+
parent&.id
|
29
|
+
end
|
30
|
+
alias_method :parent_id, :parentId
|
31
|
+
|
32
|
+
def parent_id_upcase
|
33
|
+
parent_id&.upcase
|
34
|
+
end
|
35
|
+
|
36
|
+
embeds_many :ancestors, klass: :location_node_class, read_only: true
|
37
|
+
embeds_many :children, klass: :location_node_class, read_only: true
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Ecoportal
|
2
|
+
module API
|
3
|
+
class GraphQL
|
4
|
+
module Interface
|
5
|
+
module LocationStructure
|
6
|
+
class Nodes < Logic::BaseModel
|
7
|
+
extend Helpers::LocationsTree
|
8
|
+
|
9
|
+
root!
|
10
|
+
|
11
|
+
class_resolver :location_node_class, Node
|
12
|
+
|
13
|
+
embeds_many :nodes, klass: :location_node_class, order_key: :weight
|
14
|
+
|
15
|
+
def draft?
|
16
|
+
false
|
17
|
+
end
|
18
|
+
|
19
|
+
def treeify
|
20
|
+
self.class.treeify(nodes)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|