Beispiel #1
0
def stories_update(id):
    story = get_story(id)
    data = dict(request.json)
    data.pop("_id", None)
    data.pop("cards", None)
    story["updated_at"] = datetime.utcnow()
    stories.update({"_id": story["_id"]}, {"$set": data})
    extract.delay(id)
    return jsonify(get_story(id))
Beispiel #2
0
def cards_index(story_id):
    story = get_story(story_id)
    cur = cards.find({"stories": story["_id"]})
    cur = cur.sort("offset", ASCENDING)
    cards_ = []
    for card in cur:
        card["evidences"] = get_evidences(card)
        cards_.append(card)
    return jsonify(cards_)
Beispiel #3
0
def cards_index(story_id):
    story = get_story(story_id)
    cur = cards.find({'stories': story['_id']})
    cur = cur.sort('offset', ASCENDING)
    cards_ = []
    for card in cur:
        card['evidences'] = get_evidences(card)
        cards_.append(card)
    return jsonify(cards_)
Beispiel #4
0
def stories_update(id):
    story = get_story(id)
    data = dict(request.json)
    data.pop('_id', None)
    data.pop('cards', None)
    story['updated_at'] = datetime.utcnow()
    stories.update({'_id': story['_id']}, {'$set': data})
    extract.delay(id)
    return jsonify(get_story(id))
Beispiel #5
0
def cards_get(story_id, card_id):
    story = get_story(story_id)
    card = get_card(story, card_id)
    card["evidences"] = get_evidences(card)
    return jsonify(card)
Beispiel #6
0
def stories_get(id):
    return jsonify(get_story(id))
Beispiel #7
0
def stories_index():
    cur = stories.find({"$where": "this.title.length > 1"})
    return jsonify(cur)
Beispiel #8
0
def reset():
    reset_db()
    return jsonify({"status": "ok", "message": "Nuked all the things"})
Beispiel #9
0
def cards_get(story_id, card_id):
    story = get_story(story_id)
    card = get_card(story, card_id)
    card['evidences'] = get_evidences(card)
    return jsonify(card)
Beispiel #10
0
def stories_get(id):
    return jsonify(get_story(id))
Beispiel #11
0
def stories_index():
    cur = stories.find({'$where': 'this.title.length > 1'})
    return jsonify(cur)
Beispiel #12
0
def reset():
    reset_db()
    return jsonify({'status': 'ok', 'message': 'Nuked all the things'})