mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-23 05:14:27 +01:00
return the good created_at and updated_at on index creation
This commit is contained in:
parent
ae0a11e422
commit
f83e874e35
@ -166,13 +166,22 @@ pub async fn create_index(mut ctx: Request<Data>) -> SResult<Response> {
|
|||||||
.put_name(&mut writer, &name)
|
.put_name(&mut writer, &name)
|
||||||
.map_err(ResponseError::internal)?;
|
.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)?;
|
writer.commit().map_err(ResponseError::internal)?;
|
||||||
|
|
||||||
let response_body = IndexCreateResponse {
|
let response_body = IndexCreateResponse {
|
||||||
name: name,
|
name: name,
|
||||||
uid,
|
uid,
|
||||||
created_at: Utc::now(),
|
created_at,
|
||||||
updated_at: Utc::now(),
|
updated_at,
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(tide::Response::new(201).body_json(&response_body).unwrap())
|
Ok(tide::Response::new(201).body_json(&response_body).unwrap())
|
||||||
|
Loading…
Reference in New Issue
Block a user