Added Account::delete_all method

This commit is contained in:
2023-05-09 20:32:07 +03:00
parent 3db99a3626
commit b326aa696d
2 changed files with 11 additions and 5 deletions

View File

@ -145,4 +145,13 @@ impl Entity {
.await
.map_err(Into::into)
}
/// Deletes all the user's accounts from DB
pub async fn delete_all(user_id: u64, db: &DatabaseConnection) -> crate::Result<()> {
Self::delete_many()
.filter(Column::UserId.eq(user_id))
.exec(db)
.await?;
Ok(())
}
}