feat: Add unix timestamp date range parameters for fetching paginated listens (#98)

This commit is contained in:
Matt Foxx 2025-11-20 11:43:09 -05:00 committed by GitHub
parent 620e3b65cb
commit c77481fd59
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 27 additions and 10 deletions

View file

@ -42,6 +42,10 @@ func OptsFromRequest(r *http.Request) db.GetItemsOpts {
month, _ := strconv.Atoi(monthStr)
yearStr := r.URL.Query().Get("year")
year, _ := strconv.Atoi(yearStr)
fromStr := r.URL.Query().Get("from")
from, _ := strconv.Atoi(fromStr)
toStr := r.URL.Query().Get("to")
to, _ := strconv.Atoi(toStr)
artistIdStr := r.URL.Query().Get("artist_id")
artistId, _ := strconv.Atoi(artistIdStr)
@ -67,8 +71,8 @@ func OptsFromRequest(r *http.Request) db.GetItemsOpts {
period = db.PeriodDay
}
l.Debug().Msgf("OptsFromRequest: Parsed options: limit=%d, page=%d, week=%d, month=%d, year=%d, artist_id=%d, album_id=%d, track_id=%d, period=%s",
limit, page, week, month, year, artistId, albumId, trackId, period)
l.Debug().Msgf("OptsFromRequest: Parsed options: limit=%d, page=%d, week=%d, month=%d, year=%d, from=%d, to=%d, artist_id=%d, album_id=%d, track_id=%d, period=%s",
limit, page, week, month, year, from, to, artistId, albumId, trackId, period)
return db.GetItemsOpts{
Limit: limit,
@ -77,6 +81,8 @@ func OptsFromRequest(r *http.Request) db.GetItemsOpts {
Week: week,
Month: month,
Year: year,
From: from,
To: to,
ArtistID: artistId,
AlbumID: albumId,
TrackID: trackId,