Added source and destination accounts.

This commit is contained in:
2026-09-27 11:04:47 +02:00
parent d219d63dca
commit 26a370aa31
16 changed files with 253 additions and 122 deletions
+20
View File
@@ -2,3 +2,23 @@ pub mod accounts;
pub mod dtos;
pub mod recurring_transactions;
pub mod transactions;
#[derive(Debug, thiserror::Error)]
pub enum DatabaseError {
#[error("Foreign key violation")]
ForeignKeyViolation,
#[error("Internal error: {0}")]
Internal(#[source] sqlx::Error),
}
impl From<sqlx::Error> for DatabaseError {
fn from(err: sqlx::Error) -> Self {
match err {
sqlx::Error::Database(db_err) if db_err.code().as_deref() == Some("23503") => {
DatabaseError::ForeignKeyViolation
}
_ => DatabaseError::Internal(err),
}
}
}