use actix_web::{HttpResponse, web}; use crate::api::response::{ApiErrorResponse, ApiResponse}; use crate::error::AppError; use crate::service::AppService; use crate::service::auth::me::ContextMe; use crate::session::Session; #[utoipa::path( get, path = "/api/v1/auth/me", tag = "Auth", operation_id = "authGetCurrentUser", summary = "Get current signed-in user context", description = "Return the current user's basic profile, preferred language, timezone, and notification summary using the user_uid bound to the session. This endpoint is typically used to restore the login state when the frontend app starts.", responses( (status = 200, description = "The current session is authenticated. Returns the user context.", body = ApiResponse), (status = 401, description = "The current session is unauthenticated or the login state has expired.", body = ApiErrorResponse), (status = 404, description = "The user in the session no longer exists, has been disabled, or has been deleted.", body = ApiErrorResponse), (status = 500, description = "Database read failed.", body = ApiErrorResponse) ) )] pub async fn handle( service: web::Data, session: Session, ) -> Result { let data = service.auth.auth_me(session).await?; Ok(HttpResponse::Ok().json(ApiResponse::new(data))) }