diff options
| author | Joe Carstairs <me@joeac.net> | 2024-09-17 18:10:17 +0100 |
|---|---|---|
| committer | Joe Carstairs <me@joeac.net> | 2024-09-17 18:11:39 +0100 |
| commit | 76974785294089965efc3f55b2a08d4089029c52 (patch) | |
| tree | 67e72c77857d10461a5c84f59967866fd5b4c365 /backend/src/routes | |
| parent | cd269b3540fb5e3a988c1b59d3763db360b1fb34 (diff) | |
Adds /budget_update endpoint
Diffstat (limited to 'backend/src/routes')
| -rw-r--r-- | backend/src/routes/budget_update.rs | 18 | ||||
| -rw-r--r-- | backend/src/routes/mod.rs | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/backend/src/routes/budget_update.rs b/backend/src/routes/budget_update.rs new file mode 100644 index 0000000..7732c7b --- /dev/null +++ b/backend/src/routes/budget_update.rs @@ -0,0 +1,18 @@ +use rocket::get; +use rocket::http::Status; +use rocket::serde::json::Json; + +use crate::databases::UserDataDb; +use crate::models::budget_update::BudgetUpdate; +use crate::queries; + +#[get("/budget-update")] +pub async fn get_all_budget_updates( + user_data_db: UserDataDb, +) -> Result<Json<Vec<BudgetUpdate>>, Status> { + user_data_db + .run(queries::budget_updates::get_all_budget_updates) + .await + .map(Json) + .map_err(|_| Status { code: 500 }) +} diff --git a/backend/src/routes/mod.rs b/backend/src/routes/mod.rs index 1d4408a..bf0ab4a 100644 --- a/backend/src/routes/mod.rs +++ b/backend/src/routes/mod.rs @@ -1,4 +1,5 @@ pub mod account; pub mod balance; pub mod budget; +pub mod budget_update; pub mod category; |
