Exemple #1
0
def post(request, meta):
    db = DynamoDb()

    heatmapArr = []
    existingHeatmaps = db.get_key("heatmaps")
    heatmapArr = existingHeatmaps['Items'][0]['value']

    # TODO: Remove [0] if testing fails
    heatmapArr.append({"id": meta['id'], "heatmap": meta})
    return db.set("heatmaps", heatmapArr)
Exemple #2
0
def delete(request, id):
    db = DynamoDb()

    existingHeatmaps = db.get_key("heatmaps")
    heatmapArr = existingHeatmaps['Items'][0]['value']
    print heatmapArr

    for heatmap in heatmapArr:
        if heatmap['id'] == id:
            heatmapArr.remove(heatmap)
    print heatmapArr
    return db.set("heatmaps", heatmapArr)
Exemple #3
0
def put(request, id, meta):
    db = DynamoDb()

    existingHeatmaps = db.get_key("heatmaps")
    heatmapArr = existingHeatmaps['Items'][0]['value']

    newHeatmap = {"id": meta['id'], "heatmap": meta}
    heatmapArr = [
        newHeatmap if heatmap['id'] == id else heatmap
        for heatmap in heatmapArr
    ]
    return db.set("heatmaps", heatmapArr)
Exemple #4
0
def post(request, facetid, meta):
    db = DynamoDb()
    return db.set(facetid, meta)