pub async fn read_user_state_from_db( user_id: String, db: &PgPool, ) -> Result<UserState, AppError>
Reads user state from the database.