Skip to content

feat(#8): add GET /items/:id endpoint - #9

Open
fullsend-ai-coder[bot] wants to merge 1 commit into
mainfrom
agent/8-get-item-by-id
Open

feat(#8): add GET /items/:id endpoint#9
fullsend-ai-coder[bot] wants to merge 1 commit into
mainfrom
agent/8-get-item-by-id

Conversation

@fullsend-ai-coder

Copy link
Copy Markdown

Add a new route handler for GET /items/int:item_id that retrieves a single todo item by its ID. Returns the item as JSON with status 200, or a 404 response with {"error": "item not found"} if the ID does not exist. This follows the same lookup pattern used by the existing PATCH and DELETE handlers.

Changes:

  • app.py: add get_item route handler
  • test_app.py: add test_get_item and test_get_item_not_found
  • README.md: add GET /items/:id to endpoint table

Closes #8

Post-script verification

  • Branch is not main/master (agent/8-get-item-by-id)
  • Secret scan passed (gitleaks — 47f7f1511df8ad7036c082d9b2179085cd9ec107..HEAD)
  • Pre-commit hooks passed (authoritative run on runner)
  • Tests ran inside sandbox

Add a new route handler for GET /items/<int:item_id> that retrieves
a single todo item by its ID. Returns the item as JSON with status
200, or a 404 response with {"error": "item not found"} if the ID
does not exist. This follows the same lookup pattern used by the
existing PATCH and DELETE handlers.

Changes:
- app.py: add get_item route handler
- test_app.py: add test_get_item and test_get_item_not_found
- README.md: add GET /items/:id to endpoint table

Closes #8
@fullsend-ai-review

Copy link
Copy Markdown

Review

Findings

Low

  • [code-organization] app.py:38 — The new get_item handler is placed between create_item (POST) and update_item (PATCH). An alternative ordering would place it after list_items (GET /items) to group GET methods together. However, the current placement groups all /items/:id operations together (GET, PATCH, DELETE), which is also a coherent pattern. Minor preference — either approach is valid.

  • [code-organization] test_app.py:28 — Test functions test_get_item and test_get_item_not_found are placed before test_create_item, mirroring the handler order in app.py. Consistent with the handler ordering choice above.

Info

  • [logic-error] app.py:30 — Pre-existing: ID assignment uses len(_get_items()) + 1, which produces duplicate IDs after deletions (e.g., create 1, 2, 3; delete 2; create another — new item gets ID 3 again). The new get_item endpoint inherits this — next() returns the first match of a duplicated ID. Not introduced by this PR.

@fullsend-ai-review fullsend-ai-review Bot added the ready-for-merge All reviewers approved — ready to merge label Jun 5, 2026
@manish-jangra

Copy link
Copy Markdown

/fs-retro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-merge All reviewers approved — ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Add GET /items/:id endpoint to retrieve a single item

1 participant