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