Example #1
0
def update_group(group_id):
    group_dict = get_group_document(group_id)
    if request.headers['Content-Type'] == 'application/json':
        for k in request.json.keys():
            if doc_attribute_can_be_set(k):
                group_dict[k] = request.json[k]
        save_document(group_dict)
        return Response(json.dumps(group_dict), status=200, mimetype='application/json')
Example #2
0
def update_settings():
    settings = get_settings_document()
    if request.headers['Content-Type'] == 'application/json':
        for k in request.json.keys():
            if doc_attribute_can_be_set(k):
                settings[k] = request.json[k]
        save_document(settings)
        return Response(json.dumps(settings), status=200, mimetype='application/json')
Example #3
0
def save_group():
    settings = get_settings_document()
    group_dict = default_group_dict()
    if request.headers['Content-Type'] == 'application/json':
        for k in request.json.keys():
            if doc_attribute_can_be_set(k):
                group_dict[k] = request.json[k]
        save_document(group_dict)
        settings['current_group_id'] = group_dict['_id']
        save_document(settings)
        return Response(json.dumps(group_dict), status=200, mimetype='application/json')