Skip to content

[Auto] Implement Update Todo endpoint (PATCH /todos/:id)#14

Draft
landoyjx wants to merge 1 commit intomainfrom
auto/7-implement-update-todo-endpoint--patch--todos--id
Draft

[Auto] Implement Update Todo endpoint (PATCH /todos/:id)#14
landoyjx wants to merge 1 commit intomainfrom
auto/7-implement-update-todo-endpoint--patch--todos--id

Conversation

@landoyjx
Copy link
Copy Markdown
Owner

Implement PATCH /todos/:id to partially update a Todo. Accept optional fields title (string, non-empty) and completed (boolean). Response should be 200 OK with the updated Todo object, or 404 Not Found if the id does not exist. updatedAt should be refreshed on every successful update.

Acceptance Criteria:

  • Updating only title changes title and updatedAt
  • Updating only completed changes completed and updatedAt
  • Updating both fields changes both and updatedAt
  • Returns 404 for non-existent id
  • Returns 400 if title is provided as empty string

Test Cases:

  • Integration: PATCH /todos/:id { "title": "New title" } returns updated Todo with new title and updated updatedAt
  • Integration: PATCH /todos/:id { "completed": true } returns updated Todo with completed=true
  • Integration: PATCH /todos/:id { "title": "A", "completed": false } returns updated Todo
  • Integration: PATCH /todos/:id with non-existent id returns 404
  • Integration: PATCH /todos/:id { "title": "" } returns 400
  • Edge: PATCH /todos/:id with {} returns 200 and Todo unchanged (or 400 depending on strictness; document behavior)

View issue: #7


Created by bass auto-programming

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