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
@@ -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
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Ecoportal
|
2
|
+
module API
|
3
|
+
class GraphQL
|
4
|
+
module Interface
|
5
|
+
module LocationStructure
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
require_relative 'location_structure/node'
|
13
|
+
require_relative 'location_structure/nodes'
|
14
|
+
require_relative 'location_structure/command'
|
@@ -40,14 +40,16 @@ module Ecoportal
|
|
40
40
|
|
41
41
|
@field_name = nil
|
42
42
|
@field_name = str.to_s if str
|
43
|
+
@field_name
|
43
44
|
end
|
44
45
|
|
45
46
|
def base_path(path = :unused)
|
46
47
|
return @base_path if path == :unused
|
47
48
|
|
48
49
|
path ||= []
|
49
|
-
path
|
50
|
-
path
|
50
|
+
path = path.to_s.split('.') if path.is_a?(String)
|
51
|
+
path = path.map(&:to_s).compact
|
52
|
+
|
51
53
|
@base_path = path
|
52
54
|
end
|
53
55
|
end
|
@@ -73,9 +75,16 @@ module Ecoportal
|
|
73
75
|
|
74
76
|
# Query rely that manages the different blocks.
|
75
77
|
# @return [Class] an object of `response_class` with the results hanging from `path`.
|
76
|
-
def query(path: self.path, **kargs, &block)
|
77
|
-
|
78
|
-
|
78
|
+
def query(path: self.path, raw_response: {}, **kargs, &block)
|
79
|
+
print = !is_a?(Mutation)
|
80
|
+
|
81
|
+
benchmarking("#{self.class}##{__method__}", print: print) do
|
82
|
+
graphql_query(
|
83
|
+
path: path,
|
84
|
+
raw_response: raw_response,
|
85
|
+
**kargs,
|
86
|
+
&basic_block(&block)
|
87
|
+
)
|
79
88
|
end
|
80
89
|
end
|
81
90
|
|
@@ -98,11 +107,14 @@ module Ecoportal
|
|
98
107
|
query_params = self.class.slice_params(default_params.merge(kargs))
|
99
108
|
|
100
109
|
request(*path) do
|
101
|
-
|
110
|
+
client.query(**query_params, &block).tap do |response|
|
111
|
+
raw_response[:data] = response
|
112
|
+
end
|
102
113
|
end
|
103
|
-
rescue Faraday::ParsingError, Graphlient::Errors::GraphQLError => _err
|
104
|
-
puts "Internal Error with these params:"
|
114
|
+
rescue Faraday::ParsingError, Graphlient::Errors::FaradayServerError, Graphlient::Errors::GraphQLError => _err
|
105
115
|
pp kargs
|
116
|
+
puts "Internal Error with these params:"
|
117
|
+
pp query_params
|
106
118
|
pp block
|
107
119
|
raise
|
108
120
|
end
|
@@ -113,7 +125,9 @@ module Ecoportal
|
|
113
125
|
end
|
114
126
|
|
115
127
|
def wrap_response(response, path = [])
|
116
|
-
|
128
|
+
# we use the Hash, because fragments are persmissioned
|
129
|
+
# see Use of Fragments at https://github.com/ashkan18/graphlient/tree/master?tab=readme-ov-file#use-of-fragments
|
130
|
+
unless (res = response.to_h.dig(*path.dup.unshift('data')))
|
117
131
|
msg = "Complete failure on request. Path: #{path}\n#{response.to_h.pretty_inspect}"
|
118
132
|
raise msg
|
119
133
|
end
|
@@ -2,7 +2,7 @@ module Ecoportal
|
|
2
2
|
module API
|
3
3
|
class GraphQL
|
4
4
|
module Logic
|
5
|
-
class Connection <
|
5
|
+
class Connection < Logic::BaseModel
|
6
6
|
class GenericNode
|
7
7
|
def initialize(*_args, **_kargs)
|
8
8
|
raise "Missuse error. You should define a node_class for a class that inherits from GraphqlConnection class."
|
@@ -16,7 +16,7 @@ module Ecoportal
|
|
16
16
|
passthrough :edges
|
17
17
|
passthrough :totalCount
|
18
18
|
embeds_many :nodes, klass: :node_class
|
19
|
-
embeds_one :pageInfo, klass:
|
19
|
+
embeds_one :pageInfo, klass: Base::PageInfo
|
20
20
|
|
21
21
|
def empty?
|
22
22
|
count < 1
|
@@ -2,7 +2,7 @@ module Ecoportal
|
|
2
2
|
module API
|
3
3
|
class GraphQL
|
4
4
|
module Logic
|
5
|
-
class Mutation <
|
5
|
+
class Mutation < Logic::BaseQuery
|
6
6
|
class GenericPayload
|
7
7
|
def initialize(*_args, **_kargs)
|
8
8
|
raise 'Missuse error. You should define a payload_class for a class that inherits from Mutation class.'
|
@@ -18,17 +18,12 @@ module Ecoportal
|
|
18
18
|
class_resolver :payload_class, GenericPayload
|
19
19
|
class_resolver :input_class, GenericInput
|
20
20
|
|
21
|
+
accepted_params :input
|
22
|
+
|
21
23
|
# Query rely that manages the different blocks.
|
22
24
|
# @return [Class] an object of `response_class` with the results hanving from `path`.
|
23
|
-
def query(input:, path: self.path, &block)
|
24
|
-
|
25
|
-
client.query(input: as_input(input), &basic_block(&block))
|
26
|
-
end
|
27
|
-
rescue Faraday::ParsingError, Graphlient::Errors::FaradayServerError => _err
|
28
|
-
puts "Internal Error with these input ('#{input.class}'):"
|
29
|
-
pp input
|
30
|
-
raise
|
31
|
-
# rescue Graphlient::Errors::TimeoutError => _err
|
25
|
+
def query(input:, path: self.path, **kargs, &block)
|
26
|
+
super(input: as_input(input), path: path, **kargs, &block)
|
32
27
|
end
|
33
28
|
|
34
29
|
def response_class
|
@@ -39,7 +34,7 @@ module Ecoportal
|
|
39
34
|
|
40
35
|
def as_input(value)
|
41
36
|
case value
|
42
|
-
when input_class,
|
37
|
+
when input_class, Logic::BaseModel
|
43
38
|
value.as_input
|
44
39
|
when Hash
|
45
40
|
value
|
@@ -2,7 +2,7 @@ module Ecoportal
|
|
2
2
|
module API
|
3
3
|
class GraphQL
|
4
4
|
module Logic
|
5
|
-
class Payload <
|
5
|
+
class Payload < Logic::BaseModel
|
6
6
|
class GenericItem
|
7
7
|
def initialize(*_args, **_kargs)
|
8
8
|
raise "Missuse error. You should define a item_class for a class that inherits from GraphqlPayload class."
|
@@ -14,11 +14,24 @@ module Ecoportal
|
|
14
14
|
passthrough :clientMutationId
|
15
15
|
|
16
16
|
class_resolver :item_class, GenericItem
|
17
|
+
|
17
18
|
embeds_one :item, klass: :item_class
|
18
|
-
embeds_one :errors, klass:
|
19
|
+
embeds_one :errors, klass: Error::ValidationErrors, nullable: true
|
20
|
+
|
21
|
+
def error?
|
22
|
+
errors && !errors.empty?
|
23
|
+
end
|
19
24
|
|
20
25
|
def success?
|
21
|
-
!
|
26
|
+
!error?
|
27
|
+
end
|
28
|
+
|
29
|
+
def error_doc
|
30
|
+
return unless (err_doc = errors&.doc)
|
31
|
+
|
32
|
+
{
|
33
|
+
validationErrors: err_doc
|
34
|
+
}
|
22
35
|
end
|
23
36
|
end
|
24
37
|
end
|
@@ -2,7 +2,7 @@ module Ecoportal
|
|
2
2
|
module API
|
3
3
|
class GraphQL
|
4
4
|
module Logic
|
5
|
-
class QueryConnection <
|
5
|
+
class QueryConnection < Logic::Query
|
6
6
|
accepted_params :searchConf, :after, :before, :first, :last
|
7
7
|
include Enumerable
|
8
8
|
|
@@ -27,17 +27,17 @@ module Ecoportal
|
|
27
27
|
|
28
28
|
@response_class ||= self.class.new_class(
|
29
29
|
item_class,
|
30
|
-
inherits:
|
30
|
+
inherits: Logic::Connection,
|
31
31
|
namespace: "Ecoportal::API::GraphQL::Connection"
|
32
32
|
) do |klass|
|
33
33
|
klass.item_class = item_class
|
34
34
|
end
|
35
|
+
end
|
35
36
|
|
36
|
-
|
37
|
+
private
|
37
38
|
|
38
|
-
|
39
|
-
|
40
|
-
end
|
39
|
+
def default_connection_block
|
40
|
+
raise 'You should defined this method'
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
@@ -7,6 +7,7 @@ module Ecoportal
|
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
+
require 'ecoportal/api/graphql/logic/base_model'
|
10
11
|
require 'ecoportal/api/graphql/logic/base_query'
|
11
12
|
require 'ecoportal/api/graphql/logic/query'
|
12
13
|
require 'ecoportal/api/graphql/logic/mutation'
|
@@ -14,3 +15,4 @@ require 'ecoportal/api/graphql/logic/connection'
|
|
14
15
|
require 'ecoportal/api/graphql/logic/query_array'
|
15
16
|
require 'ecoportal/api/graphql/logic/query_connection'
|
16
17
|
require 'ecoportal/api/graphql/logic/payload'
|
18
|
+
require 'ecoportal/api/graphql/logic/input'
|
@@ -2,7 +2,7 @@ module Ecoportal
|
|
2
2
|
module API
|
3
3
|
class GraphQL
|
4
4
|
module Model
|
5
|
-
class Action <
|
5
|
+
class Action < Base::Action
|
6
6
|
embeds_one :actionCategory, klass: GraphQL::Base::ActionCategory
|
7
7
|
embeds_many :assignedTo, klass: Model::PersonMember
|
8
8
|
embeds_one :creator, klass: Model::PersonMember
|
@@ -2,7 +2,7 @@ module Ecoportal
|
|
2
2
|
module API
|
3
3
|
class GraphQL
|
4
4
|
module Model
|
5
|
-
class ContractorEntity <
|
5
|
+
class ContractorEntity < Base::ContractorEntity
|
6
6
|
embeds_one :associatedPeople, read_only: true, klass: "Ecoportal::API::GraphQL::Connections::PersonMemberConnection"
|
7
7
|
embeds_many :leadContractors, read_only: true, klass: "Ecoportal::API::GraphQL::Model::PersonMember"
|
8
8
|
end
|
@@ -2,8 +2,8 @@ module Ecoportal
|
|
2
2
|
module API
|
3
3
|
class GraphQL
|
4
4
|
module Model
|
5
|
-
class FileContainer <
|
6
|
-
embeds_many :fileAttachments, klass:
|
5
|
+
class FileContainer < Base::FileContainer
|
6
|
+
embeds_many :fileAttachments, klass: Model::FileAttachment
|
7
7
|
end
|
8
8
|
end
|
9
9
|
end
|
@@ -2,18 +2,11 @@ module Ecoportal
|
|
2
2
|
module API
|
3
3
|
class GraphQL
|
4
4
|
module Model
|
5
|
-
class LocationNode <
|
6
|
-
|
7
|
-
embeds_many :ancestors, read_only: true, klass: Model::LocationNode
|
5
|
+
class LocationNode < Base::LocationNode
|
6
|
+
class_resolver :location_node_class, self
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
end
|
12
|
-
alias_method :parent_id, :parentId
|
13
|
-
|
14
|
-
def parent_id_upcase
|
15
|
-
parent_id&.upcase
|
16
|
-
end
|
8
|
+
# embeds_one :structure, klass: 'Model::LocationStructure'
|
9
|
+
# embeds_one :enabledLocationCode, klass: 'Model::LocationCode'
|
17
10
|
end
|
18
11
|
end
|
19
12
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Ecoportal
|
2
|
+
module API
|
3
|
+
class GraphQL
|
4
|
+
module Model
|
5
|
+
class LocationStructure
|
6
|
+
class Draft
|
7
|
+
class Structure < Base::LocationStructure::Draft::Structure
|
8
|
+
class_resolver :location_node_class, Model::LocationNode
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Ecoportal
|
2
|
+
module API
|
3
|
+
class GraphQL
|
4
|
+
module Model
|
5
|
+
class LocationStructure
|
6
|
+
class Draft < Base::LocationStructure::Draft
|
7
|
+
class_resolver :structure_class, "Ecoportal::API::GraphQL::Model::LocationStructure::Draft::Structure"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
require_relative 'draft/structure'
|
@@ -3,10 +3,14 @@ module Ecoportal
|
|
3
3
|
class GraphQL
|
4
4
|
module Model
|
5
5
|
class LocationStructure < Ecoportal::API::GraphQL::Base::LocationStructure
|
6
|
-
|
6
|
+
class_resolver :location_node_class, Model::LocationNode
|
7
|
+
class_resolver :draft_class, "Model::LocationStructure::Draft"
|
8
|
+
|
7
9
|
embeds_one :lastUpdatedBy, klass: "Ecoportal::API::GraphQL::Model::User"
|
8
10
|
end
|
9
11
|
end
|
10
12
|
end
|
11
13
|
end
|
12
14
|
end
|
15
|
+
|
16
|
+
require_relative 'location_structure/draft'
|
@@ -1,9 +1,11 @@
|
|
1
|
+
# rubocop:disable Layout/ArgumentAlignment
|
2
|
+
|
1
3
|
module Ecoportal
|
2
4
|
module API
|
3
5
|
class GraphQL
|
4
6
|
module Model
|
5
|
-
class Organization <
|
6
|
-
DEFAULT_PATH = [
|
7
|
+
class Organization < Base::Organization
|
8
|
+
DEFAULT_PATH = ['currentOrganization'].freeze
|
7
9
|
|
8
10
|
class << self
|
9
11
|
extend Ecoportal::API::Common::GraphQL::QueryIntegration
|
@@ -12,14 +14,27 @@ module Ecoportal
|
|
12
14
|
DEFAULT_PATH.dup.push(*add)
|
13
15
|
end
|
14
16
|
|
15
|
-
query :locationStructure,
|
16
|
-
|
17
|
-
|
17
|
+
query :locationStructure,
|
18
|
+
subpath: 'locations',
|
19
|
+
query_klass: 'Ecoportal::API::GraphQL::Query::LocationStructure'
|
20
|
+
query :locationStructures,
|
21
|
+
subpath: 'locations',
|
22
|
+
query_klass: 'Ecoportal::API::GraphQL::Query::LocationStructures'
|
23
|
+
query :locationDraftById,
|
24
|
+
subpath: %w[locations structure],
|
25
|
+
query_klass: 'Ecoportal::API::GraphQL::Query::LocationStructure::Draft'
|
26
|
+
|
27
|
+
query :contractorEntities,
|
28
|
+
query_klass: 'Ecoportal::API::GraphQL::Query::ContractorEntities'
|
18
29
|
#contractorEntity,
|
19
|
-
query :actionCategories,
|
20
|
-
|
21
|
-
query :
|
22
|
-
|
30
|
+
query :actionCategories,
|
31
|
+
query_klass: 'Ecoportal::API::GraphQL::Query::ActionCategories'
|
32
|
+
query :action,
|
33
|
+
query_klass: 'Ecoportal::API::GraphQL::Query::Action'
|
34
|
+
query :actions,
|
35
|
+
query_klass: 'Ecoportal::API::GraphQL::Query::Actions'
|
36
|
+
query :archiveAction,
|
37
|
+
query_klass: 'Ecoportal::API::GraphQL::Mutation::Action::Archive'
|
23
38
|
#action, actionsByPage, actionsCounter
|
24
39
|
#actionCategories
|
25
40
|
|
@@ -33,3 +48,5 @@ module Ecoportal
|
|
33
48
|
end
|
34
49
|
end
|
35
50
|
end
|
51
|
+
|
52
|
+
# rubocop:enable Layout/ArgumentAlignment
|
@@ -2,7 +2,13 @@ module Ecoportal
|
|
2
2
|
module API
|
3
3
|
class GraphQL
|
4
4
|
module Model
|
5
|
-
class Page <
|
5
|
+
class Page < Base::Page
|
6
|
+
class_resolver :user_class, 'Ecoportal::API::GraphQL::Model::User'
|
7
|
+
# class_resolver :force_class, 'Ecoportal::API::GraphQL::Model::Force'
|
8
|
+
# class_resolver :theme_class, 'Ecoportal::API::GraphQL::Model::Theme'
|
9
|
+
# class_resolver :template_class, 'Ecoportal::API::GraphQL::Model::Template'
|
10
|
+
# class_resolver :register_class, 'Ecoportal::API::GraphQL::Model::Register'
|
11
|
+
class_resolver :organization_class, 'Ecoportal::API::GraphQL::Model::Organization'
|
6
12
|
end
|
7
13
|
end
|
8
14
|
end
|
@@ -2,9 +2,9 @@ module Ecoportal
|
|
2
2
|
module API
|
3
3
|
class GraphQL
|
4
4
|
module Model
|
5
|
-
class PersonMember <
|
5
|
+
class PersonMember < Base::PersonMember
|
6
6
|
embeds_one :contractorOrganization, klass: "Ecoportal::API::GraphQL::Model::ContractorEntity"
|
7
|
-
embeds_one :account, klass:
|
7
|
+
embeds_one :account, klass: Model::Account
|
8
8
|
|
9
9
|
# embeds_many :privateFields, enum_class: Ecoportal::API::GraphQL::Model::MemberSchemaFields
|
10
10
|
# embeds_many :publicFields, enum_class: Ecoportal::API::GraphQL::Model::MemberSchemaFields
|
@@ -2,9 +2,10 @@ module Ecoportal
|
|
2
2
|
module API
|
3
3
|
class GraphQL
|
4
4
|
module Model
|
5
|
-
class Resource <
|
6
|
-
embeds_one :page, klass:
|
7
|
-
embeds_one :field, klass:
|
5
|
+
class Resource < Base::Resource
|
6
|
+
embeds_one :page, klass: 'Ecoportal::API::GraphQL::Model::Page', read_only: true # PageUnion
|
7
|
+
embeds_one :field, klass: 'Ecoportal::API::GraphQL::Model::Field', read_only: true
|
8
|
+
# embeds_many :stages, klass: 'Ecoportal::API::GraphQL::Model::SimpleStage'
|
8
9
|
end
|
9
10
|
end
|
10
11
|
end
|
@@ -3,12 +3,12 @@ module Ecoportal
|
|
3
3
|
class GraphQL
|
4
4
|
module Mutation
|
5
5
|
module Action
|
6
|
-
class Archive <
|
6
|
+
class Archive < Logic::Mutation
|
7
7
|
field_name :archiveAction
|
8
8
|
accepted_params :id
|
9
9
|
|
10
|
-
class_resolver :payload_class,
|
11
|
-
class_resolver :input_class,
|
10
|
+
class_resolver :payload_class, Payload::Action::Archive
|
11
|
+
class_resolver :input_class, Input::Action::Archive
|
12
12
|
|
13
13
|
private
|
14
14
|
|
@@ -3,11 +3,11 @@ module Ecoportal
|
|
3
3
|
class GraphQL
|
4
4
|
module Mutation
|
5
5
|
module Action
|
6
|
-
class Create <
|
6
|
+
class Create < Logic::Mutation
|
7
7
|
field_name :createAction
|
8
8
|
|
9
|
-
class_resolver :payload_class,
|
10
|
-
class_resolver :input_class,
|
9
|
+
class_resolver :payload_class, Payload::Action::Create
|
10
|
+
class_resolver :input_class, Input::Action::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 Action
|
6
|
-
class Update <
|
6
|
+
class Update < Logic::Mutation
|
7
7
|
field_name :updateAction
|
8
8
|
|
9
|
-
class_resolver :payload_class,
|
10
|
-
class_resolver :input_class,
|
9
|
+
class_resolver :payload_class, Payload::Action::Update
|
10
|
+
class_resolver :input_class, Input::Action::Update
|
11
11
|
|
12
12
|
private
|
13
13
|
|