Example #1
0
def bookmark(user=None):
    bookmark = Bookmark.objects(id=bookmark_id, user=user).first()
    if bookmark:
        if bookmark.updated_at is None:
            bookmark.fetch()
        return jsonify(bookmark=bookmark.to_dict()), 200
    return jsonify(errors=['Not Found']), 404
Example #2
0
def update(user=None, bookmark_id=None):
    bookmark = Bookmark.objects(id=bookmark_id, user=user).first()
    if bookmark and bookmark.fetch():
        if bookmark.save():
            return jsonify(bookmark=bookmark.to_dict())
        return jsonify(bookmark=bookmark.to_dict()), 304
    return jsonify(errors=['Not Found']), 404
Example #3
0
def update(user=None, bookmark_id=None):
    bookmark = Bookmark.objects(id=bookmark_id, user=user).first()
    if bookmark and bookmark.fetch():
        if bookmark.save():
            return jsonify(bookmark=bookmark.to_dict())
        return jsonify(bookmark=bookmark.to_dict()), 304
    return jsonify(errors=['Not Found']), 404
Example #4
0
def bookmark(user=None):
    bookmark = Bookmark.objects(id=bookmark_id, user=user).first()
    if bookmark:
        if bookmark.updated_at is None:
            bookmark.fetch()
        return jsonify(bookmark=bookmark.to_dict()), 200
    return jsonify(errors=['Not Found']), 404
Example #5
0
def bookmarks(user=None):
    _bookmarks = Bookmark.objects(user=user).all()
    return jsonify(bookmarks=[bookmark.to_dict()
                              for bookmark in _bookmarks]), 200
Example #6
0
def bookmarks(user=None):
    _bookmarks = Bookmark.objects(user=user).all()
    return jsonify(bookmarks=[bookmark.to_dict() for bookmark in _bookmarks]), 200