def create_customer(): if request.json and 'customer' in request.json and 'match' in request.json: customer = request.json["customer"] match = request.json["match"] try: customer = db.create_customer(customer, match) except Exception as e: return jsonify(status="error", message=str(e)), 500 else: return jsonify( status="error", message="Must supply user 'customer' and 'match' as parameters" ), 400 if customer: return jsonify(status="ok", id=customer['id'], customer=customer), 201, { 'Location': absolute_url('/customer/' + customer['id']) } else: return jsonify( status="error", message="Customer lookup for this match already exists"), 409
def create_customer(): if request.json and 'customer' in request.json and 'match' in request.json: customer = request.json["customer"] match = request.json["match"] try: cid = db.create_customer(customer, match) except Exception as e: return jsonify(status="error", message=str(e)), 500 else: return jsonify(status="error", message="Must supply user 'customer' and 'match' as parameters"), 400 if cid: return jsonify(status="ok", id=cid), 201, {'Location': absolute_url('/customer/' + cid)} else: return jsonify(status="error", message="Customer lookup for this match already exists"), 409
def create_customer(): if request.json and 'customer' in request.json and 'match' in request.json: customer = request.json["customer"] match = request.json["match"] try: cid = db.create_customer(customer, match) except Exception as e: return jsonify(status="error", message=str(e)), 500 else: return jsonify(status="error", message="must supply user 'customer' and 'match' as parameters"), 400 if cid: return jsonify(status="ok", id=cid), 201, {'Location': '%s/%s' % (request.base_url, cid)} else: return jsonify(status="error", message="Customer lookup for this match already exists"), 409
def create(self) -> 'Customer': return Customer.from_db(db.create_customer(self))