Beispiel #1
0
def activate_date():
    connection = connect.connect_db()
    cursor = connection.cursor()
    data_from_api = flask.request.data.decode()
    values = json.loads(data_from_api)
    day = values["date"].split("T")
    new_day = db.day_plus_one(day[0])
    db.delete_disabled_date(cursor, connection, new_day)
    connection.close()
    return "ok"
Beispiel #2
0
def block_hour():
    connection = connect.connect_db()
    cursor = connection.cursor()
    data_from_api = flask.request.data.decode()
    values = json.loads(data_from_api)
    day = values["date"].split("T")
    new_day = db.day_plus_one(day[0])
    hours = db.block_hour(cursor, connection, new_day, values["hour"])
    connection.close()
    return flask.jsonify(hours)
Beispiel #3
0
def booking():
    connection = connect.connect_db()
    cursor = connection.cursor()
    data_from_api = flask.request.data.decode()  # get the body of the request
    values = json.loads(
        data_from_api)  # convert to jason in order to get the fields
    db.add_new_booking(cursor, connection, values)
    new_day = db.day_plus_one(values["date"].split("T")[0])
    values["day"] = db.findDay(values["date"]) + ": " + new_day
    email.email_handle(
        values)  # email handler sends emails to customer and manager
    values["date"] = db.handle_time(
        cursor, connection, values["date"],
        values["hour"])  # handle time changes the date
    # service = sync.syncalendar_and_service()
    event.create_event_and_insert(values)  # create event in the calendar
    connection.close()
    return 'OK'