feat: transaction query pagination

This commit is contained in:
acx
2024-08-12 23:37:07 +08:00
parent dcc4c68abb
commit 2b2b895b7d
2 changed files with 35 additions and 5 deletions

View File

@@ -2,8 +2,14 @@ use std::fmt;
use std::str::FromStr;
use serde::{de, Deserialize, Deserializer};
pub const QUERY_ORDER_INCREASE:i32 = 0;
pub const QUERY_ORDER_INVERT:i32 = 1;
pub const MAX_QUERY_LIMIT:i32 =1000;
#[derive(Debug, Deserialize)]
pub struct Params {
pub struct GetAmountParams {
#[serde(default, deserialize_with="empty_string_as_none")]
pub transaction_id: Option<i64>,
}
@@ -21,3 +27,9 @@ where
Some(s) => FromStr::from_str(s).map_err(de::Error::custom).map(Some),
}
}
#[derive(Deserialize)]
pub struct GetTransactionsQueryParams {
pub start: Option<i64>,
pub limit: Option<i32>,
}