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.
Files changed (136) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/CHANGELOG.md +52 -6
  4. data/ecoportal-api-graphql.gemspec +2 -2
  5. data/lib/ecoportal/api/common/graphql/client.rb +2 -1
  6. data/lib/ecoportal/api/common/graphql/query_integration.rb +5 -5
  7. data/lib/ecoportal/api/common.graphql.rb +1 -1
  8. data/lib/ecoportal/api/graphql/base/action.rb +1 -1
  9. data/lib/ecoportal/api/graphql/base/action_category.rb +1 -1
  10. data/lib/ecoportal/api/graphql/base/contractor_entity.rb +1 -1
  11. data/lib/ecoportal/api/graphql/base/date_time.rb +1 -1
  12. data/lib/ecoportal/api/graphql/base/field.rb +1 -1
  13. data/lib/ecoportal/api/graphql/base/file_attachment.rb +1 -1
  14. data/lib/ecoportal/api/graphql/base/file_container.rb +1 -1
  15. data/lib/ecoportal/api/graphql/base/location_classification_type.rb +1 -1
  16. data/lib/ecoportal/api/graphql/base/location_node.rb +4 -13
  17. data/lib/ecoportal/api/graphql/base/location_structure/draft/structure.rb +37 -0
  18. data/lib/ecoportal/api/graphql/base/location_structure/draft.rb +88 -0
  19. data/lib/ecoportal/api/graphql/base/location_structure.rb +9 -5
  20. data/lib/ecoportal/api/graphql/base/organization.rb +1 -1
  21. data/lib/ecoportal/api/graphql/base/page.rb +1 -5
  22. data/lib/ecoportal/api/graphql/base/page_info.rb +1 -1
  23. data/lib/ecoportal/api/graphql/base/person_member.rb +1 -1
  24. data/lib/ecoportal/api/graphql/base/resource.rb +1 -1
  25. data/lib/ecoportal/api/graphql/base.rb +0 -1
  26. data/lib/ecoportal/api/graphql/builder/action.rb +3 -3
  27. data/lib/ecoportal/api/graphql/builder/contractor_entity.rb +3 -3
  28. data/lib/ecoportal/api/graphql/builder/location_structure/draft.rb +64 -0
  29. data/lib/ecoportal/api/graphql/builder/location_structure.rb +9 -3
  30. data/lib/ecoportal/api/graphql/connection/action.rb +2 -2
  31. data/lib/ecoportal/api/graphql/connection/action_category.rb +2 -2
  32. data/lib/ecoportal/api/graphql/connection/contractor_entity.rb +2 -2
  33. data/lib/ecoportal/api/graphql/connection/person_member.rb +2 -2
  34. data/lib/ecoportal/api/graphql/error/locations_error/fetch_nested.rb +49 -0
  35. data/lib/ecoportal/api/graphql/error/locations_error.rb +15 -4
  36. data/lib/ecoportal/api/graphql/error/locations_validation_error.rb +5 -1
  37. data/lib/ecoportal/api/graphql/error/validation_errors.rb +5 -1
  38. data/lib/ecoportal/api/graphql/fragment/action.rb +5 -3
  39. data/lib/ecoportal/api/graphql/fragment/location_draft.rb +39 -0
  40. data/lib/ecoportal/api/graphql/fragment/locations_error.rb +18 -0
  41. data/lib/ecoportal/api/graphql/fragment.rb +8 -3
  42. data/lib/ecoportal/api/graphql/input/action/archive.rb +1 -2
  43. data/lib/ecoportal/api/graphql/input/action/create.rb +1 -1
  44. data/lib/ecoportal/api/graphql/input/contractor_entity/create.rb +1 -1
  45. data/lib/ecoportal/api/graphql/input/contractor_entity/destroy.rb +1 -2
  46. data/lib/ecoportal/api/graphql/input/contractor_entity/update.rb +1 -1
  47. data/lib/ecoportal/api/graphql/input/id_diff.rb +1 -1
  48. data/lib/ecoportal/api/graphql/input/location_structure/apply_commands.rb +2 -3
  49. data/lib/ecoportal/api/graphql/input/location_structure/archive_command.rb +1 -1
  50. data/lib/ecoportal/api/graphql/input/location_structure/delete_command.rb +1 -1
  51. data/lib/ecoportal/api/graphql/input/location_structure/draft/add_commands.rb +49 -0
  52. data/lib/ecoportal/api/graphql/input/location_structure/draft/create.rb +15 -0
  53. data/lib/ecoportal/api/graphql/input/location_structure/draft/delete.rb +15 -0
  54. data/lib/ecoportal/api/graphql/input/location_structure/draft/drop_bad_commands.rb +16 -0
  55. data/lib/ecoportal/api/graphql/input/location_structure/draft/publish.rb +16 -0
  56. data/lib/ecoportal/api/graphql/input/location_structure/draft.rb +19 -0
  57. data/lib/ecoportal/api/graphql/input/location_structure/insert_command.rb +1 -1
  58. data/lib/ecoportal/api/graphql/input/location_structure/move_command.rb +1 -1
  59. data/lib/ecoportal/api/graphql/input/location_structure/reorder_command.rb +1 -1
  60. data/lib/ecoportal/api/graphql/input/location_structure/unarchive_command.rb +1 -1
  61. data/lib/ecoportal/api/graphql/input/location_structure/update_command.rb +1 -1
  62. data/lib/ecoportal/api/graphql/input/location_structure.rb +1 -1
  63. data/lib/ecoportal/api/graphql/input/search.rb +1 -1
  64. data/lib/ecoportal/api/graphql/input/search_filter.rb +1 -1
  65. data/lib/ecoportal/api/graphql/input/search_sorter.rb +1 -1
  66. data/lib/ecoportal/api/graphql/interface/base_page.rb +58 -0
  67. data/lib/ecoportal/api/graphql/{input/location_structure/command_interface.rb → interface/location_structure/command.rb} +9 -5
  68. data/lib/ecoportal/api/graphql/interface/location_structure/node.rb +43 -0
  69. data/lib/ecoportal/api/graphql/interface/location_structure/nodes.rb +28 -0
  70. data/lib/ecoportal/api/graphql/interface/location_structure.rb +14 -0
  71. data/lib/ecoportal/api/graphql/interface.rb +11 -0
  72. data/lib/ecoportal/api/graphql/{base/model.rb → logic/base_model.rb} +2 -2
  73. data/lib/ecoportal/api/graphql/logic/base_query.rb +23 -9
  74. data/lib/ecoportal/api/graphql/logic/connection.rb +2 -2
  75. data/lib/ecoportal/api/graphql/logic/input.rb +11 -0
  76. data/lib/ecoportal/api/graphql/logic/mutation.rb +6 -11
  77. data/lib/ecoportal/api/graphql/logic/payload.rb +16 -3
  78. data/lib/ecoportal/api/graphql/logic/query.rb +1 -1
  79. data/lib/ecoportal/api/graphql/logic/query_array.rb +1 -1
  80. data/lib/ecoportal/api/graphql/logic/query_connection.rb +6 -6
  81. data/lib/ecoportal/api/graphql/logic.rb +2 -0
  82. data/lib/ecoportal/api/graphql/model/account.rb +1 -1
  83. data/lib/ecoportal/api/graphql/model/action.rb +1 -1
  84. data/lib/ecoportal/api/graphql/model/contractor_entity.rb +1 -1
  85. data/lib/ecoportal/api/graphql/model/field.rb +1 -1
  86. data/lib/ecoportal/api/graphql/model/file_attachment.rb +1 -1
  87. data/lib/ecoportal/api/graphql/model/file_container.rb +2 -2
  88. data/lib/ecoportal/api/graphql/model/location_node.rb +4 -11
  89. data/lib/ecoportal/api/graphql/model/location_structure/draft/structure.rb +15 -0
  90. data/lib/ecoportal/api/graphql/model/location_structure/draft.rb +15 -0
  91. data/lib/ecoportal/api/graphql/model/location_structure.rb +5 -1
  92. data/lib/ecoportal/api/graphql/model/organization.rb +26 -9
  93. data/lib/ecoportal/api/graphql/model/page.rb +7 -1
  94. data/lib/ecoportal/api/graphql/model/person_member.rb +2 -2
  95. data/lib/ecoportal/api/graphql/model/resource.rb +4 -3
  96. data/lib/ecoportal/api/graphql/model/user.rb +1 -1
  97. data/lib/ecoportal/api/graphql/mutation/action/archive.rb +3 -3
  98. data/lib/ecoportal/api/graphql/mutation/action/create.rb +3 -3
  99. data/lib/ecoportal/api/graphql/mutation/action/update.rb +3 -3
  100. data/lib/ecoportal/api/graphql/mutation/contractor_entity/create.rb +3 -3
  101. data/lib/ecoportal/api/graphql/mutation/contractor_entity/destroy.rb +3 -3
  102. data/lib/ecoportal/api/graphql/mutation/location_structure/apply_commands.rb +9 -16
  103. data/lib/ecoportal/api/graphql/mutation/location_structure/draft/add_commands.rb +57 -0
  104. data/lib/ecoportal/api/graphql/mutation/location_structure/draft/create.rb +57 -0
  105. data/lib/ecoportal/api/graphql/mutation/location_structure/draft/delete.rb +43 -0
  106. data/lib/ecoportal/api/graphql/mutation/location_structure/draft/drop_bad_commands.rb +59 -0
  107. data/lib/ecoportal/api/graphql/mutation/location_structure/draft/publish.rb +69 -0
  108. data/lib/ecoportal/api/graphql/mutation/location_structure/draft.rb +18 -0
  109. data/lib/ecoportal/api/graphql/mutation/location_structure.rb +1 -0
  110. data/lib/ecoportal/api/graphql/payload/action/archive.rb +1 -1
  111. data/lib/ecoportal/api/graphql/payload/action/create.rb +1 -1
  112. data/lib/ecoportal/api/graphql/payload/action/update.rb +1 -1
  113. data/lib/ecoportal/api/graphql/payload/contractor_entity/create.rb +1 -1
  114. data/lib/ecoportal/api/graphql/payload/contractor_entity/destroy.rb +1 -1
  115. data/lib/ecoportal/api/graphql/payload/contractor_entity/update.rb +1 -1
  116. data/lib/ecoportal/api/graphql/payload/location_structure/apply_commands.rb +32 -9
  117. data/lib/ecoportal/api/graphql/payload/location_structure/command_execution_result.rb +26 -3
  118. data/lib/ecoportal/api/graphql/payload/location_structure/draft/add_commands.rb +27 -0
  119. data/lib/ecoportal/api/graphql/payload/location_structure/draft/create.rb +34 -0
  120. data/lib/ecoportal/api/graphql/payload/location_structure/draft/delete.rb +27 -0
  121. data/lib/ecoportal/api/graphql/payload/location_structure/draft/drop_bad_commands.rb +41 -0
  122. data/lib/ecoportal/api/graphql/payload/location_structure/draft/publish.rb +56 -0
  123. data/lib/ecoportal/api/graphql/payload/location_structure/draft.rb +18 -0
  124. data/lib/ecoportal/api/graphql/payload/location_structure.rb +1 -1
  125. data/lib/ecoportal/api/graphql/query/action.rb +2 -2
  126. data/lib/ecoportal/api/graphql/query/action_categories.rb +3 -3
  127. data/lib/ecoportal/api/graphql/query/actions.rb +3 -3
  128. data/lib/ecoportal/api/graphql/query/contractor_entities.rb +3 -3
  129. data/lib/ecoportal/api/graphql/query/location_classifications.rb +2 -2
  130. data/lib/ecoportal/api/graphql/query/location_structure/draft.rb +62 -0
  131. data/lib/ecoportal/api/graphql/query/location_structure.rb +17 -4
  132. data/lib/ecoportal/api/graphql/query/location_structures.rb +5 -3
  133. data/lib/ecoportal/api/graphql.rb +14 -12
  134. data/lib/ecoportal/api/graphql_version.rb +1 -1
  135. metadata +43 -11
  136. 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 < Ecoportal::API::GraphQL::Base::Model
