//! Shared request context helpers for schema catalog route handlers.
//!
//! This module centralizes request-scoped schema-client pool resolution so
//! endpoint handlers stay focused on input normalization and response flow.
use actix_web::{HttpRequest, HttpResponse};
use sqlx::{Pool, Postgres};
use crate::AppState;
use super::context_pool_resolver::require_schema_client_pool;
/// Resolves and returns the schema client pool for request-scoped catalog calls.
pub(super) async fn require_schema_pool(
req: &HttpRequest,
app_state: &AppState,
) -> Result<Pool<Postgres>, HttpResponse> {
let (_client_name, pool): (String, Pool<Postgres>) =
match require_schema_client_pool(req, app_state).await {
Ok(resolved) => resolved,
Err(resp) => return Err(resp),
};
Ok(pool)
}