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

delete_user

Handles deleting a user by changing the users.state to 1. This change is enforced on login_user when the user tries to login again and on the validate_user_token for any existing user jwt’s.

Overview Notes

A user can only have one record in the users table.

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

Success

Deletes a user in the db

hyper Response containing a json-serialized ApiResUserDelete dictionary within the Body and a 204 HTTP status code

Ok(Response)

Errors

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

Err(Response)