Refactor handlers and OpenAPI documentation for improved readability and consistency
Some checks failed
lint / lint (push) Has been cancelled
test / unit (push) Has been cancelled
test / integration (push) Has been cancelled
lint / lint (pull_request) Failing after 6m49s
test / unit (pull_request) Successful in 16m24s
test / integration (pull_request) Failing after 17m7s
Some checks failed
lint / lint (push) Has been cancelled
test / unit (push) Has been cancelled
test / integration (push) Has been cancelled
lint / lint (pull_request) Failing after 6m49s
test / unit (pull_request) Successful in 16m24s
test / integration (pull_request) Failing after 17m7s
- Reorganized imports in health, notifications, social, thoughts, and users handlers for clarity. - Updated function signatures in handlers to improve readability by aligning parameters. - Enhanced JSON response formatting in notifications and thoughts handlers. - Improved error handling in user-related functions. - Refactored OpenAPI documentation to maintain consistent formatting and structure. - Cleaned up unnecessary code and comments across various files. - Ensured consistent use of `Arc` for shared state in AppState and WorkerHandlers.
This commit is contained in:
@@ -1,30 +1,76 @@
|
||||
use crate::value_objects::{UserId, ThoughtId, LikeId, BoostId};
|
||||
use crate::value_objects::{BoostId, LikeId, ThoughtId, UserId};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum DomainEvent {
|
||||
ThoughtCreated { thought_id: ThoughtId, user_id: UserId, in_reply_to_id: Option<ThoughtId> },
|
||||
ThoughtDeleted { thought_id: ThoughtId, user_id: UserId },
|
||||
ThoughtUpdated { thought_id: ThoughtId, user_id: UserId },
|
||||
LikeAdded { like_id: LikeId, user_id: UserId, thought_id: ThoughtId },
|
||||
LikeRemoved { user_id: UserId, thought_id: ThoughtId },
|
||||
BoostAdded { boost_id: BoostId, user_id: UserId, thought_id: ThoughtId },
|
||||
BoostRemoved { user_id: UserId, thought_id: ThoughtId },
|
||||
FollowRequested { follower_id: UserId, following_id: UserId },
|
||||
FollowAccepted { follower_id: UserId, following_id: UserId },
|
||||
FollowRejected { follower_id: UserId, following_id: UserId },
|
||||
Unfollowed { follower_id: UserId, following_id: UserId },
|
||||
UserBlocked { blocker_id: UserId, blocked_id: UserId },
|
||||
UserUnblocked { blocker_id: UserId, blocked_id: UserId },
|
||||
UserRegistered { user_id: UserId },
|
||||
ThoughtCreated {
|
||||
thought_id: ThoughtId,
|
||||
user_id: UserId,
|
||||
in_reply_to_id: Option<ThoughtId>,
|
||||
},
|
||||
ThoughtDeleted {
|
||||
thought_id: ThoughtId,
|
||||
user_id: UserId,
|
||||
},
|
||||
ThoughtUpdated {
|
||||
thought_id: ThoughtId,
|
||||
user_id: UserId,
|
||||
},
|
||||
LikeAdded {
|
||||
like_id: LikeId,
|
||||
user_id: UserId,
|
||||
thought_id: ThoughtId,
|
||||
},
|
||||
LikeRemoved {
|
||||
user_id: UserId,
|
||||
thought_id: ThoughtId,
|
||||
},
|
||||
BoostAdded {
|
||||
boost_id: BoostId,
|
||||
user_id: UserId,
|
||||
thought_id: ThoughtId,
|
||||
},
|
||||
BoostRemoved {
|
||||
user_id: UserId,
|
||||
thought_id: ThoughtId,
|
||||
},
|
||||
FollowRequested {
|
||||
follower_id: UserId,
|
||||
following_id: UserId,
|
||||
},
|
||||
FollowAccepted {
|
||||
follower_id: UserId,
|
||||
following_id: UserId,
|
||||
},
|
||||
FollowRejected {
|
||||
follower_id: UserId,
|
||||
following_id: UserId,
|
||||
},
|
||||
Unfollowed {
|
||||
follower_id: UserId,
|
||||
following_id: UserId,
|
||||
},
|
||||
UserBlocked {
|
||||
blocker_id: UserId,
|
||||
blocked_id: UserId,
|
||||
},
|
||||
UserUnblocked {
|
||||
blocker_id: UserId,
|
||||
blocked_id: UserId,
|
||||
},
|
||||
UserRegistered {
|
||||
user_id: UserId,
|
||||
},
|
||||
}
|
||||
|
||||
pub struct EventEnvelope {
|
||||
pub event: DomainEvent,
|
||||
pub ack: Box<dyn Fn() + Send + Sync>,
|
||||
pub ack: Box<dyn Fn() + Send + Sync>,
|
||||
pub nack: Box<dyn Fn() + Send + Sync>,
|
||||
}
|
||||
impl std::fmt::Debug for EventEnvelope {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("EventEnvelope").field("event", &self.event).finish()
|
||||
f.debug_struct("EventEnvelope")
|
||||
.field("event", &self.event)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user