treewide: complete book management interface
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: If5a21f16221f3c56a8008e139f93edc46a6a6964
This commit is contained in:
parent
bda36ac152
commit
2f31242442
23 changed files with 1693 additions and 126 deletions
|
|
@ -144,6 +144,7 @@ pub trait StorageBackend: Send + Sync + 'static {
|
|||
async fn list_media_paths(&self) -> Result<Vec<(MediaId, std::path::PathBuf, ContentHash)>>;
|
||||
|
||||
// Batch metadata update
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
async fn batch_update_media(
|
||||
&self,
|
||||
ids: &[MediaId],
|
||||
|
|
@ -446,6 +447,69 @@ pub trait StorageBackend: Send + Sync + 'static {
|
|||
|
||||
/// List all active sessions (optionally filtered by username)
|
||||
async fn list_active_sessions(&self, username: Option<&str>) -> Result<Vec<SessionData>>;
|
||||
|
||||
// Book Management Methods
|
||||
|
||||
/// Upsert book metadata for a media item
|
||||
async fn upsert_book_metadata(&self, metadata: &crate::model::BookMetadata) -> Result<()>;
|
||||
|
||||
/// Get book metadata for a media item
|
||||
async fn get_book_metadata(
|
||||
&self,
|
||||
media_id: MediaId,
|
||||
) -> Result<Option<crate::model::BookMetadata>>;
|
||||
|
||||
/// Add an author to a book
|
||||
async fn add_book_author(
|
||||
&self,
|
||||
media_id: MediaId,
|
||||
author: &crate::model::AuthorInfo,
|
||||
) -> Result<()>;
|
||||
|
||||
/// Get all authors for a book
|
||||
async fn get_book_authors(&self, media_id: MediaId) -> Result<Vec<crate::model::AuthorInfo>>;
|
||||
|
||||
/// List all distinct authors with book counts
|
||||
async fn list_all_authors(&self, pagination: &Pagination) -> Result<Vec<(String, u64)>>;
|
||||
|
||||
/// List all series with book counts
|
||||
async fn list_series(&self) -> Result<Vec<(String, u64)>>;
|
||||
|
||||
/// Get all books in a series, ordered by series_index
|
||||
async fn get_series_books(&self, series_name: &str) -> Result<Vec<MediaItem>>;
|
||||
|
||||
/// Update reading progress for a user and book
|
||||
async fn update_reading_progress(
|
||||
&self,
|
||||
user_id: uuid::Uuid,
|
||||
media_id: MediaId,
|
||||
current_page: i32,
|
||||
) -> Result<()>;
|
||||
|
||||
/// Get reading progress for a user and book
|
||||
async fn get_reading_progress(
|
||||
&self,
|
||||
user_id: uuid::Uuid,
|
||||
media_id: MediaId,
|
||||
) -> Result<Option<crate::model::ReadingProgress>>;
|
||||
|
||||
/// Get reading list for a user filtered by status
|
||||
async fn get_reading_list(
|
||||
&self,
|
||||
user_id: uuid::Uuid,
|
||||
status: Option<crate::model::ReadingStatus>,
|
||||
) -> Result<Vec<MediaItem>>;
|
||||
|
||||
/// Search books with book-specific criteria
|
||||
async fn search_books(
|
||||
&self,
|
||||
isbn: Option<&str>,
|
||||
author: Option<&str>,
|
||||
series: Option<&str>,
|
||||
publisher: Option<&str>,
|
||||
language: Option<&str>,
|
||||
pagination: &Pagination,
|
||||
) -> Result<Vec<MediaItem>>;
|
||||
}
|
||||
|
||||
/// Comprehensive library statistics.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue