Added user apps and token resources.

This commit is contained in:
2026-10-07 22:50:18 +02:00
parent 1f1f027368
commit 9038120734
47 changed files with 1940 additions and 29 deletions
+20
View File
@@ -16,6 +16,9 @@ pub enum AppError {
#[error("not found")]
NotFound,
#[error("unauthorized")]
Unauthorized,
#[error("domain error")]
Domain(#[from] DomainError),
@@ -35,6 +38,9 @@ impl IntoResponse for AppError {
Self::NotFound => {
return error_response(StatusCode::NOT_FOUND, "Not found");
}
Self::Unauthorized => {
return error_response(StatusCode::UNAUTHORIZED, "Unauthorized");
}
Self::Domain(error) => {
return error_response(StatusCode::UNPROCESSABLE_ENTITY, error.to_string());
}
@@ -44,6 +50,20 @@ impl IntoResponse for AppError {
Self::Repository(RepositoryError::Decode(error)) => {
tracing::error!(%error, "invalid stored data");
}
Self::Repository(RepositoryError::ReferenceViolation {
relation: ReferenceRelation::User,
kind: ReferenceViolationKind::Missing,
..
}) => {
return error_response(StatusCode::NOT_FOUND, "User cannot be found");
}
Self::Repository(RepositoryError::ReferenceViolation {
relation: ReferenceRelation::UserApp,
kind: ReferenceViolationKind::Missing,
..
}) => {
return error_response(StatusCode::NOT_FOUND, "User app cannot be found");
}
Self::Repository(RepositoryError::ReferenceViolation {
relation: ReferenceRelation::Account,
kind: ReferenceViolationKind::Missing,