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:
zhenyi
2026-06-10 18:49:32 +08:00
parent cec6dce955
commit 420dedbc1e
100 changed files with 3797 additions and 3839 deletions
+14 -6
View File
@@ -6,7 +6,7 @@ use crate::models::workspaces::{Workspace, WorkspaceSettings};
use crate::service::WorkspaceService;
use crate::session::Session;
use super::util::merge_optional_text;
use super::util::{merge_optional_text, set_local_user_id};
#[derive(Deserialize, Serialize, Clone, Debug, utoipa::ToSchema)]
pub struct UpdateWorkspaceSettingsParams {
@@ -50,8 +50,7 @@ impl WorkspaceService {
.begin()
.await
.map_err(|_| AppError::TxnError)?;
sqlx::query("SET LOCAL app.current_user_id = $1")
.bind(user_uid)
sqlx::query(set_local_user_id(user_uid))
.execute(&mut *txn)
.await
.map_err(AppError::Database)?;
@@ -103,9 +102,18 @@ impl WorkspaceService {
.execute(self.ctx.db.writer())
.await
.map_err(AppError::Database)?;
self.find_workspace_settings(workspace_id)
.await?
.ok_or(AppError::NotFound("workspace settings not found".into()))
// Read from writer to avoid replication lag
sqlx::query_as::<_, WorkspaceSettings>(
"SELECT workspace_id, allow_public_repos, allow_member_invites, require_two_factor, \
default_repo_visibility, default_branch_name, issue_tracking_enabled, \
pull_requests_enabled, wiki_enabled, created_at, updated_at \
FROM workspace_settings WHERE workspace_id = $1",
)
.bind(workspace_id)
.fetch_optional(self.ctx.db.writer())
.await
.map_err(AppError::Database)?
.ok_or(AppError::NotFound("workspace settings not found".into()))
}
async fn find_workspace_settings(