mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-27 04:25:06 +08:00
update dump route
This commit is contained in:
parent
adf91d286b
commit
ce4fb8ce20
@ -1,18 +1,17 @@
|
|||||||
use actix_web::HttpResponse;
|
|
||||||
use actix_web::{get, post, web};
|
|
||||||
use log::debug;
|
use log::debug;
|
||||||
|
use actix_web::{web, HttpResponse};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::error::ResponseError;
|
use crate::error::ResponseError;
|
||||||
use crate::helpers::Authentication;
|
use crate::extractors::authentication::{policies::*, GuardedData};
|
||||||
use crate::Data;
|
use crate::Data;
|
||||||
|
|
||||||
pub fn services(cfg: &mut web::ServiceConfig) {
|
pub fn services(cfg: &mut web::ServiceConfig) {
|
||||||
cfg.service(create_dump).service(get_dump_status);
|
cfg.route("/dumps", web::post().to(create_dump))
|
||||||
|
.route("/dumps/{dump_uid}/status", web::get().to(get_dump_status));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[post("/dumps", wrap = "Authentication::Private")]
|
async fn create_dump(data: GuardedData<Private, Data>) -> Result<HttpResponse, ResponseError> {
|
||||||
async fn create_dump(data: web::Data<Data>) -> Result<HttpResponse, ResponseError> {
|
|
||||||
let res = data.create_dump().await?;
|
let res = data.create_dump().await?;
|
||||||
|
|
||||||
debug!("returns: {:?}", res);
|
debug!("returns: {:?}", res);
|
||||||
@ -30,9 +29,8 @@ struct DumpParam {
|
|||||||
dump_uid: String,
|
dump_uid: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/dumps/{dump_uid}/status", wrap = "Authentication::Private")]
|
|
||||||
async fn get_dump_status(
|
async fn get_dump_status(
|
||||||
data: web::Data<Data>,
|
data: GuardedData<Private, Data>,
|
||||||
path: web::Path<DumpParam>,
|
path: web::Path<DumpParam>,
|
||||||
) -> Result<HttpResponse, ResponseError> {
|
) -> Result<HttpResponse, ResponseError> {
|
||||||
let res = data.dump_status(path.dump_uid.clone()).await?;
|
let res = data.dump_status(path.dump_uid.clone()).await?;
|
||||||
|
Loading…
Reference in New Issue
Block a user