feat(customers): add time range filtering and count functionality to customer list endpoints (#9767)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Venu Madhav Bandarupalli
2025-10-16 12:36:12 +05:30
committed by GitHub
parent e7dee751b5
commit 587588f870
19 changed files with 482 additions and 11 deletions

View File

@ -0,0 +1,21 @@
use crate::core::errors::{self, CustomResult};
pub const CUSTOMER_LIST_LOWER_LIMIT: u16 = 1;
pub const CUSTOMER_LIST_UPPER_LIMIT: u16 = 100;
pub const CUSTOMER_LIST_DEFAULT_LIMIT: u16 = 10;
pub fn validate_customer_list_limit(
limit: Option<u16>,
) -> CustomResult<u16, errors::ApiErrorResponse> {
match limit {
Some(l) if (CUSTOMER_LIST_LOWER_LIMIT..=CUSTOMER_LIST_UPPER_LIMIT).contains(&l) => Ok(l),
Some(_) => Err(errors::ApiErrorResponse::InvalidRequestData {
message: format!(
"limit should be between {} and {}",
CUSTOMER_LIST_LOWER_LIMIT, CUSTOMER_LIST_UPPER_LIMIT
),
}
.into()),
None => Ok(CUSTOMER_LIST_DEFAULT_LIMIT),
}
}