feat(service): expand service layer with new domain operations
- Add IM service modules: audit, channel roles, custom emojis, forum tags, integrations, invitations, repo links, slash commands, stages, voice, webhooks - Add PR service modules: review requests, templates - Add repo service modules: contributors, release assets, git extras (archive, branch rename, commit extras, diff/merge, tag, tree) - Add user service: social (follow/block) - Add internal auth service - Update existing service modules with expanded functionality - Remove deleted IM modules: articles, delivery trace, drafts, follows, messages, polls, presence, reactions, threads
This commit is contained in:
+16
-17
@@ -4,27 +4,25 @@ use serde::Serialize;
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::service::ServiceContext;
|
||||
use delivery_trace::{trace_error, trace_request};
|
||||
use events::ImEvent;
|
||||
|
||||
pub mod articles;
|
||||
pub mod audit;
|
||||
pub mod categories;
|
||||
pub mod channel_roles;
|
||||
pub mod channels;
|
||||
pub mod delivery_trace;
|
||||
pub mod drafts;
|
||||
pub mod custom_emojis;
|
||||
pub mod events;
|
||||
pub mod follows;
|
||||
pub mod forum_tags;
|
||||
pub mod integrations;
|
||||
pub mod invitations;
|
||||
pub mod members;
|
||||
pub mod messages;
|
||||
pub mod polls;
|
||||
pub mod presence;
|
||||
pub mod reactions;
|
||||
pub mod repo_links;
|
||||
pub mod session;
|
||||
pub mod threads;
|
||||
pub mod slash_commands;
|
||||
pub mod stages;
|
||||
pub mod util;
|
||||
pub mod voice;
|
||||
pub mod webhooks;
|
||||
|
||||
pub use messages::{EditMessageParams, SendMessageParams};
|
||||
pub use presence::UpdatePresenceParams;
|
||||
pub use session::ImSession;
|
||||
|
||||
#[derive(Clone)]
|
||||
@@ -33,11 +31,11 @@ pub struct ImService {
|
||||
}
|
||||
|
||||
impl ImService {
|
||||
fn emit_event(&self, event: ImEvent) {
|
||||
pub(crate) fn emit_event(&self, event: events::ImEvent) {
|
||||
let _ = self.ctx.im_events.publish(event);
|
||||
}
|
||||
|
||||
async fn publish<T: Serialize>(&self, subject: &str, request_id: Uuid, event: &T) {
|
||||
pub(crate) async fn publish<T: Serialize>(&self, subject: &str, request_id: Uuid, event: &T) {
|
||||
match self
|
||||
.ctx
|
||||
.nats
|
||||
@@ -48,9 +46,10 @@ impl ImService {
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(_) => trace_request("nats_published", request_id, subject),
|
||||
Ok(_) => {
|
||||
tracing::debug!(subject, %request_id, "nats event published");
|
||||
}
|
||||
Err(e) => {
|
||||
trace_error("nats_failed", request_id, subject, &e);
|
||||
tracing::warn!(subject, error = %e, "nats publish failed");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user