Skip to content

Commit

Permalink
obs coercion params
Browse files Browse the repository at this point in the history
  • Loading branch information
nimmolo committed Dec 20, 2024
1 parent db1d52f commit 9f85bc4
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
3 changes: 1 addition & 2 deletions app/classes/query/image_with_observations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ class ImageWithObservations < Query::ImageBase

def parameter_declarations
super.merge(
old_title?: :string,
old_by?: :string,
ids?: [Observation]
).merge(observations_parameter_declarations).
merge(observations_coercion_parameter_declarations).
merge(bounding_box_parameter_declarations).
merge(content_filter_parameter_declarations(Observation)).
merge(naming_consensus_parameter_declarations)
Expand Down
2 changes: 2 additions & 0 deletions app/classes/query/initializers/locations.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Query
module Initializers
# initializing methods inherited by all Query's for Locations
Expand Down
10 changes: 10 additions & 0 deletions app/classes/query/initializers/observations.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Query
module Initializers
# initializing methods inherited by all Query's for Observations
Expand Down Expand Up @@ -29,6 +31,14 @@ def observations_parameter_declarations
confidence?: [:float]
}
end

def observations_coercion_parameter_declarations
{
old_title?: :string,
old_by?: :string,
date?: [:date]
}
end
end
end
end
4 changes: 1 addition & 3 deletions app/classes/query/location_with_observations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ class LocationWithObservations < Query::LocationBase

def parameter_declarations
super.merge(
old_title?: :string,
old_by?: :string,
date?: [:date],
ids?: [Observation]
).merge(observations_parameter_declarations).
merge(observations_coercion_parameter_declarations).
merge(content_filter_parameter_declarations(Observation)).
merge(names_parameter_declarations).
merge(naming_consensus_parameter_declarations)
Expand Down
4 changes: 1 addition & 3 deletions app/classes/query/name_with_observations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ class NameWithObservations < Query::NameBase

def parameter_declarations
super.merge(
old_title?: :string,
old_by?: :string,
date?: [:date],
ids?: [Observation]
).merge(observations_parameter_declarations).
merge(observations_coercion_parameter_declarations).
merge(bounding_box_parameter_declarations).
merge(content_filter_parameter_declarations(Observation)).
merge(naming_consensus_parameter_declarations)
Expand Down
2 changes: 1 addition & 1 deletion app/classes/query/observation_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def local_parameter_declarations
regexp?: :string, # for coercions from location
needs_naming?: :boolean,
in_clade?: :string,
in_region?: :string,
in_region?: :string
}
end

Expand Down

0 comments on commit 9f85bc4

Please sign in to comment.