diff options
author | Joris | 2023-11-25 08:59:39 +0100 |
---|---|---|
committer | Joris | 2023-11-25 08:59:39 +0100 |
commit | bb906d8ecc796f6b71dda1851d6bd0aa91c6bce5 (patch) | |
tree | cf98c0d9466e0338992c94060d09ac90862178c5 /src/controller/payments.rs | |
parent | 936871e6ba92a23b1956b30272af8c96951c7c2d (diff) | |
download | budget-bb906d8ecc796f6b71dda1851d6bd0aa91c6bce5.tar.gz budget-bb906d8ecc796f6b71dda1851d6bd0aa91c6bce5.tar.bz2 budget-bb906d8ecc796f6b71dda1851d6bd0aa91c6bce5.zip |
Upgrade dependenciesmain
Diffstat (limited to 'src/controller/payments.rs')
-rw-r--r-- | src/controller/payments.rs | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/controller/payments.rs b/src/controller/payments.rs index 2663fa7..8184015 100644 --- a/src/controller/payments.rs +++ b/src/controller/payments.rs @@ -1,5 +1,7 @@ +use http_body_util::Full; +use hyper::body::Bytes; use hyper::header::CONTENT_TYPE; -use hyper::{Body, Response}; +use hyper::Response; use std::collections::HashMap; use tera::Context; @@ -16,7 +18,7 @@ static PER_PAGE: i64 = 10; pub async fn table( wallet: &Wallet, query: queries::Payments, -) -> Response<Body> { +) -> Response<Full<Bytes>> { let page = query.page.unwrap_or(1); let count = db::payments::count(&wallet.pool, &query).await; let payments = @@ -48,7 +50,7 @@ pub async fn table( pub async fn create_form( wallet: &Wallet, query: queries::Payments, -) -> Response<Body> { +) -> Response<Full<Bytes>> { create_form_feedback(wallet, query, HashMap::new(), None).await } @@ -57,7 +59,7 @@ async fn create_form_feedback( query: queries::Payments, form: HashMap<String, String>, error: Option<String>, -) -> Response<Body> { +) -> Response<Full<Bytes>> { let users = db::users::list(&wallet.pool).await; let categories = db::categories::list(&wallet.pool).await; @@ -82,7 +84,7 @@ pub async fn create( wallet: &Wallet, query: queries::Payments, form: HashMap<String, String>, -) -> Response<Body> { +) -> Response<Full<Bytes>> { let error = |e: &str| { create_form_feedback(wallet, query, form.clone(), Some(e.to_string())) }; @@ -125,7 +127,7 @@ pub async fn update_form( id: i64, wallet: &Wallet, query: queries::Payments, -) -> Response<Body> { +) -> Response<Full<Bytes>> { update_form_feedback(id, wallet, query, HashMap::new(), None).await } @@ -135,7 +137,7 @@ async fn update_form_feedback( query: queries::Payments, form: HashMap<String, String>, error: Option<String>, -) -> Response<Body> { +) -> Response<Full<Bytes>> { let payment = db::payments::get_for_form(&wallet.pool, id).await; let users = db::users::list(&wallet.pool).await; let categories = db::categories::list(&wallet.pool).await; @@ -164,7 +166,7 @@ pub async fn update( wallet: &Wallet, query: queries::Payments, form: HashMap<String, String>, -) -> Response<Body> { +) -> Response<Full<Bytes>> { let error = |e: &str| { update_form_feedback( id, @@ -207,7 +209,7 @@ pub async fn delete( id: i64, wallet: &Wallet, query: queries::Payments, -) -> Response<Body> { +) -> Response<Full<Bytes>> { if db::payments::delete(&wallet.pool, id).await { let query = queries::Payments { highlight: None, @@ -229,7 +231,7 @@ pub async fn delete( pub async fn search_category( wallet: &Wallet, query: queries::PaymentCategory, -) -> Response<Body> { +) -> Response<Full<Bytes>> { match db::payments::search_category(&wallet.pool, query.payment_name).await { Some(category_id) => utils::with_headers( |