Commit d71eaa9
committed
fix(api): harden album listen tracking; add tests
- Rework listen_to_album to try UPDATE first, then perform a
transactional RELATE/UPDATE fallback when relation is missing
- Coalesce missing fields when updating (total_listens, total_duration)
and cap recent_dates to the 30 most recent entries
- Always update album total_listens counter
- Normalize pagination limits to be at least 1 to avoid zero-limit
queries
- Remove NULLS LAST from recent sorting for compatibility
- Add comprehensive AlbumService tests covering fetching, relations,
filtering, sorting, pagination, listen tracking (including
concurrency), and recent_dates capping
- Update .gitignore to ignore local env files
- Add GPL-3.0-or-later license to Cargo.toml1 parent 8474a6b commit d71eaa9
File tree
6 files changed
+1951
-647
lines changed- src/services
6 files changed
+1951
-647
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
| |||
0 commit comments