mirror of
https://github.com/flibusta-apps/book_bot.git
synced 2025-12-06 15:35:35 +01:00
Fix getting sequence books
This commit is contained in:
@@ -4,7 +4,7 @@ use crate::bots::approved_bot::modules::download::StartDownloadData;
|
|||||||
|
|
||||||
use super::types::{
|
use super::types::{
|
||||||
Author, AuthorBook, Book, BookAuthor, BookGenre, SearchBook, Sequence, Translator,
|
Author, AuthorBook, Book, BookAuthor, BookGenre, SearchBook, Sequence, Translator,
|
||||||
TranslatorBook,
|
TranslatorBook, SequenceBook,
|
||||||
};
|
};
|
||||||
|
|
||||||
const NO_LIMIT: usize = 4096;
|
const NO_LIMIT: usize = 4096;
|
||||||
@@ -397,3 +397,9 @@ impl Format for TranslatorBook {
|
|||||||
Into::<Book>::into(self.clone()).format(max_size)
|
Into::<Book>::into(self.clone()).format(max_size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Format for SequenceBook {
|
||||||
|
fn format(&self, max_size: usize) -> FormatResult {
|
||||||
|
Into::<Book>::into(self.clone()).format(max_size)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ pub async fn get_sequence_books(
|
|||||||
id: u32,
|
id: u32,
|
||||||
page: u32,
|
page: u32,
|
||||||
allowed_langs: Vec<String>,
|
allowed_langs: Vec<String>,
|
||||||
) -> Result<types::Page<types::SearchBook>, Box<dyn std::error::Error + Send + Sync>> {
|
) -> Result<types::Page<types::SequenceBook>, Box<dyn std::error::Error + Send + Sync>> {
|
||||||
let mut params = get_allowed_langs_params(allowed_langs);
|
let mut params = get_allowed_langs_params(allowed_langs);
|
||||||
|
|
||||||
params.push(("page", page.to_string()));
|
params.push(("page", page.to_string()));
|
||||||
|
|||||||
@@ -255,3 +255,34 @@ impl From<TranslatorBook> for Book {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
|
pub struct SequenceBook {
|
||||||
|
pub id: u32,
|
||||||
|
pub title: String,
|
||||||
|
pub lang: String,
|
||||||
|
// file_type: String,
|
||||||
|
pub available_types: Vec<String>,
|
||||||
|
// uploaded: String,
|
||||||
|
pub authors: Vec<BookAuthor>,
|
||||||
|
pub translators: Vec<Translator>,
|
||||||
|
pub annotation_exists: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<SequenceBook> for Book {
|
||||||
|
fn from(value: SequenceBook) -> Self {
|
||||||
|
Book {
|
||||||
|
id: value.id,
|
||||||
|
title: value.title,
|
||||||
|
lang: value.lang,
|
||||||
|
available_types: value.available_types,
|
||||||
|
annotation_exists: value.annotation_exists,
|
||||||
|
authors: value.authors,
|
||||||
|
translators: value.translators,
|
||||||
|
sequences: vec![],
|
||||||
|
genres: vec![],
|
||||||
|
pages: None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user