fix: address code review findings

This commit is contained in:
2026-07-19 19:28:51 +03:00
parent 401c1218b6
commit beef81d598
4 changed files with 14 additions and 6 deletions

View File

@@ -29,7 +29,7 @@ func GetExternalRelease(db *DB, rgid string) (*ExternalRelease, error) {
func SaveExternalRelease(db *DB, release *ExternalRelease) error {
var cachedAt interface{}
if !release.CachedAt.IsZero() {
cachedAt = release.CachedAt.UTC().Format("2006-01-02 15:04:05")
cachedAt = release.CachedAt
}
_, err := db.Conn().Exec(
"INSERT OR REPLACE INTO external_releases (rgid, artist_id, title, type, release_date, is_ignored, cached_at) VALUES (?, ?, ?, ?, ?, ?, ?)",
@@ -125,7 +125,7 @@ func GetExternalReleasesByArtistWithCache(db *DB, artistID string, ttl time.Dura
cutoff := time.Now().UTC().Add(-ttl)
rows, err := db.Conn().Query(
"SELECT rgid, artist_id, title, type, release_date, is_ignored, cached_at FROM external_releases WHERE artist_id = ? AND cached_at >= ?",
artistID, cutoff.Format("2006-01-02 15:04:05"),
artistID, cutoff,
)
if err != nil {
return nil, fmt.Errorf("query cached external releases: %w", err)