diff --git a/src/serializers/sequence.rs b/src/serializers/sequence.rs index 01d3eb2..bf2f386 100644 --- a/src/serializers/sequence.rs +++ b/src/serializers/sequence.rs @@ -33,6 +33,7 @@ pub struct SequenceBook { pub authors: Vec, pub translators: Vec, pub annotation_exists: bool, + pub position: i32, } impl From for SequenceBook { @@ -48,6 +49,7 @@ impl From for SequenceBook { translations, book_annotation, source, + book_sequences, .. } = value; @@ -62,6 +64,7 @@ impl From 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, } } } diff --git a/src/views/sequences.rs b/src/views/sequences.rs index 69bd610..e647d0c 100644 --- a/src/views/sequences.rs +++ b/src/views/sequences.rs @@ -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)