feat(M003/S03): play count column + data pipeline

Backend:
- GetAllTracksWithFullMetadata queries now select play_count and last_played
- mapTrackRow accepts and passes through PlayCount/LastPlayed
- PlayCount + LastPlayed added to library.Track struct
- sqlcgen Row types updated with new fields

Frontend:
- PlayCount + LastPlayed added to library.Track TypeScript model
- 'Plays' column added to track-list column definitions (60px, right-aligned, sortable)

Queries without play data (search, genre, album) pass 0/empty defaults.
This commit is contained in:
2026-03-21 15:33:08 -04:00
parent 9c85cfcc7b
commit 2ee157a376
5 changed files with 48 additions and 4 deletions
@@ -186,6 +186,16 @@ export const COLUMN_DEFS: Record<string, ColumnDef> = {
comparator: (a, b) =>
compareNum(a.FileSize, b.FileSize),
},
playCount: {
id: 'playCount',
label: 'Plays',
accessor: (t) =>
t.PlayCount ? String(t.PlayCount) : '',
defaultWidth: '60px',
align: 'right',
comparator: (a, b) =>
compareNum(a.PlayCount, b.PlayCount),
},
};
/**
+4
View File
@@ -266,6 +266,8 @@ export namespace library {
Channels: number;
Bitrate: number;
FileSize: number;
PlayCount: number;
LastPlayed: string;
static createFrom(source: any = {}) {
return new Track(source);
@@ -289,6 +291,8 @@ export namespace library {
this.Channels = source["Channels"];
this.Bitrate = source["Bitrate"];
this.FileSize = source["FileSize"];
this.PlayCount = source["PlayCount"];
this.LastPlayed = source["LastPlayed"];
}
}