From f83e874e3545a5d6d393c4267259c2d0094fc8f3 Mon Sep 17 00:00:00 2001 From: qdequele Date: Thu, 16 Jan 2020 16:14:30 +0100 Subject: [PATCH] return the good created_at and updated_at on index creation --- meilisearch-http/src/routes/index.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/meilisearch-http/src/routes/index.rs b/meilisearch-http/src/routes/index.rs index 006ffd348..537496054 100644 --- a/meilisearch-http/src/routes/index.rs +++ b/meilisearch-http/src/routes/index.rs @@ -166,13 +166,22 @@ pub async fn create_index(mut ctx: Request) -> SResult { .put_name(&mut writer, &name) .map_err(ResponseError::internal)?; + let created_at = created_index.main + .created_at(&writer) + .map_err(ResponseError::internal)? + .unwrap_or(Utc::now()); + let updated_at = created_index.main + .updated_at(&writer) + .map_err(ResponseError::internal)? + .unwrap_or(Utc::now()); + writer.commit().map_err(ResponseError::internal)?; let response_body = IndexCreateResponse { name: name, uid, - created_at: Utc::now(), - updated_at: Utc::now(), + created_at, + updated_at, }; Ok(tide::Response::new(201).body_json(&response_body).unwrap())