[WIP] rebase on main

This commit is contained in:
tamo 2021-05-10 20:25:09 +02:00
parent c3552cecdf
commit efca63f9ce
No known key found for this signature in database
GPG key ID: 20CD8020AFA88D69
10 changed files with 381 additions and 87 deletions

View file

@ -7,18 +7,17 @@ use crate::helpers::Authentication;
use crate::Data;
pub fn services(cfg: &mut web::ServiceConfig) {
cfg.service(trigger_dump)
cfg.service(create_dump)
.service(get_dump_status);
}
#[post("/dumps", wrap = "Authentication::Private")]
async fn trigger_dump(
async fn create_dump(
data: web::Data<Data>,
) -> Result<HttpResponse, ResponseError> {
eprintln!("dump started");
let res = data.dump().await?;
let res = data.create_dump().await?;
Ok(HttpResponse::Ok().body(res))
Ok(HttpResponse::Ok().json(res))
}
#[derive(Debug, Serialize)]
@ -29,13 +28,15 @@ struct DumpStatusResponse {
#[derive(Deserialize)]
struct DumpParam {
_dump_uid: String,
dump_uid: String,
}
#[get("/dumps/{dump_uid}/status", wrap = "Authentication::Private")]
async fn get_dump_status(
_data: web::Data<Data>,
_path: web::Path<DumpParam>,
data: web::Data<Data>,
path: web::Path<DumpParam>,
) -> Result<HttpResponse, ResponseError> {
todo!()
let res = data.dump_status(path.dump_uid.clone()).await?;
Ok(HttpResponse::Ok().json(res))
}