pub async fn update_user_data(
    tracking_label: &str,
    config: &CoreConfig,
    db_pool: &Pool<PostgresConnectionManager<MakeTlsConnector>>,
    kafka_pool: &KafkaPublisher,
    headers: &HeaderMap<HeaderValue>,
    bytes: &[u8]
) -> Result<Response<Body>, Infallible>
Expand description

update_user_data

Handles updating a user data record (in the users_data table) based off values in the POST-ed hyper Request’s Body

Overview Notes

This function only updates 1 users_data record at a time.

Arguments

  • tracking_label - &str - caller logging label
  • config - CoreConfig
  • 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
  • bytes - &[u8] - received bytes from the hyper Request’s Body

Returns

update_user_data on Success Returns

The newly-updated users_data record from the db (ModelUserData)

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

Ok(Response)

Errors

update_user_data on Failure Returns

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

Err(Response)