- Add gitignore and prettier configuration files for project scaffolding - Implement room access control service with project member verification - Create user access key management with CRUD operations and activity logging - Add accordion UI component for frontend expandable sections - Implement room AI configuration with list, upsert, and delete operations - Add AI event types for agent join/leave/status change tracking - Create streaming AI processing services for mode and react patterns - Build room AI service with model detection and idempotency handling - Integrate chat service orchestration for AI message processing - Add typing indicators and stream cancellation for AI interactions - Implement mention parsing and context extraction for AI agents
28 lines
835 B
Rust
28 lines
835 B
Rust
use crate::AppService;
|
|
use crate::error::AppError;
|
|
use serde::{Deserialize, Serialize};
|
|
use session::Session;
|
|
use uuid::Uuid;
|
|
|
|
#[derive(Deserialize, Serialize, Clone, Debug, utoipa::ToSchema)]
|
|
pub struct ContextMe {
|
|
pub uid: Uuid,
|
|
pub username: String,
|
|
pub display_name: Option<String>,
|
|
pub avatar_url: Option<String>,
|
|
pub has_unread_notifications: u64,
|
|
}
|
|
impl AppService {
|
|
pub async fn auth_me(&self, ctx: Session) -> Result<ContextMe, AppError> {
|
|
let user_id = ctx.user().ok_or(AppError::Unauthorized)?;
|
|
let user = self.utils_find_user_by_uid(user_id).await?;
|
|
Ok(ContextMe {
|
|
uid: user.uid,
|
|
username: user.username,
|
|
display_name: user.display_name,
|
|
avatar_url: user.avatar_url,
|
|
has_unread_notifications: 0,
|
|
})
|
|
}
|
|
}
|