Ordering.

This commit is contained in:
2026-10-11 08:56:45 +02:00
parent 73aff1ccd4
commit 3b5abd4177
+10 -10
View File
@@ -107,25 +107,25 @@ impl ClientError for RepositoryError {
use crate::repository::{ use crate::repository::{
ReferenceRelation as Relation, ReferenceViolationKind as Kind, ReferenceRelation as Relation, ReferenceViolationKind as Kind,
}; };
match (relation, kind) { match (kind, relation) {
(Relation::Account, Kind::Missing) => ( (Kind::Missing, Relation::Account) => (
StatusCode::UNPROCESSABLE_ENTITY, StatusCode::UNPROCESSABLE_ENTITY,
"Account cannot be found".into(), "Account cannot be found".into(),
), ),
(Relation::RecurringTransaction, Kind::StillReferenced) => ( (Kind::Missing, Relation::User) => {
(StatusCode::NOT_FOUND, "User cannot be found".into())
}
(Kind::Missing, Relation::UserApp) => {
(StatusCode::NOT_FOUND, "User app cannot be found".into())
}
(Kind::StillReferenced, Relation::RecurringTransaction) => (
StatusCode::CONFLICT, StatusCode::CONFLICT,
"Still referenced by one or more recurring transactions".into(), "Still referenced by one or more recurring transactions".into(),
), ),
(Relation::Transaction, Kind::StillReferenced) => ( (Kind::StillReferenced, Relation::Transaction) => (
StatusCode::CONFLICT, StatusCode::CONFLICT,
"Still referenced by one or more transactions".into(), "Still referenced by one or more transactions".into(),
), ),
(Relation::User, Kind::Missing) => {
(StatusCode::NOT_FOUND, "User cannot be found".into())
}
(Relation::UserApp, Kind::Missing) => {
(StatusCode::NOT_FOUND, "User app cannot be found".into())
}
_ => internal_error(), _ => internal_error(),
} }
} }