16 lines
458 B
Rust
16 lines
458 B
Rust
use axum::{extract::{Extension, Path}, Json};
|
|
use uuid::Uuid;
|
|
|
|
use crate::{app_state::{AppState, SettlementSnapshot}, error::AppError};
|
|
|
|
pub async fn show(
|
|
Path(event_id): Path<Uuid>,
|
|
Extension(state): Extension<AppState>,
|
|
) -> Result<Json<SettlementSnapshot>, AppError> {
|
|
let Some(settlement) = state.settlement_for_event(event_id).await else {
|
|
return Err(AppError::not_found("Settlement not found"));
|
|
};
|
|
|
|
Ok(Json(settlement))
|
|
}
|