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