diff --git a/meilidb-http/src/routes/key.rs b/meilidb-http/src/routes/key.rs index cdefc39ba..94b6ba2fa 100644 --- a/meilidb-http/src/routes/key.rs +++ b/meilidb-http/src/routes/key.rs @@ -117,6 +117,8 @@ pub struct UpdatedRequest { description: Option, acl: Option>, indexes: Option>, + expires_at: Option>, + revoked: Option, } pub async fn update(mut ctx: Context) -> SResult { @@ -154,6 +156,14 @@ pub async fn update(mut ctx: Context) -> SResult { token_config.indexes = indexes; } + if let Some(expires_at) = data.expires_at { + token_config.expires_at = expires_at; + } + + if let Some(revoked) = data.revoked { + token_config.revoked = revoked; + } + token_config.updated_at = Utc::now(); common_store @@ -163,7 +173,7 @@ pub async fn update(mut ctx: Context) -> SResult { writer.commit().map_err(ResponseError::internal)?; Ok(tide::response::json(token_config) - .with_status(StatusCode::ACCEPTED) + .with_status(StatusCode::OK) .into_response()) } @@ -185,5 +195,5 @@ pub async fn delete(ctx: Context) -> SResult { writer.commit().map_err(ResponseError::internal)?; - Ok(StatusCode::ACCEPTED) + Ok(StatusCode::NO_CONTENT) }