ecoportal-api-graphql 1.2.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 +52 -6
- data/ecoportal-api-graphql.gemspec +2 -2
- 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 +4 -13
- 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 -5
- 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/base.rb +0 -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/action.rb +5 -3
- 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 +8 -3
- 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 +58 -0
- 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 +11 -0
- data/lib/ecoportal/api/graphql/{base/model.rb → logic/base_model.rb} +2 -2
- 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 +4 -11
- 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 +7 -1
- data/lib/ecoportal/api/graphql/model/person_member.rb +2 -2
- data/lib/ecoportal/api/graphql/model/resource.rb +4 -3
- 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 -12
- data/lib/ecoportal/api/graphql_version.rb +1 -1
- metadata +43 -11
- data/lib/ecoportal/api/graphql/payload/location_structure/command_interface.rb +0 -14
@@ -3,11 +3,11 @@ module Ecoportal
|
|
3
3
|
class GraphQL
|
4
4
|
module Mutation
|
5
5
|
module ContractorEntity
|
6
|
-
class Create <
|
6
|
+
class Create < Logic::Mutation
|
7
7
|
field_name :createContractorEntity
|
8
8
|
|
9
|
-
class_resolver :payload_class,
|
10
|
-
class_resolver :input_class,
|
9
|
+
class_resolver :payload_class, Payload::ContractorEntity::Create
|
10
|
+
class_resolver :input_class, Input::ContractorEntity::Create
|
11
11
|
|
12
12
|
private
|
13
13
|
|
@@ -3,11 +3,11 @@ module Ecoportal
|
|
3
3
|
class GraphQL
|
4
4
|
module Mutation
|
5
5
|
module ContractorEntity
|
6
|
-
class Destroy <
|
6
|
+
class Destroy < Logic::Mutation
|
7
7
|
field_name :destroyContractorEntity
|
8
8
|
|
9
|
-
class_resolver :payload_class,
|
10
|
-
class_resolver :input_class,
|
9
|
+
class_resolver :payload_class, Payload::ContractorEntity::Destroy
|
10
|
+
class_resolver :input_class, Input::ContractorEntity::Destroy
|
11
11
|
|
12
12
|
private
|
13
13
|
|
@@ -3,10 +3,10 @@ module Ecoportal
|
|
3
3
|
class GraphQL
|
4
4
|
module Mutation
|
5
5
|
module LocationStructure
|
6
|
-
class ApplyCommands <
|
6
|
+
class ApplyCommands < Logic::Mutation
|
7
7
|
field_name :applyCommandsToLocationStructure
|
8
|
-
class_resolver :payload_class,
|
9
|
-
class_resolver :input_class,
|
8
|
+
class_resolver :payload_class, Payload::LocationStructure::ApplyCommands
|
9
|
+
class_resolver :input_class, Input::LocationStructure::ApplyCommands
|
10
10
|
|
11
11
|
private
|
12
12
|
|
@@ -14,7 +14,10 @@ module Ecoportal
|
|
14
14
|
payload_block = block || default_payload_block
|
15
15
|
proc {
|
16
16
|
mutation(input: :ApplyCommandsToLocationStructureInput!) {
|
17
|
-
applyCommandsToLocationStructure(
|
17
|
+
applyCommandsToLocationStructure(
|
18
|
+
input: :input,
|
19
|
+
&payload_block
|
20
|
+
)
|
18
21
|
}
|
19
22
|
}
|
20
23
|
end
|
@@ -23,12 +26,7 @@ module Ecoportal
|
|
23
26
|
proc {
|
24
27
|
clientMutationId
|
25
28
|
error {
|
26
|
-
|
27
|
-
conflictingIds
|
28
|
-
validationErrors {
|
29
|
-
error
|
30
|
-
message
|
31
|
-
}
|
29
|
+
___Ecoportal__API__GraphQL__Fragment__LocationsError
|
32
30
|
}
|
33
31
|
results {
|
34
32
|
ok
|
@@ -38,12 +36,7 @@ module Ecoportal
|
|
38
36
|
__typename
|
39
37
|
}
|
40
38
|
error {
|
41
|
-
|
42
|
-
message
|
43
|
-
validationErrors {
|
44
|
-
error
|
45
|
-
message
|
46
|
-
}
|
39
|
+
___Ecoportal__API__GraphQL__Fragment__LocationsError
|
47
40
|
}
|
48
41
|
}
|
49
42
|
structure {
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module Ecoportal
|
2
|
+
module API
|
3
|
+
class GraphQL
|
4
|
+
module Mutation
|
5
|
+
module LocationStructure
|
6
|
+
module Draft
|
7
|
+
class AddCommands < Logic::Mutation
|
8
|
+
field_name :addCommandsToLocationDraft
|
9
|
+
accepted_params :includeArchivedNodes, default: true
|
10
|
+
|
11
|
+
class_resolver :payload_class, Payload::LocationStructure::Draft::AddCommands
|
12
|
+
class_resolver :input_class, Input::LocationStructure::Draft::AddCommands
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def basic_block(&block)
|
17
|
+
payload_block = block || default_payload_block
|
18
|
+
proc {
|
19
|
+
mutation(
|
20
|
+
input: :AddCommandsToLocationDraftInput!,
|
21
|
+
includeArchivedNodes: :boolean
|
22
|
+
) {
|
23
|
+
addCommandsToLocationDraft(
|
24
|
+
input: :input,
|
25
|
+
&payload_block
|
26
|
+
)
|
27
|
+
}
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def default_payload_block
|
32
|
+
proc {
|
33
|
+
clientMutationId
|
34
|
+
draft {
|
35
|
+
___Ecoportal__API__GraphQL__Fragment__LocationDraft
|
36
|
+
structure {
|
37
|
+
nodes(
|
38
|
+
includeArchived: :includeArchivedNodes
|
39
|
+
) {
|
40
|
+
___Ecoportal__API__GraphQL__Fragment__LocationNode
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
44
|
+
ok
|
45
|
+
errors {
|
46
|
+
details
|
47
|
+
fullMessages
|
48
|
+
}
|
49
|
+
}
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module Ecoportal
|
2
|
+
module API
|
3
|
+
class GraphQL
|
4
|
+
module Mutation
|
5
|
+
module LocationStructure
|
6
|
+
module Draft
|
7
|
+
class Create < Logic::Mutation
|
8
|
+
field_name :createLocationDraft
|
9
|
+
|
10
|
+
accepted_params :includeArchivedNodes, default: true
|
11
|
+
|
12
|
+
class_resolver :payload_class, Payload::LocationStructure::Draft::Create
|
13
|
+
class_resolver :input_class, Input::LocationStructure::Draft::Create
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def basic_block(&block)
|
18
|
+
payload_block = block || default_payload_block
|
19
|
+
proc {
|
20
|
+
mutation(
|
21
|
+
input: :CreateLocationDraftInput!,
|
22
|
+
includeArchivedNodes: :boolean
|
23
|
+
) {
|
24
|
+
createLocationDraft(
|
25
|
+
input: :input,
|
26
|
+
&payload_block
|
27
|
+
)
|
28
|
+
}
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
def default_payload_block
|
33
|
+
proc {
|
34
|
+
clientMutationId
|
35
|
+
draft {
|
36
|
+
___Ecoportal__API__GraphQL__Fragment__LocationDraft
|
37
|
+
structure {
|
38
|
+
nodes(
|
39
|
+
includeArchived: :includeArchivedNodes
|
40
|
+
) {
|
41
|
+
___Ecoportal__API__GraphQL__Fragment__LocationNode
|
42
|
+
}
|
43
|
+
}
|
44
|
+
}
|
45
|
+
errors {
|
46
|
+
details
|
47
|
+
fullMessages
|
48
|
+
}
|
49
|
+
}
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Ecoportal
|
2
|
+
module API
|
3
|
+
class GraphQL
|
4
|
+
module Mutation
|
5
|
+
module LocationStructure
|
6
|
+
module Draft
|
7
|
+
class Delete < Logic::Mutation
|
8
|
+
field_name :deleteLocationDraft
|
9
|
+
|
10
|
+
class_resolver :payload_class, Payload::LocationStructure::Draft::Delete
|
11
|
+
class_resolver :input_class, Input::LocationStructure::Draft::Delete
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def basic_block(&block)
|
16
|
+
payload_block = block || default_payload_block
|
17
|
+
proc {
|
18
|
+
mutation(input: :DeleteLocationDraftInput!) {
|
19
|
+
deleteLocationDraft(
|
20
|
+
input: :input,
|
21
|
+
&payload_block
|
22
|
+
)
|
23
|
+
}
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
def default_payload_block
|
28
|
+
proc {
|
29
|
+
clientMutationId
|
30
|
+
ok
|
31
|
+
errors {
|
32
|
+
details
|
33
|
+
fullMessages
|
34
|
+
}
|
35
|
+
}
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module Ecoportal
|
2
|
+
module API
|
3
|
+
class GraphQL
|
4
|
+
module Mutation
|
5
|
+
module LocationStructure
|
6
|
+
class DropBadCommands < Logic::Mutation
|
7
|
+
field_name :dropBadCommandsFromLocationDraft
|
8
|
+
|
9
|
+
accepted_params :includeArchivedNodes, default: true
|
10
|
+
|
11
|
+
class_resolver :payload_class, Payload::LocationStructure::Draft::DropBadCommands
|
12
|
+
class_resolver :input_class, Input::LocationStructure::Draft::DropBadCommands
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def basic_block(&block)
|
17
|
+
payload_block = block || default_payload_block
|
18
|
+
proc {
|
19
|
+
mutation(
|
20
|
+
input: :DropBadCommandsFromLocationDraftInput!,
|
21
|
+
includeArchivedNodes: :boolean
|
22
|
+
) {
|
23
|
+
dropBadCommandsFromLocationDraft(
|
24
|
+
input: :input,
|
25
|
+
&payload_block
|
26
|
+
)
|
27
|
+
}
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def default_payload_block
|
32
|
+
proc {
|
33
|
+
clientMutationId
|
34
|
+
draft {
|
35
|
+
___Ecoportal__API__GraphQL__Fragment__LocationDraft
|
36
|
+
structure {
|
37
|
+
nodes(
|
38
|
+
includeArchived: :includeArchivedNodes
|
39
|
+
) {
|
40
|
+
___Ecoportal__API__GraphQL__Fragment__LocationNode
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
44
|
+
ok
|
45
|
+
error {
|
46
|
+
___Ecoportal__API__GraphQL__Fragment__LocationsError
|
47
|
+
}
|
48
|
+
errors {
|
49
|
+
details
|
50
|
+
fullMessages
|
51
|
+
}
|
52
|
+
}
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
module Ecoportal
|
2
|
+
module API
|
3
|
+
class GraphQL
|
4
|
+
module Mutation
|
5
|
+
module LocationStructure
|
6
|
+
module Draft
|
7
|
+
class Publish < Logic::Mutation
|
8
|
+
field_name :applyLocationDraft
|
9
|
+
|
10
|
+
accepted_params :includeArchivedNodes, default: true
|
11
|
+
|
12
|
+
class_resolver :payload_class, Payload::LocationStructure::Draft::Publish
|
13
|
+
class_resolver :input_class, Input::LocationStructure::Draft::Publish
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def basic_block(&block)
|
18
|
+
payload_block = block || default_payload_block
|
19
|
+
proc {
|
20
|
+
mutation(
|
21
|
+
input: :ApplyLocationDraftInput!,
|
22
|
+
includeArchivedNodes: :boolean
|
23
|
+
) {
|
24
|
+
applyLocationDraft(
|
25
|
+
input: :input,
|
26
|
+
&payload_block
|
27
|
+
)
|
28
|
+
}
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
def default_payload_block
|
33
|
+
proc {
|
34
|
+
clientMutationId
|
35
|
+
structure {
|
36
|
+
nodes(
|
37
|
+
includeArchived: :includeArchivedNodes
|
38
|
+
) {
|
39
|
+
___Ecoportal__API__GraphQL__Fragment__LocationNode
|
40
|
+
}
|
41
|
+
}
|
42
|
+
ok
|
43
|
+
error {
|
44
|
+
___Ecoportal__API__GraphQL__Fragment__LocationsError
|
45
|
+
}
|
46
|
+
errors {
|
47
|
+
details
|
48
|
+
fullMessages
|
49
|
+
}
|
50
|
+
results {
|
51
|
+
ok
|
52
|
+
command {
|
53
|
+
id
|
54
|
+
state
|
55
|
+
__typename
|
56
|
+
}
|
57
|
+
error {
|
58
|
+
___Ecoportal__API__GraphQL__Fragment__LocationsError
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Ecoportal
|
2
|
+
module API
|
3
|
+
class GraphQL
|
4
|
+
module Mutation
|
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/add_commands'
|
18
|
+
require_relative 'draft/drop_bad_commands'
|
@@ -3,21 +3,44 @@ module Ecoportal
|
|
3
3
|
class GraphQL
|
4
4
|
module Payload
|
5
5
|
module LocationStructure
|
6
|
-
class ApplyCommands <
|
6
|
+
class ApplyCommands < Logic::Payload
|
7
7
|
read_only!
|
8
8
|
|
9
9
|
passthrough :clientMutationId
|
10
|
-
embeds_one :structure, klass:
|
11
|
-
embeds_one :
|
12
|
-
|
13
|
-
embeds_many :results, read_only: true, klass: Ecoportal::API::GraphQL::Payload::LocationStructure::CommandExecutionResult
|
10
|
+
embeds_one :structure, klass: Model::LocationStructure
|
11
|
+
embeds_one :error, klass: Error::LocationsError, nullable: true
|
12
|
+
embeds_many :results, read_only: true, klass: Payload::LocationStructure::CommandExecutionResult
|
14
13
|
|
15
|
-
|
16
|
-
|
14
|
+
include Error::LocationsError::FetchNested
|
15
|
+
|
16
|
+
def error?
|
17
|
+
super || result_errors? || locations_error?
|
18
|
+
end
|
19
|
+
alias_method :errors?, :error? # backward compatibility
|
20
|
+
|
21
|
+
def error_doc
|
22
|
+
err_doc = super
|
23
|
+
return err_doc if err_doc
|
24
|
+
|
25
|
+
if result_errors?
|
26
|
+
{
|
27
|
+
results: [
|
28
|
+
result_errors.first&.error_doc
|
29
|
+
]
|
30
|
+
}
|
31
|
+
elsif locations_error?
|
32
|
+
{
|
33
|
+
locationsError: locations_error_doc
|
34
|
+
}
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def result_errors?
|
39
|
+
result_errors.any?
|
17
40
|
end
|
18
41
|
|
19
|
-
def
|
20
|
-
|
42
|
+
def result_errors
|
43
|
+
results.select(&:error?)
|
21
44
|
end
|
22
45
|
end
|
23
46
|
end
|
@@ -3,12 +3,35 @@ module Ecoportal
|
|
3
3
|
class GraphQL
|
4
4
|
module Payload
|
5
5
|
module LocationStructure
|
6
|
-
class CommandExecutionResult <
|
6
|
+
class CommandExecutionResult < Logic::BaseModel
|
7
7
|
read_only!
|
8
8
|
|
9
|
-
embeds_one :command, klass:
|
10
|
-
embeds_one :error, nullable: true, klass:
|
9
|
+
embeds_one :command, klass: Interface::LocationStructure::Command
|
10
|
+
embeds_one :error, nullable: true, klass: Error::LocationsError
|
11
11
|
passboolean :ok
|
12
|
+
alias_method :ok?, :ok
|
13
|
+
|
14
|
+
include Error::LocationsError::FetchNested
|
15
|
+
|
16
|
+
def error?
|
17
|
+
!ok? || locations_error?
|
18
|
+
end
|
19
|
+
|
20
|
+
def error_doc
|
21
|
+
if locations_error?
|
22
|
+
{
|
23
|
+
locationsError: locations_error_doc
|
24
|
+
}
|
25
|
+
elsif !ok?
|
26
|
+
{
|
27
|
+
ok: false
|
28
|
+
}
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def success?
|
33
|
+
!error?
|
34
|
+
end
|
12
35
|
end
|
13
36
|
end
|
14
37
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Ecoportal
|
2
|
+
module API
|
3
|
+
class GraphQL
|
4
|
+
module Payload
|
5
|
+
module LocationStructure
|
6
|
+
module Draft
|
7
|
+
class AddCommands < Create
|
8
|
+
passboolean :ok
|
9
|
+
alias_method :ok?, :ok
|
10
|
+
|
11
|
+
def error?
|
12
|
+
super || !ok?
|
13
|
+
end
|
14
|
+
|
15
|
+
def error_doc
|
16
|
+
err_doc = super
|
17
|
+
return err_doc if err_doc
|
18
|
+
|
19
|
+
{ ok: false } unless ok?
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Ecoportal
|
2
|
+
module API
|
3
|
+
class GraphQL
|
4
|
+
module Payload
|
5
|
+
module LocationStructure
|
6
|
+
module Draft
|
7
|
+
class Create < Logic::Payload
|
8
|
+
class_resolver :item_class, "Ecoportal::API::GraphQL::Model::LocationStructure::Draft"
|
9
|
+
|
10
|
+
embeds_one :draft, klass: :item_class
|
11
|
+
alias_method :item, :draft
|
12
|
+
|
13
|
+
def error?
|
14
|
+
super ||
|
15
|
+
draft.error?
|
16
|
+
end
|
17
|
+
|
18
|
+
def error_doc
|
19
|
+
err_doc = super
|
20
|
+
return err_doc if err_doc
|
21
|
+
|
22
|
+
if draft.error? && draft.respond_to?(:error_doc)
|
23
|
+
{
|
24
|
+
draft: draft.error_doc
|
25
|
+
}
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Ecoportal
|
2
|
+
module API
|
3
|
+
class GraphQL
|
4
|
+
module Payload
|
5
|
+
module LocationStructure
|
6
|
+
module Draft
|
7
|
+
class Delete < Logic::Payload
|
8
|
+
passboolean :ok
|
9
|
+
alias_method :ok?, :ok
|
10
|
+
|
11
|
+
def error?
|
12
|
+
super || !ok?
|
13
|
+
end
|
14
|
+
|
15
|
+
def error_doc
|
16
|
+
err_doc = super
|
17
|
+
return err_doc if err_doc
|
18
|
+
|
19
|
+
{ ok: false } unless ok?
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|