Merge origin/main into wip/auditlog. Needed pagination
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful

This commit is contained in:
BAaboe 2025-08-05 10:02:30 +02:00
commit 6017b7087f
8 changed files with 213 additions and 46 deletions

View file

@ -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;
@ -78,6 +78,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> {