feat: add sort params to list/search, capo-aware GET /songs/{id}?apply_capo=true
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use domain::{RepositoryError, Song, SongRepositoryPort, SongSearchPort, SongSummary, StoredSong};
|
||||
use domain::{RepositoryError, Song, SongRepositoryPort, SongSearchPort, SongSummary, StoredSong, SortField, SortOrder};
|
||||
use uuid::Uuid;
|
||||
|
||||
pub struct SongService {
|
||||
@@ -14,8 +14,8 @@ impl SongService {
|
||||
self.repo.save(song).await
|
||||
}
|
||||
|
||||
pub async fn list(&self) -> Result<Vec<SongSummary>, RepositoryError> {
|
||||
self.repo.list().await
|
||||
pub async fn list(&self, sort: SortField, order: SortOrder) -> Result<Vec<SongSummary>, RepositoryError> {
|
||||
self.repo.list(sort, order).await
|
||||
}
|
||||
|
||||
pub async fn get(&self, id: Uuid) -> Result<Option<Song>, RepositoryError> {
|
||||
@@ -46,7 +46,7 @@ impl SongSearchService {
|
||||
Self { search }
|
||||
}
|
||||
|
||||
pub async fn search(&self, query: &str) -> Result<Vec<domain::SongSummary>, domain::RepositoryError> {
|
||||
self.search.search(query).await
|
||||
pub async fn search(&self, query: &str, sort: SortField, order: SortOrder) -> Result<Vec<domain::SongSummary>, domain::RepositoryError> {
|
||||
self.search.search(query, sort, order).await
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user