use std::sync::Arc; use calibre_db::data::pagination::SortOrder; use poem::{ handler, web::{Data, Html, Path}, }; use crate::{app_state::AppState, handlers::paginated}; #[handler] pub async fn handler_init(state: Data<&Arc>) -> Result, poem::Error> { paginated::render( "authors", || state.calibre.authors(25, None, &SortOrder::ASC), |author| author.sort.clone(), |cursor| state.calibre.has_previous_authors(cursor), |cursor| state.calibre.has_more_authors(cursor), ) } #[handler] pub async fn handler( Path((cursor, sort_order)): Path<(String, SortOrder)>, state: Data<&Arc>, ) -> Result, poem::Error> { paginated::render( "authors", || state.calibre.authors(25, Some(&cursor), &sort_order), |author| author.sort.clone(), |cursor| state.calibre.has_previous_authors(cursor), |cursor| state.calibre.has_more_authors(cursor), ) }