Skip to content

[Week7 - hjy] Task1: Add endpoints and input validation#57

Open
HyungjoonYang wants to merge 1 commit into
mainfrom
week7-hjy-task1
Open

[Week7 - hjy] Task1: Add endpoints and input validation#57
HyungjoonYang wants to merge 1 commit into
mainfrom
week7-hjy-task1

Conversation

@HyungjoonYang

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, non-blank), content (non-blank)
    • ActionItemCreate: description (non-blank)
    • NotePatch / ActionItemPatch: same constraints on optional fields
  • Added query param validation: skip >= 0, 1 <= limit <= 200
  • Invalid sort field now returns 400 instead of silent fallback

Test plan

  • DELETE note → 204, subsequent GET → 404
  • DELETE nonexistent note → 404
  • GET /action-items/{id} → 200, nonexistent → 404
  • DELETE action item → 204, subsequent GET → 404
  • Empty/whitespace title/content/description → 422
  • Title > 200 chars → 422
  • Negative skip, zero/excess limit → 422
  • Invalid sort field → 400
  • All 27 tests pass

Notable tradeoffs

  • DELETE returns 204 with no body (REST convention)
  • Whitespace-only validation uses field_validator on top of min_length for stricter checking
  • Hard delete, no soft-delete/undo

🤖 Generated with Claude Code

Add DELETE for notes/action-items, GET for single action item.
Add Pydantic field validation (blank strings, title length) and
query param constraints (skip >= 0, limit 1-200, invalid sort → 400).
24 new tests covering all new endpoints and validation cases.

Co-Authored-By: Claude Opus 4.6 (1M context) <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