Example #1
0
def update_todo(id):
    logger.debug("Run invoked to update data with new id to the database")
    result = request.json
    logger.debug("Data from the body: " + str(result))
    new_result = result["text"]
    logger.debug("Data for updated text from dictionary: " + str(new_result))
    new_data = result["done"]
    logger.debug("Data for true or false from dictonary: " + str(new_data))
    new_information_id = lib.update_todo_by_id(id, new_result, new_data)
    logger.debug("Updated id: " + str(new_information_id))
    return jsonify(id=new_information_id)
Example #2
0
def update_todo(id):
    result = request.json
    # logger.debug("Information from the body: " + str(result))
    text = result["text"]
    logger.debug("Information for updated text from dictionary: " + str(text))
    done = result["done"]
    logger.debug("Information for true or false from dictonary: " + str(done))
    affected = lib.update_todo_by_id(id, text, done)
    logger.debug("affected rows: " + str(affected))
    if affected > 0:
        return jsonify(id=id, desc="Was updated")
    else:
        return jsonify(id=id, desc="Was not updated"), 404
Example #3
0
def update_todo(id):
    result = request.json
    logger.debug("Information from the body: " + str(result))
    print(result)
    new_result = result["text"]
    print(new_result)
    logger.debug("Information for updated text from dictionary: " +
                 str(new_result))
    new_data = result["done"]
    logger.debug("Information for true or false from dictonary: " +
                 str(new_data))
    new_information_id = lib.update_todo_by_id(id, new_result, new_data)
    logger.debug("updated id: " + str(new_information_id))
    print(new_information_id)
    return jsonify(new_information_id=str(new_information_id))
Example #4
0
import lib

lib.init_db()

new_id = lib.insert_todo("elephant")
print(new_id)

all_data = lib.get_all()
print(all_data)

new_id_data = lib.get_todo_by_id(new_id)
print(new_id)

updated = lib.update_todo_by_id(new_id, "monkey", 100)
print(updated)

delete_previousid = lib.delete_todo_by_id(new_id - 1)
print(delete_previousid)
Example #5
0
import lib

new_id = lib.insert_todo("jopa")
print(new_id)

# all_data = lib.get_all()
# print(all_data)

# one = lib.get_todo_by_id(new_id)
# print(one)

updated = lib.update_todo_by_id(new_id, "FFF", 1)
print(updated)

delete_id = lib.delete_todo_by_id(new_id - 1)
print(delete_id)