예제 #1
0
def genre_id(id=0):
    user_id, _ = get_authorization()

    data = request.args
    page = data.get("page", 1, type=int)

    return genre_get_movies(id, page, user_id)
예제 #2
0
def search():
    user_id, _ = get_authorization()

    data = request.args
    page = data.get("page", 1, type=int)
    key = data.get("query", "", type=str)
    searchType = data.get("type", "All", type=str)
    short = data.get("short", 1, type=int)

    return search_movie(key, page, searchType, short, user_id)
예제 #3
0
def add_review(id=0):
    user_id, _ = get_authorization()

    data = request.get_json()
    rated = data.get("rated", 0)
    headline = data.get("headline", "")
    body = data.get("body", "")

    # validate request data:
    if len(headline) > 0 and len(body) > 50 and len(body) < 500:
        return user_review(user_id, id, headline, body, rated)
    else:
        return create_response(400, "Request data invalid")
예제 #4
0
def protected():
    id, email = get_authorization()
    return create_response(200, 'Token is valid', {'id': id, 'email': email})
예제 #5
0
def refresh_token():
    id, email = get_authorization()
    return refresh(id, email)
예제 #6
0
def get_top_rated():
    user_id, _ = get_authorization()

    return get_top_rated_movies(user_id)
예제 #7
0
def get_popular():
    user_id, _ = get_authorization()

    return get_popular_movies(user_id)
예제 #8
0
def add_to_favorites(id=0):
    user_id, _ = get_authorization()

    return add_movie_to_favorite(user_id, id)
예제 #9
0
def get_review(id=0):
    user_id, _ = get_authorization()

    return get_user_review(id, user_id)
예제 #10
0
def delete_movie_rating(id=0):
    user_id, _ = get_authorization()

    return remove_rating(id, user_id)
예제 #11
0
def rate_movie(id=0):
    user_id, _ = get_authorization()

    data = request.get_json()
    rated = data.get("rated", 0)
    return movie_rating(id, user_id, rated)
예제 #12
0
def get_movie_review(id=0):
    user_id, _ = get_authorization()
    page = request.args.get('page', default=1, type=int)

    return movie_get_review(id, user_id, page)
예제 #13
0
def get_movie_by_id(id=0):
    user_id, _ = get_authorization()

    return movie_get_by_id(id, user_id)
예제 #14
0
def get_recommend():
    user_id, _ = get_authorization()

    return recommend(user_id)
예제 #15
0
def get_favorites():
    user_id, _ = get_authorization()

    return get_favorite_movies(user_id)