Example #1
0
def delete_brand_function():
    if request.method == 'POST':
        try:
            input_data = json.loads(request.get_data())
            response = brandHandle.delete_brand(input_data)
            return json.dumps(response)
        except Exception as e:
            return json.dumps(AppConstants.result_error_template(str(e)))
    else:
        return json.dumps(AppConstants.result_error_template(AppConstants.method_not_supported))
Example #2
0
def create_supplier():
    if request.method == 'POST':
        try:
            input_data = json.loads(request.get_data())
            response = supplierHandle.create_supplier(input_data)
            print(response)
            return json.dumps(response)
        except Exception as e:
            return json.dumps(AppConstants.result_error_template(str(e)))
    else:
        return json.dumps(
            AppConstants.result_error_template(
                AppConstants.method_not_supported))
Example #3
0
def fetch_all_brands():
    if request.method == 'GET':
        try:
            brand_data = brandHandle.get_brands()
            response = brand_data
            return json.dumps(response, default=str)
        except Exception as e:
            print(e, ': error while fetching from brand service')
            return str(e)
    else:
        return json.dumps(AppConstants.result_error_template(AppConstants.method_not_supported))