5
+ class LocationsError < Logic::BaseModel
6
6
  read_only!
7
7
 
8
- passthrough :message, :conflictingIds
9
- passthrough :type
10
- embeds_many :validationErrors, klass: Ecoportal::API::GraphQL::Error::LocationsValidationError
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 < Ecoportal::API::GraphQL::Base::Model
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 < Ecoportal::API::GraphQL::Base::Model
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
 
@@ -50,9 +50,11 @@ module Ecoportal
50
50
  linkedResources {
51
51
  id
52
52
  page {
53
- id
54
- name
55
- mouldCounter
53
+ ... on BasePageInterface {
54
+ id
55
+ name
56
+ uid
57
+ }
56
58
  }
57
59
  }
58
60
  }
@@ -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
@@ -50,9 +52,10 @@ module Ecoportal
50
52
  end
51
53
 
52
54
  def parse
53
- fragments = self.class.fragments.each_with_object({}) do |(sym, heredoc), out|
54
- out[sym] = define(sym, heredoc, namespace: self.class)
55
- end
55
+ @fragments = self.class.fragments.
56
+ each_with_object({}) do |(sym, heredoc), out|
57
+ out[sym] = define(sym, heredoc, namespace: self.class)
58
+ end
56
59
  end
57
60
  end
58
61
  end
