feat: add first listened to dates for media items (#92)

This commit is contained in:
Gabe Farrell 2025-11-18 19:50:34 -05:00 committed by GitHub
parent 300bac0e19
commit 800c77d05e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 134 additions and 2 deletions

View file

@ -89,8 +89,14 @@ func (d *Psql) GetTrack(ctx context.Context, opts db.GetTrackOpts) (*models.Trac
return nil, fmt.Errorf("GetTrack: CountTimeListenedToItem: %w", err)
}
firstListen, err := d.q.GetFirstListenFromTrack(ctx, track.ID)
if err != nil {
return nil, fmt.Errorf("GetAlbum: GetFirstListenFromRelease: %w", err)
}
track.ListenCount = count
track.TimeListened = seconds
track.FirstListen = firstListen.ListenedAt.Unix()
return &track, nil
}