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:
@@ -1,5 +1,6 @@
|
||||
use crate::error::AppError;
|
||||
use crate::models::common::Role;
|
||||
use uuid::Uuid;
|
||||
|
||||
pub fn merge_optional_text(next: Option<String>, current: Option<String>) -> Option<String> {
|
||||
next.map(|v| {
|
||||
@@ -152,3 +153,12 @@ pub fn validate_password_strength(password: &str) -> Result<(), AppError> {
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Build a `SET LOCAL app.current_user_id` statement with the UUID interpolated
|
||||
/// directly. PostgreSQL `SET` is a utility command that does not support
|
||||
/// parameterised `$1` placeholders through the extended query protocol.
|
||||
///
|
||||
/// Returns an `AssertSqlSafe` wrapper so sqlx 0.9 accepts the dynamic string.
|
||||
pub fn set_local_user_id(user_uid: Uuid) -> sqlx::AssertSqlSafe<String> {
|
||||
sqlx::AssertSqlSafe(format!("SET LOCAL app.current_user_id = '{user_uid}'"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user