def swap_link(self):
        """Swaps the source and target of a relationship."""
        # Avoid circular dependency
        self.target, self.source = self.source, self.target
        edge = json.loads(self.model_dump_json())
        edge["_from"] = self.source
        edge["_to"] = self.target
        edge["_id"] = f"links/{self.id}"
        graph = self._db.graph("threat_graph")
        job = graph.update_edge(edge)
        while job.status() != "done":
            time.sleep(ASYNC_JOB_WAIT_TIME)
        self.save()
Swaps the source and target of a relationship.
core/database_arango.py