This commit is contained in:
2023-06-02 21:11:04 +02:00
parent 320cc93d4d
commit 516893a98b
2 changed files with 16 additions and 9 deletions

View File

@@ -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<BookAuthor>, count: usize) -> String {
}
}
fn format_translators(translators: Vec<Translator>, count: usize) -> String {
fn format_translators(translators: Vec<BookTranslator>, count: usize) -> String {
if count == 0 {
return "".to_string()
}

View File

@@ -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<BookAuthor>,
pub translators: Vec<Translator>,
pub translators: Vec<BookTranslator>,
pub sequences: Vec<Sequence>,
pub genres: Vec<BookGenre>,
// source: Source,
@@ -175,7 +183,7 @@ pub struct SearchBook {
// uploaded: String,
pub annotation_exists: bool,
pub authors: Vec<BookAuthor>,
pub translators: Vec<Translator>,
pub translators: Vec<BookTranslator>,
pub sequences: Vec<Sequence>,
}
@@ -205,7 +213,7 @@ pub struct AuthorBook {
pub available_types: Vec<String>,
// uploaded: String,
pub annotation_exists: bool,
pub translators: Vec<Translator>,
pub translators: Vec<BookTranslator>,
pub sequences: Vec<Sequence>,
}
@@ -266,7 +274,7 @@ pub struct SequenceBook {
pub available_types: Vec<String>,
// uploaded: String,
pub authors: Vec<BookAuthor>,
pub translators: Vec<Translator>,
pub translators: Vec<BookTranslator>,
pub annotation_exists: bool,
}