These errors have become app level errors.
This commit is contained in:
@@ -13,7 +13,7 @@ use crate::{
|
||||
crypto::{generate_secret, hash_secret},
|
||||
domain::UserAppSecret,
|
||||
error::AppError,
|
||||
repository::{self, ReferenceRelation, RepositoryError},
|
||||
repository::{self, RepositoryError},
|
||||
};
|
||||
|
||||
pub fn create_router() -> axum::Router<PgPool> {
|
||||
@@ -141,9 +141,6 @@ async fn ensure_app_ownership(
|
||||
) -> Result<(), AppError> {
|
||||
match repository::user_apps::find_owner_by_id(&mut *connection, app_id).await? {
|
||||
Some(owner) if owner == user_id => Ok(()),
|
||||
Some(_) | None => Err(RepositoryError::NotFound {
|
||||
relation: ReferenceRelation::UserApp,
|
||||
}
|
||||
.into()),
|
||||
Some(_) | None => Err(AppError::NotFound).into(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ use super::{
|
||||
};
|
||||
use crate::{
|
||||
error::AppError,
|
||||
repository::{self, ReferenceRelation, RepositoryError},
|
||||
repository::{self, RepositoryError},
|
||||
};
|
||||
|
||||
pub fn create_router() -> axum::Router<PgPool> {
|
||||
@@ -81,10 +81,7 @@ async fn upsert_user_app(
|
||||
.as_ref()
|
||||
.is_some_and(|previous| previous.user_id != user_id)
|
||||
{
|
||||
return Err(RepositoryError::OwnershipConflict {
|
||||
relation: ReferenceRelation::UserApp,
|
||||
}
|
||||
.into());
|
||||
return Err(AppError::Conflict("User app ID is already in use".into()).into());
|
||||
}
|
||||
tx.commit().await.map_err(RepositoryError::from)?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user