manta_server/server/handlers/
analysis.rs1use axum::{Json, http::StatusCode, response::IntoResponse};
13
14use super::{ErrorResponse, RequestCtx, SiteHeader, to_handler_error};
15use crate::service;
16use manta_shared::types::api::analysis::BackendSummary;
17
18#[utoipa::path(get, path = "/analysis/images", tag = "analysis",
23 params(SiteHeader),
24 security(("bearerAuth" = [])),
25 responses(
26 (status = 200, description = "Image-analysis rows", body = Vec<BackendSummary>),
27 (status = 401, description = "Unauthorized", body = ErrorResponse),
28 (status = 500, description = "Internal error", body = ErrorResponse),
29 )
30)]
31#[tracing::instrument(skip_all)]
32pub async fn get_image_analysis(
33 ctx: RequestCtx,
34) -> Result<impl IntoResponse, (StatusCode, Json<ErrorResponse>)> {
35 let infra = ctx.infra();
36 let rows = service::analysis::get_image_analysis(&infra, &ctx.token)
37 .await
38 .map_err(to_handler_error)?;
39 Ok((StatusCode::OK, Json(rows)))
40}