Stage 4 of the ABS-compat port. Five handlers:
- GET /abs/api/me/progress
- GET /abs/api/me/progress/{libraryItemId}
- POST /abs/api/me/progress/{libraryItemId}
- PATCH /abs/api/session/{sid}
- POST /abs/api/session/{sid}/close
Reads/writes hit silo's user_watch_progress (keyed by user_id,
profile_id, content_id) for resume positions and the new
abs_playback_sessions table (migration 143) for per-session
listening-time tracking.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
21 lines
397 B
Go
21 lines
397 B
Go
package abs
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestProgressRowToABSEmitsDuration(t *testing.T) {
|
|
out := progressRowToABS(ProgressRow{
|
|
UserID: "u1",
|
|
ContentID: "b1",
|
|
CurrentSeconds: 30,
|
|
DurationSeconds: 3600,
|
|
ProgressPct: 0.0083,
|
|
UpdatedAt: time.Now(),
|
|
})
|
|
if out["duration"] != float64(3600) {
|
|
t.Errorf("duration = %v, want 3600", out["duration"])
|
|
}
|
|
}
|