fix api in backend
This commit is contained in:
@@ -81,7 +81,7 @@ pub mod schemas {
|
|||||||
pub use crate::error::ApiErrorResponse;
|
pub use crate::error::ApiErrorResponse;
|
||||||
pub use crate::models::ApiCapability;
|
pub use crate::models::ApiCapability;
|
||||||
pub use crate::routes::correspondents::{
|
pub use crate::routes::correspondents::{
|
||||||
CorrespondentSummary, CorrespondentUsage, CreateCorrespondentRequest,
|
CorrespondentSummary, CreateCorrespondentRequest,
|
||||||
UpdateCorrespondentRequest,
|
UpdateCorrespondentRequest,
|
||||||
};
|
};
|
||||||
pub use crate::routes::documents::{
|
pub use crate::routes::documents::{
|
||||||
|
|||||||
@@ -20,11 +20,6 @@ use crate::{
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Serialize, ToSchema)]
|
|
||||||
pub struct CorrespondentUsage {
|
|
||||||
pub total: i64,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Serialize, ToSchema)]
|
#[derive(Serialize, ToSchema)]
|
||||||
pub struct CorrespondentSummary {
|
pub struct CorrespondentSummary {
|
||||||
pub id: Uuid,
|
pub id: Uuid,
|
||||||
@@ -33,7 +28,7 @@ pub struct CorrespondentSummary {
|
|||||||
pub metadata: Value,
|
pub metadata: Value,
|
||||||
pub created_at: String,
|
pub created_at: String,
|
||||||
pub updated_at: String,
|
pub updated_at: String,
|
||||||
pub usage: CorrespondentUsage,
|
pub usage_count: i64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, ToSchema)]
|
#[derive(Deserialize, ToSchema)]
|
||||||
@@ -268,14 +263,14 @@ pub async fn delete_correspondent(
|
|||||||
no_content()
|
no_content()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_summary(correspondent: Correspondent, total: i64) -> CorrespondentSummary {
|
fn build_summary(correspondent: Correspondent, usage_count: i64) -> CorrespondentSummary {
|
||||||
CorrespondentSummary {
|
CorrespondentSummary {
|
||||||
id: correspondent.id,
|
id: correspondent.id,
|
||||||
name: correspondent.name,
|
name: correspondent.name,
|
||||||
metadata: correspondent.metadata,
|
metadata: correspondent.metadata,
|
||||||
created_at: to_iso(correspondent.created_at),
|
created_at: to_iso(correspondent.created_at),
|
||||||
updated_at: to_iso(correspondent.updated_at),
|
updated_at: to_iso(correspondent.updated_at),
|
||||||
usage: CorrespondentUsage { total },
|
usage_count,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,7 +305,6 @@ fn load_usage_for_correspondent(
|
|||||||
),
|
),
|
||||||
components(schemas(
|
components(schemas(
|
||||||
crate::routes::correspondents::CorrespondentSummary,
|
crate::routes::correspondents::CorrespondentSummary,
|
||||||
crate::routes::correspondents::CorrespondentUsage,
|
|
||||||
crate::routes::correspondents::CreateCorrespondentRequest,
|
crate::routes::correspondents::CreateCorrespondentRequest,
|
||||||
crate::routes::correspondents::UpdateCorrespondentRequest
|
crate::routes::correspondents::UpdateCorrespondentRequest
|
||||||
))
|
))
|
||||||
|
|||||||
Reference in New Issue
Block a user