feat(db/m7-352): sqlc queries for system playlist runs + seed selection

Adds internal/db/queries/system_playlists.sql with 12 named queries
covering active-user enumeration, per-user run tracking (claim/finish/fail),
seed-artist/track/cover selection, and playlist CRUD by kind.
Runs sqlc generate to emit dbq/system_playlists.sql.go; also updates
playlists.sql.go and models.go to reflect the new kind/system_variant/
seed_artist_id columns added in migration 0015.

Note: plan specified a.cover_path for PickTopAlbumCoverForArtistByUser
but albums uses cover_art_path — corrected in the query file.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-04 08:14:20 -04:00
parent 36d05310ce
commit 3fe929cebd
4 changed files with 538 additions and 14 deletions
+21 -10
View File
@@ -336,16 +336,19 @@ type PlaySession struct {
}
type Playlist struct {
ID pgtype.UUID
UserID pgtype.UUID
Name string
Description string
IsPublic bool
CoverPath *string
TrackCount int32
DurationSec int32
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
ID pgtype.UUID
UserID pgtype.UUID
Name string
Description string
IsPublic bool
CoverPath *string
TrackCount int32
DurationSec int32
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
Kind string
SystemVariant *string
SeedArtistID pgtype.UUID
}
type PlaylistTrack struct {
@@ -388,6 +391,14 @@ type SkipEvent struct {
PositionMs int32
}
type SystemPlaylistRun struct {
UserID pgtype.UUID
LastRunAt pgtype.Timestamptz
LastRunDate pgtype.Date
InFlight bool
LastError *string
}
type Track struct {
ID pgtype.UUID
Title string