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:
@@ -43,7 +43,7 @@ impl WorkspaceService {
|
||||
.map_err(AppError::Database)?;
|
||||
|
||||
let issues_count = sqlx::query_scalar::<_, i64>(
|
||||
"SELECT COUNT(*) FROM issue WHERE repo_id IN (SELECT id FROM repo WHERE workspace_id = $1 AND deleted_at IS NULL) AND deleted_at IS NULL",
|
||||
"SELECT COUNT(*) FROM issue WHERE workspace_id = $1 AND deleted_at IS NULL",
|
||||
)
|
||||
.bind(ws.id)
|
||||
.fetch_one(self.ctx.db.reader())
|
||||
@@ -102,14 +102,16 @@ impl WorkspaceService {
|
||||
.execute(self.ctx.db.writer())
|
||||
.await
|
||||
.map_err(AppError::Database)?;
|
||||
// Read from writer to avoid replication lag
|
||||
sqlx::query_as::<_, WorkspaceStats>(
|
||||
"SELECT workspace_id, members_count, repos_count, issues_count, pull_requests_count, \
|
||||
storage_bytes, bandwidth_bytes, build_minutes_used, last_activity_at, updated_at \
|
||||
FROM workspace_stats WHERE workspace_id = $1",
|
||||
)
|
||||
.bind(workspace_id)
|
||||
.fetch_one(self.ctx.db.reader())
|
||||
.fetch_optional(self.ctx.db.writer())
|
||||
.await
|
||||
.map_err(AppError::Database)
|
||||
.map_err(AppError::Database)?
|
||||
.ok_or(AppError::NotFound("workspace stats not found".into()))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user