diff --git a/src/bots/approved_bot/services/book_library/formaters.rs b/src/bots/approved_bot/services/book_library/formaters.rs index c9cc687..fff63c7 100644 --- a/src/bots/approved_bot/services/book_library/formaters.rs +++ b/src/bots/approved_bot/services/book_library/formaters.rs @@ -4,7 +4,7 @@ use crate::bots::approved_bot::modules::download::StartDownloadData; use super::types::{ Author, AuthorBook, Book, BookAuthor, BookGenre, SearchBook, Sequence, Translator, - TranslatorBook, SequenceBook, + TranslatorBook, SequenceBook, BookTranslator, }; const NO_LIMIT: usize = 4096; @@ -38,14 +38,13 @@ impl FormatInline for BookAuthor { } } -impl FormatInline for Translator { +impl FormatInline for BookTranslator { fn format_inline(&self) -> String { - let Translator { + let BookTranslator { id, first_name, last_name, middle_name, - .. } = self; format!("👤 {last_name} {first_name} {middle_name} /t_{id}") @@ -72,7 +71,7 @@ fn format_authors(authors: Vec, count: usize) -> String { } } -fn format_translators(translators: Vec, count: usize) -> String { +fn format_translators(translators: Vec, count: usize) -> String { if count == 0 { return "".to_string() } diff --git a/src/bots/approved_bot/services/book_library/types.rs b/src/bots/approved_bot/services/book_library/types.rs index 99779e1..a0ae97d 100644 --- a/src/bots/approved_bot/services/book_library/types.rs +++ b/src/bots/approved_bot/services/book_library/types.rs @@ -11,6 +11,14 @@ pub struct BookAuthor { pub middle_name: String, } +#[derive(Deserialize, Debug, Clone)] +pub struct BookTranslator { + pub id: u32, + pub first_name: String, + pub last_name: String, + pub middle_name: String, +} + #[derive(Deserialize, Debug, Clone)] pub struct BookGenre { pub id: u32, @@ -156,7 +164,7 @@ pub struct Book { // uploaded: String, pub annotation_exists: bool, pub authors: Vec, - pub translators: Vec, + pub translators: Vec, pub sequences: Vec, pub genres: Vec, // source: Source, @@ -175,7 +183,7 @@ pub struct SearchBook { // uploaded: String, pub annotation_exists: bool, pub authors: Vec, - pub translators: Vec, + pub translators: Vec, pub sequences: Vec, } @@ -205,7 +213,7 @@ pub struct AuthorBook { pub available_types: Vec, // uploaded: String, pub annotation_exists: bool, - pub translators: Vec, + pub translators: Vec, pub sequences: Vec, } @@ -266,7 +274,7 @@ pub struct SequenceBook { pub available_types: Vec, // uploaded: String, pub authors: Vec, - pub translators: Vec, + pub translators: Vec, pub annotation_exists: bool, }