mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-11 18:15:39 +00:00
feat: migrate username exists to use db_* interface
This commit is contained in:
@@ -40,22 +40,9 @@ pub mod runners {
|
||||
payload: &AccountCheckPayload,
|
||||
data: &AppData,
|
||||
) -> ServiceResult<AccountCheckResp> {
|
||||
let res = sqlx::query!(
|
||||
"SELECT EXISTS (SELECT 1 from mcaptcha_users WHERE name = $1)",
|
||||
&payload.val,
|
||||
)
|
||||
.fetch_one(&data.db)
|
||||
.await?;
|
||||
let exists = data.dblib.username_exists(&payload.val).await?;
|
||||
|
||||
let mut resp = AccountCheckResp { exists: false };
|
||||
|
||||
if let Some(x) = res.exists {
|
||||
if x {
|
||||
resp.exists = true;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(resp)
|
||||
Ok(AccountCheckResp { exists })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user