Made scheduled transactions more generic.

This commit is contained in:
2026-09-24 21:07:38 +02:00
parent 18cf7e6bdd
commit 9e5a976ac7
17 changed files with 235 additions and 92 deletions
+7 -4
View File
@@ -17,7 +17,7 @@ async fn get_transactions(
let rows = sqlx::query_as!(
TransactionRow,
r#"
SELECT id, description, amount_cents, date
SELECT id, description, amount_cents, direction, date
FROM transactions
ORDER BY date DESC, id DESC
"#
@@ -25,7 +25,10 @@ async fn get_transactions(
.fetch_all(&pool)
.await?;
Ok(Json(
rows.into_iter().map(TransactionResponse::from).collect(),
))
let transactions = rows
.into_iter()
.map(TransactionResponse::try_from)
.collect::<Result<Vec<_>, _>>()?;
Ok(Json(transactions))
}