Skip to content

Commit

Permalink
Added possible values for the output schema of the API for coverage i…
Browse files Browse the repository at this point in the history
…dentfiers
  • Loading branch information
ricardogsilva committed Jul 22, 2024
1 parent f003205 commit c95f477
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion arpav_ppcv/webapp/api_v2/schemas/coverages.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ class CoverageIdentifierReadListItem(pydantic.BaseModel):
related_coverage_configuration_url: str
wms_base_url: str
wms_main_layer_name: str | None = None
possible_values: list[ConfigurationParameterPossibleValueRead]

@classmethod
def from_db_instance(
Expand All @@ -179,7 +180,6 @@ def from_db_instance(
thredds_url_fragment,
)
)

return cls(
identifier=instance.identifier,
wms_base_url=wms_base_url,
Expand All @@ -190,6 +190,21 @@ def from_db_instance(
coverage_configuration_id=instance.configuration.id,
)
),
possible_values=[
ConfigurationParameterPossibleValueRead(
configuration_parameter_name=pv.configuration_parameter_value.configuration_parameter.name,
configuration_parameter_display_name_english=(
pv.configuration_parameter_value.configuration_parameter.display_name_english
),
configuration_parameter_display_name_italian=(
pv.configuration_parameter_value.configuration_parameter.display_name_italian
),
configuration_parameter_value=pv.configuration_parameter_value.name,
)
for pv in instance.configuration.retrieve_used_values(
instance.identifier
)
],
)


Expand Down

0 comments on commit c95f477

Please sign in to comment.