use actix_web::{HttpResponse, web}; use crate::api::response::{ApiErrorResponse, ApiResponse}; use crate::error::AppError; use crate::models::users::User; use crate::service::AppService; use crate::session::Session; /// Get current user account /// /// Returns the authenticated user's account information including: /// - Username, display name, and bio /// - Avatar URL /// - Account status and role /// - Last login and creation timestamps /// /// Requires authentication. #[utoipa::path( get, path = "/api/v1/user/account", tag = "User", operation_id = "userGetAccount", responses( (status = 200, description = "Account retrieved successfully. Returns user account with all metadata.", body = ApiResponse), (status = 401, description = "Authentication required or session expired", body = ApiErrorResponse), (status = 404, description = "User not found", body = ApiErrorResponse), (status = 500, description = "Internal server error", body = ApiErrorResponse), ), security( ("session_cookie" = []) ) )] pub async fn get_account( service: web::Data, session: Session, ) -> Result { let user = service.user.user_account(&session).await?; Ok(HttpResponse::Ok().json(ApiResponse::new(user))) }