refactor captcha.rs and levels.rs and rm duration routes

This commit is contained in:
realaravinth
2021-12-16 20:46:50 +05:30
parent cf4a0f9b73
commit 73ce2d1cb1
22 changed files with 860 additions and 886 deletions

View File

@@ -23,7 +23,6 @@ use libmcaptcha::{
};
use serde::{Deserialize, Serialize};
use super::GetDurationResp;
use super::I32Levels;
use crate::errors::*;
use crate::stats::record::record_fetch;
@@ -96,9 +95,13 @@ async fn init_mcaptcha(data: &AppData, key: &str) -> ServiceResult<()> {
&key,
)
.fetch_all(&data.db);
struct DurationResp {
duration: i32,
}
// get duration
let duration_fut = sqlx::query_as!(
GetDurationResp,
DurationResp,
"SELECT duration FROM mcaptcha_config
WHERE key = $1",
&key,

View File

@@ -21,8 +21,7 @@ pub mod get_config;
pub mod verify_pow;
pub mod verify_token;
pub use super::mcaptcha::duration::GetDurationResp;
pub use super::mcaptcha::levels::I32Levels;
pub use super::mcaptcha::get::I32Levels;
pub fn services(cfg: &mut web::ServiceConfig) {
let cors = actix_cors::Cors::default()