@@ -60,7 +63,9 @@ module Ecoportal
60
63
  end
61
64
 
62
65
  require 'ecoportal/api/graphql/fragment/pagination'
66
+ require 'ecoportal/api/graphql/fragment/locations_error'
63
67
  require 'ecoportal/api/graphql/fragment/location_node'
68
+ require 'ecoportal/api/graphql/fragment/location_draft'
64
69
  require 'ecoportal/api/graphql/fragment/action_category'
65
70
  require 'ecoportal/api/graphql/fragment/action'
66
71
  require 'ecoportal/api/graphql/fragment/contractor_entity'
@@ -3,9 +3,8 @@ module Ecoportal
3
3
  class GraphQL
4
4
  module Input
5
5
  module Action
6
- class Archive < Ecoportal::API::GraphQL::Base::Model
6
+ class Archive < Logic::Input
7
7
  passkey :id
8
- passthrough :clientMutationId
9
8
  passthrough :updateMode
10
9
  end
11
10
  end
@@ -3,7 +3,7 @@ module Ecoportal
3
3
  class GraphQL
4
4
  module Input
5
5
  module Action
6
- class Create < Ecoportal::API::GraphQL::Base::Action
6
+ class Create < Base::Action
7
7
  passthrough :clientMutationId
8
8
  end
