Skip to content

Commit d71eaa9

Browse files
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.toml
1 parent 8474a6b commit d71eaa9

File tree

6 files changed

+1951
-647
lines changed

6 files changed

+1951
-647
lines changed

.env.example

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
DB_URL=wss://example.surreal.cloud
2+
DB_NS=dev
3+
DB_NAME=test_db
4+
5+
DB_USER=admin
6+
DB_PASSWORD=changeme
7+
8+
HCAPTCHA_SECRET=your_hcaptcha_secret_here
9+
10+
JWT_SECRET=your_jwt_secret_here
11+
12+
WEBSITE_URL=https://example.com
13+
14+
TOKEN_DURATION_MIN=120

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/target
22
/data
33
.env
4+
.env.local
5+
.env.*.local
46

57
create_tables.md
68
new_database_schema.surql

0 commit comments

Comments
 (0)