use actix_web::{HttpResponse, web}; use crate::api::response::{ApiErrorResponse, ApiResponse}; use crate::error::AppError; use crate::models::users::UserProfile; use crate::service::AppService; use crate::session::Session; /// Get user profile /// /// Returns the authenticated user's public profile information including: /// - Full name and company /// - Location and website URL /// - Twitter username /// - Timezone and language /// - Profile README /// /// If no profile exists, an empty profile is created automatically. /// Requires authentication. #[utoipa::path( get, path = "/api/v1/user/profile", tag = "User", operation_id = "userGetProfile", responses( (status = 200, description = "Profile retrieved successfully. Returns all profile fields.", body = ApiResponse), (status = 401, description = "Authentication required or session expired", body = ApiErrorResponse), (status = 500, description = "Internal server error", body = ApiErrorResponse), ), security( ("session_cookie" = []) ) )] pub async fn get_profile( service: web::Data, session: Session, ) -> Result { let profile = service.user.user_profile(&session).await?; Ok(HttpResponse::Ok().json(ApiResponse::new(profile))) }