9
9
  end
@@ -3,7 +3,7 @@ module Ecoportal
3
3
  class GraphQL
4
4
  module Input
5
5
  module ContractorEntity
6
- class Create < Ecoportal::API::GraphQL::Base::ContractorEntity
6
+ class Create < Base::ContractorEntity
7
7
  passthrough :clientMutationId
8
8
  passboolean :overrideAutoApproval
9
9
  end
@@ -3,8 +3,7 @@ module Ecoportal
3
3
  class GraphQL
4
4
  module Input
5
5
  module ContractorEntity
6
- class Destroy < Ecoportal::API::GraphQL::Base::Model
7
- passthrough :clientMutationId
6
+ class Destroy < Logic::Input
8
7
  passkey :id
9
8
  end
10
9
  end
@@ -3,7 +3,7 @@ module Ecoportal
3
3
  class GraphQL
4
4
  module Input
5
5
  module ContractorEntity
6
- class Update < Ecoportal::API::GraphQL::Input::ContractorEntity::Create
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
@@ -2,7 +2,7 @@ module Ecoportal
2
2
  module API
3
3
  class GraphQL
4
4
  module Input
5
- class IdDiff < Ecoportal::API::GraphQL::Base::Model
5
+ class IdDiff < Logic::BaseModel
6
6
  passarray :additions, :removals
7
7
  end
8
8
  end
@@ -3,11 +3,10 @@ module Ecoportal
3
3
  class GraphQL
4
4
  module Input
5
5
  module LocationStructure
6
- class ApplyCommands < Ecoportal::API::GraphQL::Base::Model
6
+ class ApplyCommands < Logic::Input
7
7
  passkey :id
8
- passthrough :clientMutationId
9
8
  passboolean :force
10
- embeds_many :commands, klass: Ecoportal::API::GraphQL::Input::LocationStructure::CommandInterface
9
+ embeds_many :commands, klass: Interface::LocationStructure::Command
11
10
  passboolean :preview
12
11
 
13
12
  def add(type, **kargs)
@@ -3,7 +3,7 @@ module Ecoportal
3
3
  class GraphQL
4
4
  module Input
5
5
  module LocationStructure
6
- class ArchiveCommand < Ecoportal::API::GraphQL::Input::LocationStructure::CommandInterface
6
+ class ArchiveCommand < 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 DeleteCommand < Ecoportal::API::GraphQL::Input::LocationStructure::CommandInterface
6
+ class DeleteCommand < Interface::LocationStructure::Command
7
7
  passthrough :nodeId
8
8
  end
9
9
  end
@@ -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,15 @@
1
+ module Ecoportal
2
+ module API
3
+ class GraphQL
4
+ module Input
5
+ module LocationStructure
6
+ module Draft
7
+ class Create < Logic::Input
8
+ passthrough :structureId, :name, :notes
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 Input
5
+ module LocationStructure
6
+ module Draft
7
+ class Delete < Logic::Input
8
+ passthrough :id
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,16 @@
1
+ module Ecoportal
2
+ module API
3
+ class GraphQL
4
+ module Input
5
+ module LocationStructure
6
+ module Draft
7
+ class DropBadCommands < Logic::Input
8
+ passthrough :id
9
+ passboolean :preview
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ module Ecoportal
2
+ module API
3
+ class GraphQL
4
+ module Input
5
+ module LocationStructure
6
+ module Draft
7
+ class Publish < Logic::Input
8
+ passthrough :id
9
+ passboolean :preview, :force
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
16
+ 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 < Ecoportal::API::GraphQL::Input::LocationStructure::MoveCommand
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 < Ecoportal::API::GraphQL::Input::LocationStructure::CommandInterface
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 < Ecoportal::API::GraphQL::Input::LocationStructure::CommandInterface
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 < Ecoportal::API::GraphQL::Input::LocationStructure::CommandInterface
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 < Ecoportal::API::GraphQL::Input::LocationStructure::CommandInterface
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 < Ecoportal::API::GraphQL::Base::Model
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,7 +2,7 @@ module Ecoportal
2
2
  module API
