mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
feat(payments): support sort criteria in payments list (#5389)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -4063,6 +4063,9 @@ pub struct PaymentListFilterConstraints {
|
||||
pub authentication_type: Option<Vec<enums::AuthenticationType>>,
|
||||
/// The list of merchant connector ids to filter payments list for selected label
|
||||
pub merchant_connector_id: Option<Vec<String>>,
|
||||
/// The order in which payments list should be sorted
|
||||
#[serde(default)]
|
||||
pub order: Order,
|
||||
}
|
||||
#[derive(Clone, Debug, serde::Serialize)]
|
||||
pub struct PaymentListFilters {
|
||||
@ -4102,6 +4105,34 @@ pub struct AmountFilter {
|
||||
pub end_amount: Option<i64>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
pub struct Order {
|
||||
/// The field to sort, such as Amount or Created etc.
|
||||
pub on: SortOn,
|
||||
/// The order in which to sort the items, either Ascending or Descending
|
||||
pub by: SortBy,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum SortOn {
|
||||
/// Sort by the amount field
|
||||
Amount,
|
||||
/// Sort by the created_at field
|
||||
#[default]
|
||||
Created,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum SortBy {
|
||||
/// Sort in ascending order
|
||||
Asc,
|
||||
/// Sort in descending order
|
||||
#[default]
|
||||
Desc,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Debug, Clone, Copy, serde::Serialize, serde::Deserialize, PartialEq, Eq, Hash, ToSchema,
|
||||
)]
|
||||
|
||||
Reference in New Issue
Block a user