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:
@@ -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 CreateBlockParams {
|
||||
pub workspace_id: Option<Uuid>,
|
||||
pub repo_id: Option<Uuid>,
|
||||
@@ -81,10 +81,12 @@ impl NotificationService {
|
||||
let id = Uuid::now_v7();
|
||||
let now = Utc::now();
|
||||
|
||||
sqlx::query(
|
||||
sqlx::query_as::<_, NotificationBlock>(
|
||||
"INSERT INTO notification_block \
|
||||
(id, user_id, workspace_id, repo_id, target_type, target_id, notification_type, channel, reason, expires_at, created_at, updated_at) \
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $11)",
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $11) \
|
||||
RETURNING id, user_id, workspace_id, repo_id, target_type, target_id, notification_type, \
|
||||
channel, reason, expires_at, created_at, updated_at",
|
||||
)
|
||||
.bind(id)
|
||||
.bind(user_id)
|
||||
@@ -97,15 +99,9 @@ impl NotificationService {
|
||||
.bind(params.reason)
|
||||
.bind(params.expires_at)
|
||||
.bind(now)
|
||||
.execute(self.ctx.db.writer())
|
||||
.fetch_one(self.ctx.db.writer())
|
||||
.await
|
||||
.map_err(AppError::Database)?;
|
||||
|
||||
NotificationBlock::find_by_id(self.ctx.db.reader(), id, user_id)
|
||||
.await?
|
||||
.ok_or(AppError::InternalServerError(
|
||||
"failed to fetch created block".into(),
|
||||
))
|
||||
.map_err(AppError::Database)
|
||||
}
|
||||
|
||||
pub async fn delete_block(&self, session: &Session, block_id: Uuid) -> Result<(), AppError> {
|
||||
|
||||
Reference in New Issue
Block a user