Add GET /tags, POST /todos/:id/tags, DELETE /todos/:id/tags/:tag #15

Open
opened 2026-05-12 07:24:51 +00:00 by danny8632 · 1 comment
Owner

Parent: #13

Goal

Base off the branch produced by the previous issue. Add three new endpoints. GET /tags returns a deduplicated sorted array of every tag string currently attached to any todo. POST /todos/:id/tags attaches a tag (from request body field tag) to the specified todo, ignoring duplicates. DELETE /todos/:id/tags/:tag removes the named tag from the specified todo if present.

Done criteria

  • GET /tags returns 200 with Content-Type application/json and an array (empty [] when no todos have tags)
  • POST /todos/:id/tags with body {"tag":"urgent"} on an existing todo returns 200 or 201 and the todo's tags array includes "urgent"
  • POST /todos/:id/tags called twice with the same tag does not duplicate the tag in the todo's tags array
  • POST /todos/:id/tags with a non-existent :id returns 404
  • DELETE /todos/:id/tags/:tag on an existing todo that has the tag returns 200 or 204 and subsequent GET /todos no longer includes that tag on that todo
  • DELETE /todos/:id/tags/:tag on a non-existent :id returns 404
  • After attaching tag "alpha" to two todos and "beta" to one, GET /tags returns ["alpha","beta"] (sorted, deduplicated)

Hints

Reuse the in-memory todos array from the previous issue. For GET /tags, flatMap todos to their tags then deduplicate with a Set and sort. For the delete endpoint, use Array.filter to remove the tag.

Model

sonnet

Parent: #13 ## Goal Base off the branch produced by the previous issue. Add three new endpoints. GET /tags returns a deduplicated sorted array of every tag string currently attached to any todo. POST /todos/:id/tags attaches a tag (from request body field `tag`) to the specified todo, ignoring duplicates. DELETE /todos/:id/tags/:tag removes the named tag from the specified todo if present. ## Done criteria - [ ] GET /tags returns 200 with Content-Type application/json and an array (empty [] when no todos have tags) - [ ] POST /todos/:id/tags with body {"tag":"urgent"} on an existing todo returns 200 or 201 and the todo's tags array includes "urgent" - [ ] POST /todos/:id/tags called twice with the same tag does not duplicate the tag in the todo's tags array - [ ] POST /todos/:id/tags with a non-existent :id returns 404 - [ ] DELETE /todos/:id/tags/:tag on an existing todo that has the tag returns 200 or 204 and subsequent GET /todos no longer includes that tag on that todo - [ ] DELETE /todos/:id/tags/:tag on a non-existent :id returns 404 - [ ] After attaching tag "alpha" to two todos and "beta" to one, GET /tags returns ["alpha","beta"] (sorted, deduplicated) ## Hints Reuse the in-memory todos array from the previous issue. For GET /tags, flatMap todos to their tags then deduplicate with a Set and sort. For the delete endpoint, use Array.filter to remove the tag. ## Model sonnet
danny8632 added the agent:assign label 2026-05-12 07:24:51 +00:00
Author
Owner

agent dev-01: PR opened → #17

agent dev-01: PR opened → https://gitea.dannyhaslund.dk/danny8632/todo-app/pulls/17
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: danny8632/todo-app#15