mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 04:17:10 +02:00
implement list indexes
This commit is contained in:
parent
482f734e53
commit
d43dc4824c
6 changed files with 120 additions and 26 deletions
|
@ -19,19 +19,20 @@ pub fn services(cfg: &mut web::ServiceConfig) {
|
|||
.service(get_all_updates_status);
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct IndexResponse {
|
||||
pub name: String,
|
||||
pub uid: String,
|
||||
created_at: DateTime<Utc>,
|
||||
updated_at: DateTime<Utc>,
|
||||
pub primary_key: Option<String>,
|
||||
}
|
||||
|
||||
#[get("/indexes", wrap = "Authentication::Private")]
|
||||
async fn list_indexes(_data: web::Data<Data>) -> Result<HttpResponse, ResponseError> {
|
||||
todo!()
|
||||
async fn list_indexes(data: web::Data<Data>) -> Result<HttpResponse, ResponseError> {
|
||||
match data.list_indexes() {
|
||||
Ok(indexes) => {
|
||||
let json = serde_json::to_string(&indexes).unwrap();
|
||||
Ok(HttpResponse::Ok().body(&json))
|
||||
}
|
||||
Err(e) => {
|
||||
error!("error listing indexes: {}", e);
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#[get("/indexes/{index_uid}", wrap = "Authentication::Private")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue