fix: mapTrackRow accepts time.Time for LastPlayed (matches sqlcgen Row type)

This commit is contained in:
2026-03-21 15:36:59 -04:00
parent 2ee157a376
commit b643aee5a3
+14 -8
View File
@@ -6,6 +6,7 @@ import (
"fmt" "fmt"
"strconv" "strconv"
"strings" "strings"
"time"
"yellowjacket/backend/coverart" "yellowjacket/backend/coverart"
"yellowjacket/backend/database/sql/sqlcgen" "yellowjacket/backend/database/sql/sqlcgen"
@@ -66,8 +67,13 @@ func mapTrackRow(
composer, fileType string, composer, fileType string,
sampleRate, bitDepth, channels, bitrate, fileSize int64, sampleRate, bitDepth, channels, bitrate, fileSize int64,
playCount int64, playCount int64,
lastPlayed string, lastPlayed time.Time,
) Track { ) Track {
var lastPlayedStr string
if !lastPlayed.IsZero() {
lastPlayedStr = lastPlayed.Format(time.DateTime)
}
return Track{ return Track{
TrackName: title, TrackName: title,
ArtistName: artistName, ArtistName: artistName,
@@ -86,7 +92,7 @@ func mapTrackRow(
Bitrate: bitrate, Bitrate: bitrate,
FileSize: fileSize, FileSize: fileSize,
PlayCount: playCount, PlayCount: playCount,
LastPlayed: lastPlayed, LastPlayed: lastPlayedStr,
} }
} }
@@ -204,7 +210,7 @@ func (l *Library) SearchTracks(
row.Channels, row.Channels,
row.Bitrate, row.Bitrate,
row.FileSize, row.FileSize,
0, "", 0, time.Time{},
)) ))
} }
@@ -244,7 +250,7 @@ func (l *Library) GetAlbumTracks(albumID int64) ([]Track, error) {
row.Channels, row.Channels,
row.Bitrate, row.Bitrate,
row.FileSize, row.FileSize,
0, "", 0, time.Time{},
)) ))
} }
@@ -419,7 +425,7 @@ func (l *Library) GetTracksByGenre(
row.Channels, row.Channels,
row.Bitrate, row.Bitrate,
row.FileSize, row.FileSize,
0, "", 0, time.Time{},
)) ))
} }
@@ -735,7 +741,7 @@ func (l *Library) GetTracksByGenreByLibrary(
row.Channels, row.Channels,
row.Bitrate, row.Bitrate,
row.FileSize, row.FileSize,
0, "", 0, time.Time{},
)) ))
} }
@@ -787,7 +793,7 @@ func (l *Library) GetAlbumTracksByLibrary(
row.Channels, row.Channels,
row.Bitrate, row.Bitrate,
row.FileSize, row.FileSize,
0, "", 0, time.Time{},
)) ))
} }
@@ -835,7 +841,7 @@ func (l *Library) SearchTracksByLibrary(
row.Channels, row.Channels,
row.Bitrate, row.Bitrate,
row.FileSize, row.FileSize,
0, "", 0, time.Time{},
)) ))
} }