20 lines
527 B
Rust
20 lines
527 B
Rust
use std::time::Duration;
|
|
|
|
use crate::prelude::*;
|
|
|
|
pub async fn delete(
|
|
State(AppState { pool, ref storage }): State<AppState>,
|
|
claims: Claims,
|
|
) -> GeneralResult<EmptyResponse> {
|
|
tokio::time::sleep(Duration::from_secs(100)).await;
|
|
db::users::delete_user(claims.user_id, &pool)
|
|
.try_for_each_concurrent(5, |file_id| async move {
|
|
let _ = storage.delete(file_id).await;
|
|
Ok(())
|
|
})
|
|
.await
|
|
.handle_internal("Error deleting the user")?;
|
|
|
|
Ok(EmptyResponse)
|
|
}
|