feat: backend MVP (auth/rbac, catalog, orders, fulfillment, invoices) + specs + scaffolds
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
use serde::Serialize;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct Paged<T: Serialize> {
|
||||
pub items: Vec<T>,
|
||||
pub total: i64,
|
||||
pub page: i64,
|
||||
pub per_page: i64,
|
||||
}
|
||||
|
||||
pub fn clamp_page(page: Option<i64>) -> i64 {
|
||||
page.unwrap_or(1).max(1)
|
||||
}
|
||||
|
||||
pub fn clamp_per_page(per_page: Option<i64>) -> i64 {
|
||||
per_page.unwrap_or(20).clamp(1, 100)
|
||||
}
|
||||
Reference in New Issue
Block a user