"""Methods to work with particpants social auth information.""" from users.connectors import dynamodb def fetch(participant_id, identity_id, platform): """Fetch a record from dynamodb. Fetch a social auth item from dynamodb connector. Args: participant_id (str): the id of the participant to be fetched identity_id (str): The id of the user trying to unlink the participant's social account platform (str): the social platform for which the participant is expected Returns: The participant record if successful or None """ participant = dynamodb.get_social_auth_item(participant_id, identity_id, platform) return participant def set_linked_to_false(participant_id, identity_id, platform): """Update the link status of social auth item in dynamodb. Updates the link status of an item from dynamodb connector. Args: participant_id (str): the id of the participant to be fetched identity_id (str): The id of the user trying to unlink the participant's social account platform (str): the social platform for which the participant is expected Returns: The participant record if successful or None """ participant = dynamodb.update_social_auth_item_linked_status( participant_id, identity_id, platform, False ) return participant