Added name query to accounts and updated query handling.
This commit is contained in:
@@ -28,6 +28,7 @@ pub fn create_router() -> axum::Router<PgPool> {
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct QueryParams {
|
||||
pub name: Option<String>,
|
||||
pub limit: Option<u64>,
|
||||
pub offset: Option<u64>,
|
||||
}
|
||||
@@ -37,8 +38,10 @@ impl TryFrom<QueryParams> for repository::Query {
|
||||
|
||||
fn try_from(query: QueryParams) -> Result<Self, Self::Error> {
|
||||
Ok(repository::Query {
|
||||
name: query.name,
|
||||
limit: Some(query.limit.unwrap_or(20)),
|
||||
offset: query.offset,
|
||||
..Default::default()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ impl TryFrom<QueryParams> for repository::Query {
|
||||
Ok(repository::Query {
|
||||
limit: Some(query.limit.unwrap_or(20)),
|
||||
offset: query.offset,
|
||||
..Default::default()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ impl TryFrom<QueryParams> for repository::Query {
|
||||
Ok(repository::Query {
|
||||
limit: Some(query.limit.unwrap_or(20)),
|
||||
offset: query.offset,
|
||||
..Default::default()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user