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
+8 -12
View File
@@ -9,7 +9,7 @@ use uuid::Uuid;
use super::util::clamp_limit_offset;
#[derive(Debug, Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize, utoipa::ToSchema)]
pub struct CreateSubscriptionParams {
pub workspace_id: Option<Uuid>,
pub repo_id: Option<Uuid>,
@@ -20,7 +20,7 @@ pub struct CreateSubscriptionParams {
pub level: SubscriptionLevel,
}
#[derive(Debug, Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize, utoipa::ToSchema)]
pub struct UpdateSubscriptionParams {
pub event_types: Option<Vec<EventType>>,
pub channels: Option<Vec<String>>,
@@ -89,10 +89,12 @@ impl NotificationService {
let id = Uuid::now_v7();
let now = Utc::now();
sqlx::query(
sqlx::query_as::<_, NotificationSubscription>(
"INSERT INTO notification_subscription \
(id, user_id, workspace_id, repo_id, target_type, target_id, event_types, channels, level, muted, muted_until, created_at, updated_at) \
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, false, NULL, $10, $10)",
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, false, NULL, $10, $10) \
RETURNING id, user_id, workspace_id, repo_id, target_type, target_id, event_types, \
channels, level, muted, muted_until, created_at, updated_at",
)
.bind(id)
.bind(user_id)
@@ -104,15 +106,9 @@ impl NotificationService {
.bind(&params.channels)
.bind(params.level.as_str())
.bind(now)
.execute(self.ctx.db.writer())
.fetch_one(self.ctx.db.writer())
.await
.map_err(AppError::Database)?;
NotificationSubscription::find_by_id(self.ctx.db.reader(), id, user_id)
.await?
.ok_or(AppError::InternalServerError(
"failed to fetch created subscription".into(),
))
.map_err(AppError::Database)
}
pub async fn update_subscription(