From cbe1d53575e1a691579141c6488a6792e07f92b8 Mon Sep 17 00:00:00 2001 From: vickykohnen Date: Thu, 11 Dec 2025 17:15:44 +0100 Subject: [PATCH] feat(journal): Implement GET for single entry retrieval --- api/routers/journal_router.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/api/routers/journal_router.py b/api/routers/journal_router.py index 2becd60..08e1316 100644 --- a/api/routers/journal_router.py +++ b/api/routers/journal_router.py @@ -54,12 +54,18 @@ async def get_entry(request: Request, entry_id: str, entry_service: EntryService TODO: Implement this endpoint to return a single journal entry by ID Steps to implement: - 1. Use the entry_service to get the entry by ID - 2. Return 404 if entry not found - 3. Return the entry as JSON if found - - Hint: Check the update_entry endpoint for similar patterns - """ + """ + # 1. Use the entry_service to get the entry by ID + entry = await entry_service.get_entry(entry_id) + + # 2. Return 404 if entry not found + if entry is None: + raise HTTPException(status_code=404, detail=f"Entry with ID {entry_id} not found") + + # 3. Return the entry as JSON if found + return entry + + # Hint: Check the update_entry endpoint for similar patterns raise HTTPException(status_code=501, detail="Not implemented - complete this endpoint!") @router.patch("/entries/{entry_id}")