use actix_web::{HttpResponse, web}; use crate::api::response::{ApiErrorResponse, ApiResponse}; use crate::error::AppError; use crate::service::AppService; use crate::service::auth::email::EmailResponse; use crate::session::Session; #[utoipa::path( get, path = "/api/v1/auth/email", tag = "Auth", operation_id = "authGetPrimaryEmail", summary = "Get current user verified email", description = "Return the verified primary email for the current signed-in user. If no verified email is bound to the account, the email field is null.", responses( (status = 200, description = "Read successfully.", body = ApiResponse), (status = 401, description = "The current session is not authenticated.", 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_get_email(&session).await?; Ok(HttpResponse::Ok().json(ApiResponse::new(data))) }