3
3
  class GraphQL
4
4
  module Input
5
- class SearchFilter < Ecoportal::API::GraphQL::Base::Model
5
+ class SearchFilter < Logic::BaseModel
6
6
  passthrough :id, :fieldName, :key, :operation
7
7
  passthrough :params, :path
8
8
  end
@@ -2,7 +2,7 @@ module Ecoportal
2
2
  module API
3
3
  class GraphQL
4
4
  module Input
5
- class SearchSorter < Ecoportal::API::GraphQL::Base::Model
5
+ class SearchSorter < Logic::BaseModel
6
6
  passthrough :direction, :key, :missing
7
7
  end
8
8
  end
@@ -0,0 +1,58 @@
1
+ module Ecoportal
2
+ module API
3
+ class GraphQL
4
+ module Interface
5
+ class BasePage < Logic::BaseModel
6
+ passkey :id
7
+ passthrough :name, :uid
8
+ passthrough :icon
9
+
10
+ class_resolver :location_node_class, 'Ecoportal::API::GraphQL::Interface::LocationStructure::Node'
11
+ class_resolver :user_class, 'Ecoportal::API::GraphQL::Base::User'
12
+ # class_resolver :force_class, 'Ecoportal::API::GraphQL::Base::Force'
13
+ # class_resolver :task_class, 'Ecoportal::API::GraphQL::Interface::Task'
14
+ # class_resolver :theme_class, 'Ecoportal::API::GraphQL::Base::Theme'
15
+ # class_resolver :template_class, 'Ecoportal::API::GraphQL::Base::Template'
16
+ # class_resolver :register_class, 'Ecoportal::API::GraphQL::Base::Register'
17
+ class_resolver :organization_class, 'Ecoportal::API::GraphQL::Base::Organization'
18
+
19
+ passthrough :autoSelectedLocations
20
+ embeds_many :locations, klass: :location_node_class, read_only: true
21
+ embeds_many :allLocations, klass: :location_node_class, read_only: true
22
+ passarray :otherTags, :baseTags
23
+
24
+ # embeds_one :state, klass: 'BasePage::StateEnum', read_only: true
25
+ passthrough :state
26
+ # embeds_one :taskPriority, klass: 'BasePage::TaskPriorityEnum', read_only: true
27
+ passthrough :taskPriority
28
+
29
+
30
+ passthrough :patchVer
31
+
32
+ passboolean :archived
33
+ passdate :archivedAt
34
+
35
+ passthrough :timeZone
36
+ passdate :createdAt, :updatedAt
37
+ passthrough :creatorName, :lastUpdatedByName
38
+ # embeds_one :creator, klass: :user_class, read_only: true
39
+
40
+ passboolean :hasForces
41
+ # embeds_many :forces, klass: :force_class
42
+
43
+ # embeds_many :tasks, klass: :task_class, read_only: true
44
+ # embeds_many :activeTasks, klass: :task_class, read_only: true
45
+
46
+ # embeds_one :theme, klass: :theme_class
47
+
48
+ passthrough :sourceTemplateId
49
+ # embeds_one :template, klass: :template_class, read_only: true
50
+ # embeds_many :registers, klass: :register_class, read_only: true
51
+ # embeds_one :organization, klass: :organization_class, read_only: true
52
+
53
+ passboolean :inSystemPagesEnabled, :printingEnabled
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -1,21 +1,25 @@
1
1
  module Ecoportal
2
2
  module API
3
3
  class GraphQL
4
- module Input
4
+ module Interface
5
5
  module LocationStructure
6
- class CommandInterface < Ecoportal::API::GraphQL::Base::Model
6
+ class Command < Logic::BaseModel
7
7
  passkey :id
8
8
  passthrough :state
9
9
 
10
- def initialize(*args, **kargs, &block)
11
- self.id = self.class.new_uuid
12
- super
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