Refactored src and dst account to just account in preparation for a "counter party", instead of a full account.

This commit is contained in:
2026-10-03 20:33:13 +02:00
parent 221c38d364
commit 896b192c01
29 changed files with 535 additions and 422 deletions
+12 -9
View File
@@ -21,6 +21,9 @@ pub enum AppError {
#[error("repository error")]
Repository(#[from] RepositoryError),
#[error("internal server error")]
Internal,
}
impl IntoResponse for AppError {
@@ -42,23 +45,20 @@ impl IntoResponse for AppError {
tracing::error!(%error, "invalid stored data");
}
Self::Repository(RepositoryError::ReferenceViolation {
relation: ReferenceRelation::SourceAccount,
relation: ReferenceRelation::Account,
kind: ReferenceViolationKind::Missing,
..
}) => {
return error_response(
StatusCode::UNPROCESSABLE_ENTITY,
"Source account cannot be found",
);
return error_response(StatusCode::UNPROCESSABLE_ENTITY, "Account cannot be found");
}
Self::Repository(RepositoryError::ReferenceViolation {
relation: ReferenceRelation::DestinationAccount,
kind: ReferenceViolationKind::Missing,
relation: ReferenceRelation::Transaction,
kind: ReferenceViolationKind::StillReferenced,
..
}) => {
return error_response(
StatusCode::UNPROCESSABLE_ENTITY,
"Destination account cannot be found",
StatusCode::CONFLICT,
"Still referenced by one or more transactions",
);
}
Self::Repository(RepositoryError::ReferenceViolation {
@@ -81,6 +81,9 @@ impl IntoResponse for AppError {
Self::Repository(RepositoryError::QueryConversion(error)) => {
return error_response(StatusCode::BAD_REQUEST, error.to_string());
}
Self::Internal => {
tracing::error!("internal server error");
}
}
error_response(StatusCode::INTERNAL_SERVER_ERROR, "Internal server error")