Exemplo n.º 1
0
def get_genres_by_profile_id(profile_id):
    """Return genre information of the given profile id"""
    genre = Genre2Profile.query.filter_by(profile_id=profile_id).first()
    if genre:
        return jsonify(row2dict(genre))
    else:
        return make_response(
            jsonify({
                "code": 404,
                "msg": "No genre data fetched"
            }), 404)
Exemplo n.º 2
0
def get_actors_by_profile_id(profile_id):
    """Return actor information of the given profile id"""
    actor = Actor2Profile.query.filter_by(profile_id=profile_id).first()
    if actor:
        return jsonify(row2dict(actor))
    else:
        return make_response(
            jsonify({
                "code": 404,
                "msg": "No actor data fetched"
            }), 404)
Exemplo n.º 3
0
def get_ratings_by_profile_id(profile_id):
    """Return rating information of the given profile id"""
    rating = Rating2Profile.query.filter_by(profile_id=profile_id).first()
    if rating:
        return jsonify(row2dict(rating))
    else:
        return make_response(
            jsonify({
                "code": 404,
                "msg": "No rating data fetched"
            }), 404)
Exemplo n.º 4
0
def get_profile_by_user_id(user_id):
    """Return profile information of the given user id"""
    profile = Profile.query.filter_by(user_id=user_id).first()
    if profile:
        return jsonify(row2dict(profile))
    else:
        return make_response(
            jsonify({
                "code": 404,
                "msg": "This user has not created any movie profile."
            }), 404)
Exemplo n.º 5
0
def get_lengths_by_profile_id(profile_id):
    """Return director information of the given profile id"""
    length = Length2Profile.query.filter_by(profile_id=profile_id).first()
    if length:
        return jsonify(row2dict(length))
    else:
        return make_response(
            jsonify({
                "code": 404,
                "msg": "No length data fetched"
            }), 404)
Exemplo n.º 6
0
def get_studios_by_profile_id(profile_id):
    """Return studio information of the given profile id"""
    studio = Studio2Profile.query.filter_by(profile_id=profile_id).first()
    if studio:
        return jsonify(row2dict(studio))
    else:
        return make_response(
            jsonify({
                "code": 404,
                "msg": "No studio data fetched"
            }), 404)
Exemplo n.º 7
0
def get_all_profiles():
    """Return information for all user profiles stored in the database"""
    profile_list = Profile.query.all()
    return jsonify([row2dict(profile) for profile in profile_list])