added count option and sorting for artists
This commit is contained in:
+17
-2
@@ -91,6 +91,7 @@ RELOAD_MIN_INTERVAL_SECONDS=30 uvicorn main:app
|
||||
| `date` | string | Exact match on the raw date string (`dd.mm.yy`) |
|
||||
| `upcoming` | bool | `true` = today or later, `false` = past events |
|
||||
| `sort` | string | `asc`/`desc` = chronological by event date (unparseable dates sort last either way); `az`/`za` = alphabetical by event name (case-insensitive) |
|
||||
| `count` | int ≥ 1 | Limit the number of results returned (applied after filtering and sorting) |
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -99,13 +100,14 @@ curl 'http://127.0.0.1:8000/events?free=true'
|
||||
curl 'http://127.0.0.1:8000/events?artist=randali&upcoming=true'
|
||||
curl 'http://127.0.0.1:8000/events?sort=asc'
|
||||
curl 'http://127.0.0.1:8000/events?sort=za'
|
||||
curl 'http://127.0.0.1:8000/events?sort=asc&count=5'
|
||||
curl 'http://127.0.0.1:8000/events/0'
|
||||
```
|
||||
|
||||
### `/artists` response shape
|
||||
### `/artists`
|
||||
|
||||
Each artist appears once, with every date (past or upcoming) they're on the
|
||||
line-up for, sorted chronologically:
|
||||
line-up for:
|
||||
|
||||
```json
|
||||
[
|
||||
@@ -113,3 +115,16 @@ line-up for, sorted chronologically:
|
||||
{ "artist_name": "Skkin Velvet", "dates": ["04.09.26"] }
|
||||
]
|
||||
```
|
||||
|
||||
| Param | Type | Meaning |
|
||||
|---------|---------|---------|
|
||||
| `sort` | string | `az`/`za` = alphabetical by artist name (case-insensitive, default `az`); `asc`/`desc` = chronological by each artist's *latest* date (an artist has many dates, so this is the one used to place them) — artists with no parseable date sort last either way |
|
||||
| `count` | int ≥ 1 | Limit the number of artists returned |
|
||||
|
||||
Each artist's own `dates` list is always chronological (earliest first),
|
||||
regardless of `sort` — `sort` only controls the order artists appear in.
|
||||
|
||||
```bash
|
||||
curl 'http://127.0.0.1:8000/artists?sort=desc' # most recently active first
|
||||
curl 'http://127.0.0.1:8000/artists?sort=desc&count=10' # top 10 most recently active
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user