Refactoring
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
use crate::domain::author::Author;
|
||||
use crate::domain::repository::{BookFilter, Repository};
|
||||
use crate::domain::{author, book};
|
||||
use std::collections::HashMap;
|
||||
@@ -61,7 +60,7 @@ impl Into<book::Book> for Book {
|
||||
|
||||
pub struct BookRepository {
|
||||
books: Vec<Book>,
|
||||
authors: HashMap<Uuid, Author>,
|
||||
authors: HashMap<Uuid, author::Author>,
|
||||
author_uniques: HashMap<String, Uuid>,
|
||||
}
|
||||
|
||||
@@ -110,10 +109,7 @@ impl Repository<book::Book, BookFilter> for BookRepository {
|
||||
self.books.push(item.into());
|
||||
}
|
||||
|
||||
fn bulk_add<I>(&mut self, items: I)
|
||||
where
|
||||
I: IntoIterator<Item = book::Book>,
|
||||
{
|
||||
fn bulk_add(&mut self, items: Vec<book::Book>) {
|
||||
items.into_iter().for_each(|item| {
|
||||
if self.get(item.id.to_string()).is_none() {
|
||||
self.add(item)
|
||||
|
||||
Reference in New Issue
Block a user