Skip to content

Commit

Permalink
Refactor metadata-route to handle status generation for issue 2081
Browse files Browse the repository at this point in the history
  • Loading branch information
HerveRI committed Jan 9, 2025
1 parent ebc5267 commit 2e6a41d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 0 additions & 2 deletions policyengine_api/country.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ def __init__(self, country_package_name: str, country_id: str):

def build_metadata(self):
self.metadata = dict(
status="ok",
message=None,
result=dict(
variables=self.build_variables(),
parameters=self.build_parameters(),
Expand Down
16 changes: 15 additions & 1 deletion policyengine_api/routes/metadata_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,18 @@ def get_metadata(country_id: str) -> Response:
Args:
country_id (str): The country ID.
"""
return metadata_service.get_metadata(country_id)

# Retrieve country metadata and adding status and message
# to the response
country_metadata = metadata_service.get_metadata(country_id)
return Response(
json.dumps(
{
"status": "ok",
"message": None,
"result": country_metadata
}
),
status=200,
mimetype="application/json"
)

0 comments on commit 2e6a41d

Please sign in to comment.