mirror of
https://github.com/flibusta-apps/book_library_server.git
synced 2025-12-06 07:05:36 +01:00
Add position to sequence books
This commit is contained in:
@@ -33,6 +33,7 @@ pub struct SequenceBook {
|
||||
pub authors: Vec<Author>,
|
||||
pub translators: Vec<Author>,
|
||||
pub annotation_exists: bool,
|
||||
pub position: i32,
|
||||
}
|
||||
|
||||
impl From<book::Data> for SequenceBook {
|
||||
@@ -48,6 +49,7 @@ impl From<book::Data> for SequenceBook {
|
||||
translations,
|
||||
book_annotation,
|
||||
source,
|
||||
book_sequences,
|
||||
..
|
||||
} = value;
|
||||
|
||||
@@ -62,6 +64,7 @@ impl From<book::Data> for SequenceBook {
|
||||
authors: get_authors(book_authors),
|
||||
translators: get_translators(translations),
|
||||
annotation_exists: book_annotation.unwrap().is_some(),
|
||||
position: book_sequences.unwrap().first().unwrap().position,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,6 +189,9 @@ async fn get_sequence_books(
|
||||
book::translations::fetch(vec![])
|
||||
.with(translator::author::fetch().with(author::author_annotation::fetch())),
|
||||
)
|
||||
.with(book::book_sequences::fetch(vec![
|
||||
book_sequence::sequence_id::equals(sequence.id),
|
||||
]))
|
||||
.order_by(book::id::order(prisma_client_rust::Direction::Asc))
|
||||
.skip((pagination.page - 1) * pagination.size)
|
||||
.take(pagination.size)
|
||||
|
||||
Reference in New Issue
Block a user