Skip to content

Commit

Permalink
better naming for json and html routes
Browse files Browse the repository at this point in the history
  • Loading branch information
diversen7 committed Jan 23, 2025
1 parent 0104c84 commit 5c29dbf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
7 changes: 6 additions & 1 deletion stadsarkiv_client/endpoints/endpoints_records.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,12 @@ async def records_get(request: Request):
return templates.TemplateResponse(request, "records/record.html", context)


async def records_get_json(request: Request):
async def records_get_misc(request: Request):
"""
Miscellaneous presentations of the record data.
Mostly JSON for debugging.
Also some simple HTML rendering.
"""
try:

record_id = request.path_params["record_id"]
Expand Down
3 changes: 2 additions & 1 deletion stadsarkiv_client/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ async def robots_txt(request: Request):
Route("/auto_complete_relations", endpoint=endpoints_search.records_auto_complete_relations, name="records_auto_complete_relations"),
Route("/search/json", endpoint=endpoints_search.search_get_json, name="search_get_json"),
Route("/records/{record_id:str}", endpoint=endpoints_records.records_get, name="records_get"),
Route("/records/{record_id:str}/json/{type:str}", endpoint=endpoints_records.records_get_json, name="records_get_json"),
Route("/records/{record_id:str}/json/{type:str}", endpoint=endpoints_records.records_get_misc, name="records_get_json"),
Route("/records/{record_id:str}/html/{type:str}", endpoint=endpoints_records.records_get_misc, name="records_get_html"),
Route("/relations", endpoint=endpoints_relations.relations_post, name="relations_post", methods=["POST"]),
Route("/relations/{rel_id:str}", endpoint=endpoints_relations.relations_delete, name="relations_delete", methods=["DELETE"]),
Route("/relations/{type:str}/{id:str}", endpoint=endpoints_relations.relations_get, name="relations_get"),
Expand Down
2 changes: 1 addition & 1 deletion stadsarkiv_client/templates/records/record.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
{'label': 'JSON. Record fra API efter hooks', 'url': url_for('records_get_json', record_id=meta_data.id, type='record') | string},
{'label': 'JSON. Metadata', 'url': url_for('records_get_json', record_id=meta_data.id, type='meta_data') | string},
{'label': 'JSON. Typer og værdier', 'url': url_for('records_get_json', record_id=meta_data.id, type='record_and_types') | string},
{'label': 'HTML. Enkel visning', 'url': url_for('records_get_json', record_id=meta_data.id, type='record_and_types_parsed') | string}
{'label': 'HTML. Enkel visning', 'url': url_for('records_get_html', record_id=meta_data.id, type='record_and_types_parsed') | string}

] %}

Expand Down

0 comments on commit 5c29dbf

Please sign in to comment.