use actix_web::{HttpRequest, HttpResponse};
use crate::AppState;
use super::context_auth::authorize_schema_read;
use super::response_contracts::SchemaClients;
fn schema_clients_response(app_state: &AppState) -> HttpResponse {
let clients: Vec<String> = app_state.pg_registry.list_clients();
HttpResponse::Ok().json(SchemaClients { clients })
}
pub(super) async fn authorized_schema_clients_response(
req: &HttpRequest,
app_state: &AppState,
) -> HttpResponse {
if let Err(resp) = authorize_schema_read(req, app_state, None).await {
return resp;
}
schema_clients_response(app_state)
}