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.
1.3 KiB
1.3 KiB
| title | status | type | priority | created_at | updated_at |
|---|---|---|---|---|---|
| quotesdb/api: reports table and POST /api/quotes/:id/report endpoint | completed | feature | normal | 2026-03-10T23:32:08Z | 2026-03-10T23:32:08Z |
Summary
Create a reports table and a public endpoint for reporting quotes for moderation review.
Schema
CREATE TABLE reports (
id TEXT PRIMARY KEY, -- NanoID
quote_id TEXT NOT NULL REFERENCES quotes(id) ON DELETE CASCADE,
reason TEXT, -- optional, max 256 chars
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
API Endpoint
POST /api/quotes/:id/report
- Body: { reason?: string } — reason is optional, max 256 chars
- Validates reason length (400 if > 256 chars)
- Creates a report record
- Returns 201 on success
- Returns 404 if quote not found
Rate Limiting Note
Rate limiting will be handled separately at the Cloudflare layer (see infra ticket 06d304). No application-level rate limiting needed here.
Acceptance Criteria
- reports table created in migration
- POST /api/quotes/:id/report works
- reason is optional and validated (max 256 chars)
- 404 on unknown quote_id
- Unit tests cover success, missing quote, reason too long
Validation
cargo fmt && cargo check && cargo clippy && cargo test