def remove(self, author, subject): """Remove review from DB""" result = review_repo.get_review_by_author_subject(author, subject) if result: review_repo.remove(result.id) return True else: return False
def add_review(self, author_id, subject, tier, anonym, text): """Add new review, if review with same author and subject exists -> update""" if not review_repo.get_subject(subject).first(): return False update = review_repo.get_review_by_author_subject(author_id, subject) if update: review_repo.update_review(update.id, tier, anonym, text) else: review_repo.add_review(author_id, subject, tier, anonym, text) return True