rest_model/
pagination.rs

1use serde::{Deserialize, Serialize};
2use crate::Condition;
3
4#[derive(Debug, Deserialize, Serialize, Default)]
5pub struct PaginationParams {
6    pub page: Option<u32>,
7    pub limit: Option<u32>,
8    pub sort: Option<String>,
9    pub filter: Option<Condition>,
10    pub custom: Option<String>,
11}
12
13#[derive(Debug, Deserialize, Serialize)]
14pub struct Pagination {
15    pub total_count: u32,
16    pub total_pages: u32,
17    pub current_page: u32,
18    pub items_per_page: u32,
19}
20
21pub const HEADER_EXPOSE: &str = "Access-Control-Expose-Headers";
22pub const DEFAULT_PAGE: u32 = 1;
23pub const DEFAULT_LIMIT: u32 = 10;
24pub const HEADER_TOTAL_COUNT: &str = "X-Total-Count";
25pub const HEADER_TOTAL_PAGES: &str = "X-Total-Pages";
26pub const HEADER_CURRENT_PAGE: &str = "X-Current-Page";
27pub const HEADER_ITEMS_PER_PAGE: &str = "X-Items-Per-Page";