Example #1
0
def getProductReview():
    error = False
    prod = Product()
    prod.id = request.json['id']
    try:
        result = prod.listReviews()
    except (Exception) as err:
        error = True
        return handleError(err)
    finally:
        if not (error):
            return jsonify({'result': 'success', 'data': result})
Example #2
0
def ProductSetActive():
    error = False
    new = Product()
    new.id = request.json['id']
    new.active = request.json['active']
    try:
        new.setActive()
    except (Exception) as err:
        error = True
        return handleError(err)
    finally:
        if not (error):
            return jsonify({'result': 'success'})
Example #3
0
def listproductsRecomended():
    results = []
    error = False
    prod = Product()
    prod.type = request.json['type']
    prod.id = request.json['id']
    try:
        results = prod.listRecomended()
    except (Exception) as err:
        error = True
        return handleError(err)
    finally:
        if not (error):
            return jsonify({'result': 'success', 'data': results})
Example #4
0
def modProduct():
    error = False
    prod = Product()
    prod.id = request.json['id']
    prod.name = request.json['name']
    prod.dsc = request.json['dsc']
    prod.material = request.json['material']
    prod.genre = request.json['genre']
    prod.brand = request.json['brand']
    prod.type = request.json['type']
    prod.discount = request.json['discount']
    prod.price = request.json['price']
    try:
        prod.mod()
    except (Exception) as err:
        error = True
        return handleError(err)
    finally:
        if not (error):
            return jsonify({'result': 'success'})