Add fb2 parser

This commit is contained in:
2025-09-08 20:33:23 +03:00
parent 96f15ab51e
commit 7037f6f316
6 changed files with 359 additions and 17 deletions

View File

@@ -160,10 +160,12 @@ impl Repository<book::Book, BookFilter> for BookRepository {
fn filter(&self, f: BookFilter) -> Box<dyn Iterator<Item = book::Book>> {
let mut author_ids: Vec<String> = vec![];
let mut use_author = false;
if let Some(author) = f.author {
if let Some(id) = author.id {
author_ids.push(id);
use_author = true;
}
if let Some(name) = author.name {
@@ -175,12 +177,13 @@ impl Repository<book::Book, BookFilter> for BookRepository {
&& author.clone().middle_name.unwrap().contains(&name))
{
author_ids.push(id.to_string());
use_author = true;
}
}
}
}
if author_ids.is_empty() {
if author_ids.is_empty() && use_author {
return Box::new(std::iter::empty::<book::Book>())
}