diff options
author | Joris | 2021-10-10 19:27:22 +0200 |
---|---|---|
committer | Joris | 2021-10-10 21:21:34 +0200 |
commit | 6e695bf7a0253b4f6d1db78fa4310616d8a1357f (patch) | |
tree | a5b9f30b74a6914336993f93504df3b42fccb933 /src/queries.rs | |
parent | 8ccd762bfc3d7da2716749d709cf5cc216882a23 (diff) |
Search by name, cost and user
Diffstat (limited to 'src/queries.rs')
-rw-r--r-- | src/queries.rs | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/queries.rs b/src/queries.rs index df57bd8..f10c7a1 100644 --- a/src/queries.rs +++ b/src/queries.rs @@ -4,9 +4,11 @@ use serde::{Deserialize, Serialize}; #[derive(Deserialize, Serialize, Clone)] pub struct Payments { pub page: Option<i64>, - pub search: Option<String>, + pub name: Option<String>, + pub cost: Option<String>, pub frequency: Option<Frequency>, pub highlight: Option<i64>, + pub user: Option<i64>, pub category: Option<i64>, } @@ -18,15 +20,6 @@ pub fn payments_url(q: Payments) -> String { Some(p) => params.push(format!("page={}", p)), }; - match q.search { - Some(s) => { - if !s.is_empty() { - params.push(format!("search={}", s)); - } - } - _ => (), - }; - match q.frequency { Some(Frequency::Monthly) => { params.push("frequency=Monthly".to_string()) @@ -39,6 +32,21 @@ pub fn payments_url(q: Payments) -> String { _ => (), }; + match q.name { + Some(str) => params.push(format!("name={}", str)), + _ => (), + }; + + match q.cost { + Some(n) => params.push(format!("cost={}", n)), + _ => (), + }; + + match q.user { + Some(id) => params.push(format!("user={}", id)), + _ => (), + }; + match q.category { Some(id) => params.push(format!("category={}", id)), _ => (), |