Moved domain logic out of the database layer, to the user app route.
This commit is contained in:
+9
-9
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user