feat: advance siteey create now allows setting publication status

This commit is contained in:
Aravinth Manivannan
2023-06-30 16:49:35 +05:30
parent 22edb04ce2
commit 468752f691
6 changed files with 28 additions and 0 deletions

View File

@@ -31,6 +31,7 @@ pub struct CreateCaptcha {
pub levels: Vec<Level>,
pub duration: u32,
pub description: String,
pub publish_benchmarks: bool,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
@@ -52,6 +53,11 @@ pub async fn create(
) -> ServiceResult<impl Responder> {
let username = id.identity().unwrap();
let mcaptcha_config = runner::create(&payload, &data, &username).await?;
if payload.publish_benchmarks {
data.db
.analytics_create_psuedo_id_if_not_exists(&mcaptcha_config.key)
.await?;
}
Ok(HttpResponse::Ok().json(mcaptcha_config))
}