chore: get rid of direct DB init and use db_*

This commit is contained in:
realaravinth
2022-05-27 18:25:27 +05:30
parent cd72ae6ffe
commit d7fd23f565
25 changed files with 55 additions and 63 deletions

View File

@@ -130,7 +130,7 @@ async fn create(
};
let mcaptcha_config = create_runner(&msg, &data, &username).await?;
data.dblib
data.db
.add_traffic_pattern(&username, &mcaptcha_config.key, &pattern)
.await?;
Ok(HttpResponse::Ok().json(mcaptcha_config))
@@ -166,11 +166,11 @@ async fn update(
update_captcha_runner(&msg, &data, &username).await?;
data.dblib
data.db
.delete_traffic_pattern(&username, &msg.key)
.await?;
data.dblib
data.db
.add_traffic_pattern(&username, &msg.key, &pattern)
.await?;