diff --git a/crates/application/src/use_cases/social.rs b/crates/application/src/use_cases/social.rs index 1761d39..66954ac 100644 --- a/crates/application/src/use_cases/social.rs +++ b/crates/application/src/use_cases/social.rs @@ -37,7 +37,7 @@ pub async fn follow_user(follows: &dyn FollowRepository, events: &dyn EventPubli if follower_id == following_id { return Err(DomainError::InvalidInput("cannot follow yourself".into())); } let follow = Follow { follower_id: follower_id.clone(), following_id: following_id.clone(), state: FollowState::Accepted, ap_id: None, created_at: Utc::now() }; follows.save(&follow).await?; - events.publish(&DomainEvent::FollowRequested { follower_id: follower_id.clone(), following_id: following_id.clone() }).await?; + events.publish(&DomainEvent::FollowAccepted { follower_id: follower_id.clone(), following_id: following_id.clone() }).await?; Ok(()) } diff --git a/crates/presentation/src/errors.rs b/crates/presentation/src/errors.rs index e239872..f4c273d 100644 --- a/crates/presentation/src/errors.rs +++ b/crates/presentation/src/errors.rs @@ -20,7 +20,7 @@ impl IntoResponse for ApiError { Self::Domain(DomainError::Forbidden) => (StatusCode::FORBIDDEN, "forbidden".into()), Self::Domain(DomainError::Conflict(m)) => (StatusCode::CONFLICT, m), Self::Domain(DomainError::InvalidInput(m)) => (StatusCode::UNPROCESSABLE_ENTITY, m), - Self::Domain(DomainError::Internal(m)) => (StatusCode::INTERNAL_SERVER_ERROR, m), + Self::Domain(DomainError::Internal(_)) => (StatusCode::INTERNAL_SERVER_ERROR, "internal server error".into()), Self::Unauthorized => (StatusCode::UNAUTHORIZED, "unauthorized".into()), Self::BadRequest(m) => (StatusCode::BAD_REQUEST, m), };