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:
@@ -126,12 +126,34 @@ impl IssueService {
|
||||
let repo_id = self.resolve_repo_id(wk_name, repo_name).await?;
|
||||
self.ensure_repo_role(repo_id, user_uid, Role::Admin)
|
||||
.await?;
|
||||
|
||||
let mut txn = self
|
||||
.ctx
|
||||
.db
|
||||
.writer()
|
||||
.begin()
|
||||
.await
|
||||
.map_err(|_| AppError::TxnError)?;
|
||||
|
||||
// Clear milestone_id from all issues that reference this milestone
|
||||
sqlx::query(
|
||||
"UPDATE issue SET milestone_id = NULL, updated_at = $1 WHERE milestone_id = $2",
|
||||
)
|
||||
.bind(chrono::Utc::now())
|
||||
.bind(milestone_id)
|
||||
.execute(&mut *txn)
|
||||
.await
|
||||
.map_err(AppError::Database)?;
|
||||
|
||||
let result = sqlx::query("DELETE FROM issue_milestone WHERE id = $1 AND repo_id = $2")
|
||||
.bind(milestone_id)
|
||||
.bind(repo_id)
|
||||
.execute(self.ctx.db.writer())
|
||||
.execute(&mut *txn)
|
||||
.await
|
||||
.map_err(AppError::Database)?;
|
||||
ensure_affected(result.rows_affected(), "milestone not found")
|
||||
ensure_affected(result.rows_affected(), "milestone not found")?;
|
||||
|
||||
txn.commit().await.map_err(|_| AppError::TxnError)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user