feat: add SongSearchService and GET /songs?q= search endpoint

This commit is contained in:
2026-04-08 03:35:33 +02:00
parent c3b7cb78ab
commit 377fe957bc
9 changed files with 98 additions and 12 deletions

View File

@@ -9,5 +9,5 @@ pub use chord::Chord;
pub use song::{ChordPosition, LyricLine, Section, SectionKind, SongMeta, Song};
pub use song::{song_preview_chords, StoredSong, SongSummary};
pub use ports::{FetchError, ParseError, TabFetcherPort, TabParserPort, TabSource};
pub use ports::{RepositoryError, SongRepositoryPort};
pub use ports::{RepositoryError, SongRepositoryPort, SongSearchPort};
pub use transposer::{ChordTransposer, TransposeError};

View File

@@ -54,3 +54,8 @@ pub trait SongRepositoryPort: Send + Sync {
async fn get(&self, id: Uuid) -> Result<Option<Song>, RepositoryError>;
async fn delete(&self, id: Uuid) -> Result<(), RepositoryError>;
}
#[async_trait]
pub trait SongSearchPort: Send + Sync {
async fn search(&self, query: &str) -> Result<Vec<SongSummary>, RepositoryError>;
}