You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.5 KiB
Markdown
46 lines
1.5 KiB
Markdown
+++
|
|
title = "Implement GET /api/quotes/:id — fetch by NanoID, return 404 if not found"
|
|
priority = 5
|
|
status = "todo"
|
|
ticket_type = "task"
|
|
dependencies = ["a5049d", "d792e2", "175382"]
|
|
+++
|
|
|
|
<context>
|
|
The `quotesdb` API is built with Axum + Tokio, targeting Cloudflare Workers via `workers-rs`. It serves JSON at `/api/*` endpoints and persists data to Cloudflare D1 (production) or a local SQLite file via Turso (development). Source lives in `src/bin/api/`.
|
|
|
|
Shared types and utilities are in `src/lib.rs` — code placed there must compile for both the host target and `wasm32-unknown-unknown`.
|
|
|
|
`GET /api/quotes/:id` returns a single quote by its NanoID. Returns 404 if no quote with that ID exists.
|
|
</context>
|
|
|
|
<goal>
|
|
Implement the `GET /api/quotes/:id` handler that looks up a quote by NanoID, fetches its tags, and returns the full quote JSON. Return 404 if the ID is not found.
|
|
</goal>
|
|
|
|
<constraints>
|
|
- Extract the `:id` path parameter using Axum's `Path` extractor.
|
|
- Include the quote's tags in the response.
|
|
- Return `404 Not Found` with `{"error": "not found"}` if the ID doesn't match any row.
|
|
</constraints>
|
|
|
|
<skills>
|
|
Use `superpowers:test-driven-development` — write tests for: 200 with quote object, 404 not found.
|
|
Use `superpowers:verification-before-completion` before closing.
|
|
</skills>
|
|
|
|
<validation>
|
|
Run in order from the `quotesdb/` directory:
|
|
|
|
```sh
|
|
cargo fmt
|
|
cargo check
|
|
cargo clippy
|
|
cargo test
|
|
```
|
|
</validation>
|
|
|
|
<commit>
|
|
`feat(quotesdb): implement GET /api/quotes/:id`
|
|
</commit>
|