Пример #1
0
def load_user_settings(bcode):
    email = db_app_interaction.get_email(bcode)
    email = email[0]

    set_list = db_app_interaction.get_settings(email)
    if not set_list:
        return Response(status=404)

    return jsonify({'settings': prepare_for_json(set_list)})
Пример #2
0
def send_push(bcod, message):
    email = db_app_interaction.get_email(bcod)
    email = email[0]

    try:
        db_app_interaction.insert_notification(email,
                                               time.strftime("%Y-%m-%d"),
                                               time.strftime("%H:%M"), message)
    except Exception, e:
        return Response(status=500)
Пример #3
0
def get_last_position(bcod):
    email = db_app_interaction.get_email(bcod)
    email = email[0]
    position = db_app_interaction.get_position(email)
    if not position:
        abort(404)

    return jsonify({
        'latitude': position['latitude'],
        'longitude': position['longitude']
    })
Пример #4
0
def set_appointment_done():

    client_data = request.get_json(force=True)
    bcod = client_data['bcode']

    code = client_data['code']
    email = db_app_interaction.get_email(bcod)
    email = email[0]

    if client_data is not None:

        try:
            db_app_interaction.set_appointment_done(email, code)
            return Response(status=200)
        except Exception, e:
            return Response(status=500)
Пример #5
0
def load_day_calendar(bcod, date):

    daily = []
    email = db_app_interaction.get_email(bcod)
    email = email[0]
    day = db_app_interaction.get_day_calendar(email, date)
    if not day:
        return Response(status=404)

    for item in day:
        d = prepare_for_json(item)
        daily.append(d)
    #print daily
    for item2 in daily:
        print item2
    #return jsonify({'daily_cal':daily})
    return jsonify(daily)