Make types Serialize and Deserialize for proxying

This commit is contained in:
Louis Dureuil
2025-07-29 14:38:15 +02:00
parent 3682b92ee8
commit d352f33d16
2 changed files with 7 additions and 4 deletions

View File

@ -1195,7 +1195,7 @@ pub async fn delete_documents_batch(
Ok(HttpResponse::Accepted().json(task)) Ok(HttpResponse::Accepted().json(task))
} }
#[derive(Debug, Deserr, ToSchema)] #[derive(Debug, Deserr, ToSchema, Serialize)]
#[deserr(error = DeserrJsonError, rename_all = camelCase, deny_unknown_fields)] #[deserr(error = DeserrJsonError, rename_all = camelCase, deny_unknown_fields)]
#[schema(rename_all = "camelCase")] #[schema(rename_all = "camelCase")]
pub struct DocumentDeletionByFilter { pub struct DocumentDeletionByFilter {
@ -1287,7 +1287,7 @@ pub async fn delete_documents_by_filter(
Ok(HttpResponse::Accepted().json(task)) Ok(HttpResponse::Accepted().json(task))
} }
#[derive(Debug, Deserr, ToSchema)] #[derive(Debug, Deserr, ToSchema, Serialize)]
#[deserr(error = DeserrJsonError, rename_all = camelCase, deny_unknown_fields)] #[deserr(error = DeserrJsonError, rename_all = camelCase, deny_unknown_fields)]
pub struct DocumentEditionByFunction { pub struct DocumentEditionByFunction {
/// A string containing a RHAI function. /// A string containing a RHAI function.

View File

@ -184,7 +184,7 @@ pub fn is_dry_run(req: &HttpRequest, opt: &Opt) -> Result<bool, ResponseError> {
.is_some_and(|s| s.to_lowercase() == "true")) .is_some_and(|s| s.to_lowercase() == "true"))
} }
#[derive(Debug, Serialize, ToSchema)] #[derive(Debug, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct SummarizedTaskView { pub struct SummarizedTaskView {
/// The task unique identifier. /// The task unique identifier.
@ -198,7 +198,10 @@ pub struct SummarizedTaskView {
#[serde(rename = "type")] #[serde(rename = "type")]
kind: Kind, kind: Kind,
/// The date on which the task was enqueued. /// The date on which the task was enqueued.
#[serde(serialize_with = "time::serde::rfc3339::serialize")] #[serde(
serialize_with = "time::serde::rfc3339::serialize",
deserialize_with = "time::serde::rfc3339::deserialize"
)]
enqueued_at: OffsetDateTime, enqueued_at: OffsetDateTime,
} }