def submit_disablefaceunlock(booking_id): g.api_request_json = {'userface_status': False} res = BookingApi.patch_booking(booking_id) if "OK" not in res.status: flash("{}".format(res.get_json()['error']), 'danger') else: flash("face unlock disable", "success")
def submit_return(booking_id): # the state of the car True. # set booking active false, add end time to booking, lock car # set car locked by deactivating booking current_date = datetime.now() g.api_request_json = { 'active': False, 'end_time': str(current_date), } res = BookingApi.patch_booking(booking_id) if "OK" in res.status: flash("Booking Complete", "primary") else: flash("{}".format(res.get_json()['error']), 'danger')
def add_google_calendar_id(): """ Add's the google calender_id to the bookings table in the database through the BookingsApi json_data variable: contains the Jsonified data of the request being sent. booking_id and calender_id: consist of the id's from the jsonified data Returns a success response if valid, else returns a error 400 resonse. """ try: json_data = request.get_json() booking_id = json_data['booking_id'] calendar_id = json_data['calendar_event_id'] g.api_request_json = {'calendar_id': calendar_id} res = BookingApi.patch_booking(booking_id) if "OK" in res.status: return make_response("success", 200) return make_response("failed", 400) except BaseException as e: return make_response("error {}".format(e), 400)