mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-11 10:05:41 +00:00
feat: migrate account deletion to use db_* interface
This commit is contained in:
@@ -64,9 +64,7 @@ pub mod runners {
|
||||
use super::*;
|
||||
|
||||
pub async fn delete_user(name: &str, data: &AppData) -> ServiceResult<()> {
|
||||
sqlx::query!("DELETE FROM mcaptcha_users WHERE name = ($1)", name,)
|
||||
.execute(&data.db)
|
||||
.await?;
|
||||
data.dblib.delete_user(name).await?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,11 +197,11 @@ impl From<CredsError> for ServiceError {
|
||||
impl From<DBError> for ServiceError {
|
||||
#[cfg(not(tarpaulin_include))]
|
||||
fn from(e: DBError) -> ServiceError {
|
||||
match e{
|
||||
match e {
|
||||
DBError::UsernameTaken => ServiceError::UsernameTaken,
|
||||
DBError::SecretTaken => ServiceError::InternalServerError,
|
||||
DBError::EmailTaken => ServiceError::EmailTaken,
|
||||
_ => ServiceError::DBError(DBErrorWrapper(e))
|
||||
_ => ServiceError::DBError(DBErrorWrapper(e)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user