def add_actor_review(user_name: str, actor_name: str, review_text: str, repo: AbstractRepository): actor = repo.get_actor(actor_name) user = repo.get_user(user_name) if user is None: raise UnknownUserException review = make_actor_review(user, actor, review_text) repo.add_actor_review(review)
def get_actor(name, repo: AbstractRepository): actor = repo.get_actor(name) return actor_to_dict(actor)
def get_reviews_for_actor(actor_name, repo: AbstractRepository): actor = repo.get_actor(actor_name) return actor_reviews_to_dict(actor.reviews)