Example #1
0
def remove():
    """ This method removes an hash map.
    :param _id: MongoDB ObjectId """
    _id = request.args.get("_id", None)
    hash_object = HashTable(_id=_id)

    success = False
    if _id:
        success = hash_object.remove()

    data = {"success": success}
    return jsonify(data)
Example #2
0
def new():
    """ Create a new document within the hash table. """
    language_name = languages_object.get_languages(5)
    params = request.json

    hash_object = HashTable(params=params)
    hash_object.new()

    data = {
        "success": hash_object.success,
        "message": hash_object.message,
        "hash_map": hash_object.hash_map
    }
    return jsonify(data)
Example #3
0
def remove():
    """ This method removes an hash map.
    :param _id: MongoDB ObjectId """
    _id = request.args.get("_id", None)
    hash_object = HashTable(_id=_id)

    success = False
    if _id:
        success = hash_object.remove()

    data = {
        "success": success
    }
    return jsonify(data) 
Example #4
0
def new():
    """ Create a new document within the hash table. """
    language_name = languages_object.get_languages(5)
    params = request.json

    hash_object = HashTable(params=params)
    hash_object.new()

    data = {
        "success": hash_object.success,
        "message": hash_object.message,
        "hash_map": hash_object.hash_map
    }
    return jsonify(data)
Example #5
0
def update():
    """ """
    language_name = languages_object.get_languages(5)
    params = request.json

    success = False
    message = ""
    hash_map = {}

    if "_id" in params:
        hash_object = HashTable(params=params, _id=params["_id"])
        hash_object.update()

        success = hash_object.success
        message = hash_object.message
        hash_map = hash_object.hash_map

    data = {"success": success, "message": message, "hash_map": hash_map}
    return jsonify(data)
Example #6
0
def update():
    """ """
    language_name = languages_object.get_languages(5)
    params = request.json

    success = False
    message = ""
    hash_map = {}

    if "_id" in params:
        hash_object = HashTable(params=params, _id=params["_id"])
        hash_object.update()

        success = hash_object.success
        message = hash_object.message
        hash_map = hash_object.hash_map

    data = {
        "success": success,
        "message": message,
        "hash_map": hash_map
    }
    return jsonify(data)