def get_wishlist_list(): """ Returns the Wishlists by searching the keywords of wishlist_name or the customer_id. This function returns a wishlist based on wishlist_name or customer id. If the customer_id and the wishlist id parameters are empty, returns all the wishlists in the database --- tags: - Wishlist produces: - application/json definitions: Wishlist: type: object properties: id: type: integer customer_id: type: integer wishlist_name: type: string parameters: - name: keyword in: query description: the name of the wishlist type: string - name: query in: query description: the id of the customer type: integer responses: 200: description: A Wishlist schema: $ref: '#/definitions/Wishlist' """ query_lists = [] customer_id = request.args.get('customer_id') keyword = request.args.get('keyword') if keyword: query_lists = Wishlist.find_by_wishlist_name(keyword) elif customer_id: query_lists = Wishlist.find_by_customer_id(customer_id) else: """ Returns all of the Wishlists """ query_lists = Wishlist.all() results = [wishlist.serialize() for wishlist in query_lists] return make_response(jsonify(results), status.HTTP_200_OK)
def get_wishlist_list(): """ Returns the Wishlists by searching the keywords of wishlist_name --- tags: - Wishlist produces: - application/json parameters: - name: keyword in: query description: the name of the wishlist type: string required: true responses: 200: description: An Item schema: $ref: '#/definitions/Wishlist' """ query_lists = [] keyword = request.args.get('keyword') if keyword: query_lists = Wishlist.find_by_wishlist_name(keyword) else: """ Returns all of the Wishlists """ query_lists = Wishlist.all() results = [wishlist.serialize() for wishlist in query_lists] return make_response(jsonify(results), status.HTTP_200_OK)