pub async fn verify_user(pool: &DBPool, verify_id: String) -> Result<()> {
        prune_verifications(pool).await?;

        let valid = verification_exists(pool, verify_id.clone()).await?;

        if valid {
            let user = get_user_by_verification(pool, verify_id.clone()).await?;
            delete_verification(pool, verify_id.clone()).await?;
            services::user_service::set_verified(pool, user.id, true).await?;

            Ok(())
        } else {
            Err(Error::new(ErrorKind::Other, "Invalid verify ID"))
        }
    }
/// Verifies a user's account and deletes the verification record
/// 
/// # Arguments
/// 
/// * `pool` - The database pool
/// * `verify_id` - The ID of the verification record
Verifies a user's account and deletes the verification record
Verifies a user ' s account and deletes the verification record
pub async fn verify_user(pool: &DBPool, verify_id: String) -> Result<()> {
        prune_verifications(pool).await?;
        let valid = verification_exists(pool, verify_id.clone()).await?;
        if valid {
            let user = get_user_by_verification(pool, verify_id.clone()).await?;
            delete_verification(pool, verify_id.clone()).await?;
            services::user_service::set_verified(pool, user.id, true).await?;
            Ok(())
        } else {
            Err(Error::new(ErrorKind::Other, "Invalid verify ID"))
        }
    }
pub async fn verify_user ( pool : & DBPool , verify_id : String ) -> Result < ( ) > { prune_verifications ( pool ) . await ? ; let valid = verification_exists ( pool , verify_id . clone ( ) ) . await ? ; if valid { let user = get_user_by_verification ( pool , verify_id . clone ( ) ) . await ? ; delete_verification ( pool , verify_id . clone ( ) ) . await ? ; services :: user_service :: set_verified ( pool , user . id , true ) . await ? ; Ok ( ( ) ) } else { Err ( Error :: new ( ErrorKind :: Other , " " ) ) } }
Verifies a user's account and deletes the verification record
Verifies a user ' s account and deletes the verification record
pool
&DBPool
verify_id
String
pool
&DBPool
verify_id
String