Can delete account

This commit is contained in:
2023-06-06 10:19:54 +02:00
parent 85e5be0328
commit 2f3f61b159
3 changed files with 29 additions and 4 deletions

View File

@ -171,6 +171,18 @@ pub async fn delete_not_validated_accounts() -> anyhow::Result<()> {
})
}
/// Delete account
pub async fn delete_account(user: &User) -> anyhow::Result<()> {
log::info!("Delete account #{:?}", user.id());
// TODO : remove families memberships
db_connection::execute(|conn| {
diesel::delete(users::dsl::users.filter(users::dsl::id.eq(user.id))).execute(conn)?;
Ok(())
})
}
/// Mark account as validated
pub async fn validate_account(user: &mut User) -> anyhow::Result<()> {
if user.time_activate > 0 {