This commit is contained in:
leookun committed 2026-08-29 22:05:04 +08:00
1 parent 279e6bb07c
commit d200b3791d
204 files changed
+710 -440

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
use axum::{
extract::{Path, Query, State},
Json,
};
use serde::Deserialize;
use crate::Result;
use super::{CallDetail, CallSummary, ControlService};
#[derive(Deserialize)]
pub struct CallQuery {
#[serde(default = "default_limit")]
limit: i64,
}
pub async fn list(
State(service): State<ControlService>,
Query(query): Query<CallQuery>,
) -> Result<Json<Vec<CallSummary>>> {
Ok(Json(service.calls(query.limit).await?))
}
pub async fn detail(
State(service): State<ControlService>,
Path(call_id): Path<String>,
) -> Result<Json<CallDetail>> {
Ok(Json(service.call(&call_id).await?))
}
fn default_limit() -> i64 {
100
}