Skip to main content

update_user_profile

Function update_user_profile 

Source
pub async fn update_user_profile(
    __arg0: State<DB>,
    __arg1: Json<UpdateUserProfileRequest>,
) -> (StatusCode, Json<AuthTokenResponse>)
Expand description

Handles user profile update requests This endpoint allows clients to update their user profile information, such as username and email. It verifies the provided data, updates the user profile in the database, and logs the operation.

§Arguments

  • State(db) - Shared state containing the database connection
  • Json(payload) - The profile update request payload containing the user ID and new profile information

§Returns

  • (StatusCode, Json<AuthTokenResponse>) - The HTTP status code and JSON response indicating success or failure of the profile update operation

§Example

let payload = UpdateUserProfileRequest {
    user_id: "user_id".to_string(),
    username: Some("new_username".to_string()),
    email: Some("new_email@example.com".to_string()),
};