feat: faster member fetching and pagination
This commit is contained in:
parent
3816af56e3
commit
e9cc2a3f0e
4 changed files with 193 additions and 33 deletions
|
@ -4,7 +4,7 @@ use lettre::{
|
|||
transport::smtp::authentication::Credentials,
|
||||
};
|
||||
use log::debug;
|
||||
use serde::Deserialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
mod bans;
|
||||
|
@ -76,6 +76,20 @@ impl Cookies for Request<Body> {
|
|||
}
|
||||
*/
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct Pagination<T> {
|
||||
objects: Vec<T>,
|
||||
amount: i32,
|
||||
pages: i32,
|
||||
page: i32,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct PaginationRequest {
|
||||
pub page: i32,
|
||||
pub per_page: Option<i32>,
|
||||
}
|
||||
|
||||
fn load_or_empty<T>(
|
||||
query_result: Result<Vec<T>, diesel::result::Error>,
|
||||
) -> Result<Vec<T>, diesel::result::Error> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue