Class: Ecoportal::API::GraphQL::Base::LocationStructure::Draft
Defined Under Namespace
Classes: Structure
Constant Summary
Common::GraphQL::Model::Diffable::DIFF_CLASS
Instance Method Summary
collapse
#conflictingIds, #locations_error?, #locations_error_doc, #validationErrors, #validationErrors?
#as_input
#as_update, #dirty?
Instance Method Details
#conflictingIds? ⇒ Boolean
78
79
80
|
# File 'lib/ecoportal/api/graphql/base/location_structure/draft.rb', line 78
def conflictingIds?
(conflictingIds || []).any?
end
|
#error? ⇒ Boolean
28
29
30
31
32
|
# File 'lib/ecoportal/api/graphql/base/location_structure/draft.rb', line 28
def error?
!ok? ||
result_errors? ||
conflictingIds?
end
|
#error_doc ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/ecoportal/api/graphql/base/location_structure/draft.rb', line 34
def error_doc
if result_errors?
{
results: [result_errors.first&.error_doc]
}
elsif conflictingIds?
{
conflictingIds: conflictingIds.doc
}
elsif !ok?
{
ok: false
}
end
end
|
#parent_structure ⇒ Object
Note:
draft is in a collection of drafts
63
64
65
66
67
68
|
# File 'lib/ecoportal/api/graphql/base/location_structure/draft.rb', line 63
def parent_structure
return unless _parent != self
return unless _parent._parent != _parent
_parent._parent
end
|
#result_errors ⇒ Object
74
75
76
|
# File 'lib/ecoportal/api/graphql/base/location_structure/draft.rb', line 74
def result_errors
results.select(&:error?)
end
|
#result_errors? ⇒ Boolean
70
71
72
|
# File 'lib/ecoportal/api/graphql/base/location_structure/draft.rb', line 70
def result_errors?
result_errors.any?
end
|
#structure_id ⇒ Object
54
55
56
|
# File 'lib/ecoportal/api/graphql/base/location_structure/draft.rb', line 54
def structure_id
parent_structure&.id
end
|
#structure_name ⇒ Object
58
59
60
|
# File 'lib/ecoportal/api/graphql/base/location_structure/draft.rb', line 58
def structure_name
parent_structure&.name
end
|
#success? ⇒ Boolean
50
51
52
|
# File 'lib/ecoportal/api/graphql/base/location_structure/draft.rb', line 50
def success?
!error?
end
|