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)
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)
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")
def protected(): id, email = get_authorization() return create_response(200, 'Token is valid', {'id': id, 'email': email})
def refresh_token(): id, email = get_authorization() return refresh(id, email)
def get_top_rated(): user_id, _ = get_authorization() return get_top_rated_movies(user_id)
def get_popular(): user_id, _ = get_authorization() return get_popular_movies(user_id)
def add_to_favorites(id=0): user_id, _ = get_authorization() return add_movie_to_favorite(user_id, id)
def get_review(id=0): user_id, _ = get_authorization() return get_user_review(id, user_id)
def delete_movie_rating(id=0): user_id, _ = get_authorization() return remove_rating(id, user_id)
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)
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)
def get_movie_by_id(id=0): user_id, _ = get_authorization() return movie_get_by_id(id, user_id)
def get_recommend(): user_id, _ = get_authorization() return recommend(user_id)
def get_favorites(): user_id, _ = get_authorization() return get_favorite_movies(user_id)