pub async fn create_password_reset(pool: &DBPool, email: String) -> Result<PasswordReset> {
        prune_password_resets(pool).await?;

        let exists = password_reset_exists_for_email(pool, email.clone()).await?;

        if !exists {
            let mut res = generic_service_err!(
                sqlx::query_file_as!(PasswordReset, "sql/password_reset/create_password_reset.sql", email.clone())
                .fetch_all(pool).await,
                "Failed to create new password reset record");

            Ok(res.remove(0))
        } else {
            let password_reset = get_password_reset_for_email(pool, email.clone()).await?;

            Ok(password_reset)
        }
    }
/// Creates a password reset record and returns the resulting record
/// 
/// # Arguments
/// 
/// * `pool` - The database pool
/// * `email` - The email address of the user requesting the password reset
Creates a password reset record and returns the resulting record
Creates a password reset record and returns the resulting record
pub async fn create_password_reset(pool: &DBPool, email: String) -> Result<PasswordReset> {
        prune_password_resets(pool).await?;
        let exists = password_reset_exists_for_email(pool, email.clone()).await?;
        if !exists {
            let mut res = generic_service_err!(
                sqlx::query_file_as!(PasswordReset, "sql/password_reset/create_password_reset.sql", email.clone())
                .fetch_all(pool).await,
                "Failed to create new password reset record");
            Ok(res.remove(0))
        } else {
            let password_reset = get_password_reset_for_email(pool, email.clone()).await?;
            Ok(password_reset)
        }
    }
pub async fn create_password_reset ( pool : & DBPool , email : String ) -> Result < PasswordReset > { prune_password_resets ( pool ) . await ? ; let exists = password_reset_exists_for_email ( pool , email . clone ( ) ) . await ? ; if ! exists { let mut res = generic_service_err ! ( sqlx query_file_as ( PasswordReset " " email clone ( ) ) fetch_all ( pool ) await " " ) ; Ok ( res . remove ( 0 ) ) } else { let password_reset = get_password_reset_for_email ( pool , email . clone ( ) ) . await ? ; Ok ( password_reset ) } }
Creates a password reset record and returns the resulting record
Creates a password reset record and returns the resulting record
pool
&DBPool
email
String
pool
&DBPool
email
String