Moved domain logic out of the database layer, to the user app route.

This commit is contained in:
2026-10-09 14:50:39 +02:00
parent 0517ddd02e
commit 4a84c8330a
11 changed files with 141 additions and 161 deletions
+9 -9
View File
@@ -54,12 +54,6 @@ impl IntoResponse for AppError {
Self::Repository(RepositoryError::Decode(error)) => {
tracing::error!(%error, "invalid stored data");
}
Self::Repository(RepositoryError::OwnershipConflict {
relation: ReferenceRelation::UserApp,
}) => {
tracing::warn!("user app ownership conflict");
return error_response(StatusCode::CONFLICT, "User app belongs to another user");
}
Self::Repository(RepositoryError::NotFound {
relation: ReferenceRelation::User,
}) => {
@@ -72,12 +66,18 @@ impl IntoResponse for AppError {
tracing::debug!("user app not found");
return error_response(StatusCode::NOT_FOUND, "User app cannot be found");
}
Self::Repository(RepositoryError::OwnershipConflict { relation }) => {
tracing::error!(%relation, "unhandled ownership conflict");
}
Self::Repository(RepositoryError::NotFound { relation }) => {
tracing::error!(%relation, "unhandled not found");
}
Self::Repository(RepositoryError::OwnershipConflict {
relation: ReferenceRelation::UserApp,
}) => {
tracing::warn!("user app ownership conflict");
return error_response(StatusCode::CONFLICT, "User app ID is already in use");
}
Self::Repository(RepositoryError::OwnershipConflict { relation }) => {
tracing::error!(%relation, "unhandled ownership conflict");
}
Self::Repository(RepositoryError::ReferenceViolation {
relation: ReferenceRelation::User,
kind: ReferenceViolationKind::Missing,