diff --git a/src/queries/tracks.rs b/src/queries/tracks.rs index 25cdae2..25ce75e 100644 --- a/src/queries/tracks.rs +++ b/src/queries/tracks.rs @@ -87,6 +87,13 @@ pub async fn get_by_artist(db: &DatabaseConnection, artist_id: i32) -> DbResult< .await?) } +pub async fn count_by_artist(db: &DatabaseConnection, artist_id: i32) -> DbResult { + Ok(Tracks::find() + .filter(track::Column::ArtistId.eq(artist_id)) + .count(db) + .await?) +} + /// Get tracks that need metadata enrichment — either no MBID at all, /// or have an MBID but are missing album info (e.g., freshly downloaded). pub async fn get_needing_metadata(db: &DatabaseConnection) -> DbResult> {