Skip to content

[Week7 - pky] Task1: Add DELETE endpoints and input validation#53

Open
kunyoungp wants to merge 1 commit into
mainfrom
week7-pky-task1
Open

[Week7 - pky] Task1: Add DELETE endpoints and input validation#53
kunyoungp wants to merge 1 commit into
mainfrom
week7-pky-task1

Conversation

@kunyoungp

Copy link
Copy Markdown

Summary

  • Added DELETE /notes/{note_id} endpoint (204 No Content, 404 if missing)
  • Added GET /action-items/{item_id} and DELETE /action-items/{item_id} endpoints
  • Added Pydantic Field constraints for input validation:
    • NoteCreate: title (1-200 chars), content (1-10,000 chars)
    • ActionItemCreate: description (1-2,000 chars)
    • NotePatch / ActionItemPatch: same constraints on optional fields

Test plan

  • test_delete_note — delete returns 204, subsequent GET returns 404
  • test_delete_note_not_found — delete non-existent note returns 404
  • test_note_validation_empty_title — empty title returns 422
  • test_note_validation_title_too_long — title >200 chars returns 422
  • test_get_action_item_by_id — GET returns 200 with correct data
  • test_get_action_item_not_found — GET non-existent returns 404
  • test_delete_action_item — delete returns 204
  • test_delete_action_item_not_found — delete non-existent returns 404
  • test_action_item_validation_empty_description — empty description returns 422
  • All 12 tests pass (make test)

Notable tradeoffs

  • DELETE returns 204 with no body (REST convention) rather than returning the deleted object
  • Field constraints use Pydantic v2 Field() for declarative validation rather than custom validators
  • NotePatch optional fields use Field(None, min_length=1, ...) so validation only triggers when a value is provided

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant