versions/v2/review.py
def read_review(businessId):
    """Reads all Review given a business ID"""
    business = Business.query.get(businessId)
    if not business:
        return jsonify({'warning': 'Business Not Found'}), 404

    if business.reviews:
        return jsonify({'reviews': [
            {
                'id': review.id,
                'title': review.title,
                'desc': review.desc,
                'reviewer': review.reviewer.username,
                'business': review.business.name,
                'created_at': review.created_at,
                'updated_at': review.updated_at,
            } for review in business.reviews
        ]}), 200

    return jsonify({'warning': 'Business has no reviews'}), 200
Reads all Review given a business ID
Reads all Review given a business ID
Reads all Review given a business ID
def read_review(businessId):
    business = Business.query.get(businessId)
    if not business:
        return jsonify({'warning': 'Business Not Found'}), 404
    if business.reviews:
        return jsonify({'reviews': [
            {
                'id': review.id,
                'title': review.title,
                'desc': review.desc,
                'reviewer': review.reviewer.username,
                'business': review.business.name,
                'created_at': review.created_at,
                'updated_at': review.updated_at,
            } for review in business.reviews
        ]}), 200
    return jsonify({'warning': 'Business has no reviews'}), 200
def read_review ( businessId ) : business = Business . query . get ( businessId ) if not business : return jsonify ( { 'warning' : 'Business Not Found' } ) , 404 if business . reviews : return jsonify ( { 'reviews' : [ { 'id' : review . id , 'title' : review . title , 'desc' : review . desc , 'reviewer' : review . reviewer . username , 'business' : review . business . name , 'created_at' : review . created_at , 'updated_at' : review . updated_at , } for review in business . reviews ] } ) , 200 return jsonify ( { 'warning' : 'Business has no reviews' } ) , 200
Reads all Review given a business ID
Reads all Review given a business ID
"""Reads all Review given a business ID"""
businessId