fix api in backend

This commit is contained in:
2025-12-04 13:10:32 +01:00
parent b5d0a8cb66
commit 225f810513
2 changed files with 4 additions and 10 deletions
+1 -1
View File
@@ -81,7 +81,7 @@ pub mod schemas {
pub use crate::error::ApiErrorResponse;
pub use crate::models::ApiCapability;
pub use crate::routes::correspondents::{
CorrespondentSummary, CorrespondentUsage, CreateCorrespondentRequest,
CorrespondentSummary, CreateCorrespondentRequest,
UpdateCorrespondentRequest,
};
pub use crate::routes::documents::{
+3 -9
View File
@@ -20,11 +20,6 @@ use crate::{
},
};
#[derive(Serialize, ToSchema)]
pub struct CorrespondentUsage {
pub total: i64,
}
#[derive(Serialize, ToSchema)]
pub struct CorrespondentSummary {
pub id: Uuid,
@@ -33,7 +28,7 @@ pub struct CorrespondentSummary {
pub metadata: Value,
pub created_at: String,
pub updated_at: String,
pub usage: CorrespondentUsage,
pub usage_count: i64,
}
#[derive(Deserialize, ToSchema)]
@@ -268,14 +263,14 @@ pub async fn delete_correspondent(
no_content()
}
fn build_summary(correspondent: Correspondent, total: i64) -> CorrespondentSummary {
fn build_summary(correspondent: Correspondent, usage_count: i64) -> CorrespondentSummary {
CorrespondentSummary {
id: correspondent.id,
name: correspondent.name,
metadata: correspondent.metadata,
created_at: to_iso(correspondent.created_at),
updated_at: to_iso(correspondent.updated_at),
usage: CorrespondentUsage { total },
usage_count,
}
}
@@ -310,7 +305,6 @@ fn load_usage_for_correspondent(
),
components(schemas(
crate::routes::correspondents::CorrespondentSummary,
crate::routes::correspondents::CorrespondentUsage,
crate::routes::correspondents::CreateCorrespondentRequest,
crate::routes::correspondents::UpdateCorrespondentRequest
))