def appointment_service(appointment): db = get_db() if request.method == 'HEAD': return Response(status=501) if request.method == 'GET': body = models.get_scheduled_service(db, appointment) return jsonify(body)
def client_history(client): db = get_db() if request.method == 'HEAD': return Response(status=501) if request.method == 'GET': body = models.get_client_history(db, client) return jsonify(body)
def vehicle_history(vehicle): db = get_db() if request.method == 'HEAD': return Response(status=501) if request.method == 'GET': body = models.get_vehicle_history(db, vehicle) return jsonify(body)
def client(client): db = get_db() if request.method == 'HEAD': return Response(status=501) if request.method == 'GET': body = models.get_client(db, client) return jsonify(body) if request.method == 'DELETE': body = models.delete_client(db, client) return Response(status=200)
def service(service): db = get_db() if request.method == 'HEAD': return Response(status=501) if request.method == 'GET': body = models.get_service(db, service) return jsonify(body) if request.method == 'DELETE': body = models.delete_service(db, service) return Response(status=200)
def vehicle(vehicle): db = get_db() if request.method == 'HEAD': return Response(status=501) if request.method == 'GET': body = models.get_vehicle(db, vehicle) return jsonify(body) if request.method == 'DELETE': body = models.delete_vehicle(db, vehicle) return Response(status=200)
def service_list(): db = get_db() if request.method == 'HEAD': return Response(status=501) if request.method == 'GET': body = models.get_service_list(db) return jsonify(body) if request.method == 'POST': req_body = request.get_json() resp_body = models.create_service(db, req_body['service_id'], req_body['service_type'], req_body['service_price']) return jsonify(resp_body)
def client_list(): db = get_db() if request.method == 'HEAD': return Response(status=501) if request.method == 'GET': body = models.get_client_list(db) return jsonify(body) if request.method == 'POST': req_body = request.get_json() resp_body = models.create_client(db, req_body['client_id'], req_body['client_fname'], req_body['client_lname'], req_body['client_phone']) return jsonify(resp_body)
def vehicle_list(): db = get_db() if request.method == 'HEAD': return Response(status=501) if request.method == 'GET': body = models.get_vehicle_list(db) return jsonify(body) if request.method == 'POST': req_body = request.get_json() resp_body = models.create_vehicle(db, req_body['client_id'], req_body['vehicle_id'], req_body['vehicle_make'], req_body['vehicle_milage'], req_body['vehicle_model'], req_body['vehicle_year']) return jsonify(resp_body)
def appointment_list(): db = get_db() if request.method == 'HEAD': return Response(status=501) if request.method == 'GET': body = models.get_appointment_list(db) return jsonify(body) if request.method == 'POST': req_body = request.get_json() resp_body = models.create_appointment(db, req_body['appointment_date'], req_body['appointment_id'], req_body['appointment_time'], req_body['vehicle_id'], req_body['app_service_id'], req_body['service_id']) return jsonify(resp_body)