Made scheduled transactions more generic.
This commit is contained in:
@@ -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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user