Feat: Add tag browser page at /tags with count-sorted tag list and library deep-link
- Extends GET /api/v1/tags with sort=count_desc and min_count query params - New TagsComponent at /tags (public, no auth guard) shows all tags sorted by image count - Clicking a tag navigates to /?tags=<name> for a pre-filtered library view - LibraryComponent reads ?tags= query param on init to support deep-linking from tag browser - Library header gains a "Browse tags" link to /tags for discoverability - All 15 TDD tasks complete; ruff, ng lint, and ng build clean Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
58
specs/007-tag-browser/contracts/tags-endpoint.md
Normal file
58
specs/007-tag-browser/contracts/tags-endpoint.md
Normal file
@@ -0,0 +1,58 @@
|
||||
# Contract: GET /api/v1/tags (enhanced)
|
||||
|
||||
## Overview
|
||||
|
||||
Extends the existing tags list endpoint with two new optional query parameters. All existing behaviour is preserved when the new parameters are omitted.
|
||||
|
||||
## Request
|
||||
|
||||
```
|
||||
GET /api/v1/tags
|
||||
```
|
||||
|
||||
### Query Parameters
|
||||
|
||||
| Parameter | Type | Default | Description |
|
||||
|------------|---------|----------|-------------|
|
||||
| `q` | string | — | Filter tags by name prefix (existing) |
|
||||
| `limit` | integer | 100 | Max items to return; capped at 200 (existing) |
|
||||
| `offset` | integer | 0 | Pagination offset (existing) |
|
||||
| `sort` | string | `name` | Sort order: `name` (alphabetical asc) or `count_desc` (image count descending, alphabetical secondary) |
|
||||
| `min_count`| integer | 0 | Exclude tags with fewer than this many images. Use `1` to hide zero-count tags. |
|
||||
|
||||
### Authentication
|
||||
|
||||
Not required. Public endpoint.
|
||||
|
||||
## Response
|
||||
|
||||
```json
|
||||
{
|
||||
"items": [
|
||||
{ "id": "uuid", "name": "string", "image_count": 0 }
|
||||
],
|
||||
"total": 0,
|
||||
"limit": 100,
|
||||
"offset": 0
|
||||
}
|
||||
```
|
||||
|
||||
No changes to the response shape.
|
||||
|
||||
## Tag Browser Usage
|
||||
|
||||
The tag browser component calls:
|
||||
|
||||
```
|
||||
GET /api/v1/tags?sort=count_desc&min_count=1&limit=500
|
||||
```
|
||||
|
||||
`limit=500` is a safe upper bound for a personal library. If `total` exceeds `limit` in the response, the component logs a warning but renders what it received (no pagination UI required at this scale).
|
||||
|
||||
## Library Autocomplete Usage (unchanged)
|
||||
|
||||
```
|
||||
GET /api/v1/tags?q=<prefix>&limit=10
|
||||
```
|
||||
|
||||
Uses neither `sort` nor `min_count` — default behaviour is unchanged.
|
||||
Reference in New Issue
Block a user