From 6d1300640051baa23360846197b54e1e69ae32e3 Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Sat, 18 Apr 2026 11:04:47 +0200 Subject: Add balancing capabilities If payment are too unbalanced, it’s easier to make a transfer. --- src/routes.rs | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'src/routes.rs') diff --git a/src/routes.rs b/src/routes.rs index 8abe1b4..3afc822 100644 --- a/src/routes.rs +++ b/src/routes.rs @@ -86,6 +86,7 @@ async fn authenticated_routes( let query = uri.query(); match (method, path) { + // PAYMENTS (&Method::GET, [""]) => { controller::payments::table(&wallet, parse_query(query)).await } @@ -129,6 +130,7 @@ async fn authenticated_routes( ) .await } + // INCOMES (&Method::GET, ["incomes"]) => { controller::incomes::table(&wallet, parse_query(query)).await } @@ -168,6 +170,7 @@ async fn authenticated_routes( ) .await } + // CATEGORIES (&Method::GET, ["categories"]) => { controller::categories::table(&wallet, parse_query(query)).await } @@ -192,13 +195,57 @@ async fn authenticated_routes( (&Method::POST, ["category", id, "delete"]) => { controller::categories::delete(parse_id(id), &wallet).await } + // BALANCING + (&Method::GET, ["balancings"]) => { + controller::balancing::table(&wallet, parse_query(query)).await + } + (&Method::GET, ["balancing"]) => { + controller::balancing::create_form(&wallet, parse_query(query)).await + } + (&Method::POST, ["balancing", "create"]) => { + controller::balancing::create( + &wallet, + parse_query(query), + body_form(request).await, + ) + .await + } + (&Method::GET, ["balancing", id]) => { + controller::balancing::update_form( + parse_id(id), + &wallet, + parse_query(query), + ) + .await + } + (&Method::POST, ["balancing", id, "update"]) => { + controller::balancing::update( + parse_id(id), + &wallet, + parse_query(query), + body_form(request).await, + ) + .await + } + (&Method::POST, ["balancing", id, "delete"]) => { + controller::balancing::delete( + parse_id(id), + &wallet, + parse_query(query), + ) + .await + } + // BALANCE (&Method::GET, ["balance"]) => controller::balance::get(&wallet).await, + // STATS (&Method::GET, ["statistics"]) => { controller::statistics::get(&wallet).await } + // LOGOUT (&Method::POST, ["logout"]) => { controller::login::logout(config, &wallet).await } + // ERROR _ => controller::error::error( &wallet, "Page introuvable", -- cgit v1.2.3