aboutsummaryrefslogtreecommitdiff
path: root/src/routes.rs
diff options
context:
space:
mode:
authorJoris Guyonvarch2026-04-18 11:04:47 +0200
committerJoris Guyonvarch2026-04-18 11:05:17 +0200
commit6d1300640051baa23360846197b54e1e69ae32e3 (patch)
tree46219dcf5b5c9e5da0920ffd966d49ba80947a9b /src/routes.rs
parentb35589eb90f2e5ee5521964e64eb578e9eb99032 (diff)
Add balancing capabilities
If payment are too unbalanced, it’s easier to make a transfer.
Diffstat (limited to 'src/routes.rs')
-rw-r--r--src/routes.rs47
1 files changed, 47 insertions, 0 deletions
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",