async fn delete_follower(
collection: &Collection<SummonerFollowedData>,
followed_summoner: &SummonerFollowedData,
) -> Result<(), Error>Expand description
⚙️ Function: Deletes a followed summoner from the database.
This asynchronous function removes a summoner from the follower_summoner collection in MongoDB based on their puuid.
It logs the deletion action and ensures the summoner is no longer tracked in the database.
§Parameters:
collection: A reference to the MongoDBCollection<SummonerFollowedData>, used to interact with the database and delete the summoner data.followed_summoner: A reference to aSummonerFollowedDatastruct, representing the summoner that is being deleted. The deletion is based on the summoner’spuuid.
§Returns:
Result<(), mongodb::error::Error>: Returns an empty result if successful, or an error if the deletion fails.
§Example:
This function is typically called when the follow time for a summoner has expired, and they need to be removed from the database:
delete_follower(&collection, &followed_summoner).await?;§Notes:
- The
puuidfield is used as the unique identifier for deletion from the MongoDB collection. - The function logs the
puuidof the summoner being deleted usinglog::info!, which outputs the message to the standard log stream.