Adding optional limit
field to /message/time_range handler
This commit is contained in:
parent
feef6104c6
commit
5a27ef07f1
@ -31,9 +31,14 @@ pub async fn get_by_time(pool: &Pool, response: &mut Response<Body>, params: Val
|
||||
Some(val) => val.as_i64(),
|
||||
None => None
|
||||
};
|
||||
let limit = match params.get("limit") {
|
||||
Some(val) => val.as_u64(),
|
||||
None => None
|
||||
};
|
||||
|
||||
// TODO: flatten me mommy
|
||||
if let (Some(channel), Some(start), Some(end)) = (channel, start_time, end_time) {
|
||||
match Message::get_time_range(pool, channel, start, end).await {
|
||||
match Message::get_time_range(pool, channel, start, end, limit).await {
|
||||
Ok(db_response) => {
|
||||
match db_response {
|
||||
db::Response::Set(messages) => {
|
||||
@ -132,7 +137,6 @@ pub async fn from_id(pool: &Pool, response: &mut Response<Body>, params: Value)
|
||||
None => None
|
||||
};
|
||||
|
||||
// TODO: untested lmao
|
||||
if let (Some(channel), Some(start_id)) = (channel, start_id) {
|
||||
match Message::get_from_id(pool, channel, start_id, limit).await {
|
||||
Ok(db_response) => {
|
||||
|
Loading…
Reference in New Issue
Block a user