pub async fn verify_user(
    tracking_label: &str,
    config: &CoreConfig,
    db_pool: &Pool<PostgresConnectionManager<MakeTlsConnector>>,
    kafka_pool: &KafkaPublisher,
    full_url: &str
) -> Result<Response<Body>, Infallible>
Expand description

verify_user

Handles verifying a user’s email (users.email) record (in the users_verified table) based off values in the query parameters on the hyper Request’s url

Overview Notes

This function only updates 1 users_verified record at a time.

Arguments

  • tracking_label - &str - caller logging label
  • _config - CoreConfig server statics and not used in request in this version
  • db_pool - Pool - postgres client db threadpool with required tls encryption
  • kafka_pool - KafkaPublisher for asynchronously publishing messages to the connected kafka cluster
  • headers - HeaderMap - hashmap containing headers in key-value pairs Request’s Body
  • full_url - &str - the url in the Request

Returns

verify_user on Success Returns

The updated users record from the db: (ApiResUserVerify)

hyper Response containing a json-serialized ApiResUserVerify dictionary within the Body and a 200 HTTP status code

Ok(Response)

Errors

verify_user on Failure Returns

Note: user email verification can expire over time. Any user can attempt to re-verify at any time.

All errors return as a hyper Response containing a json-serialized ApiResUserVerify dictionary with a non-200 HTTP status code

Err(Response)