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
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
def bookmarks(user=None): _bookmarks = Bookmark.objects(user=user).all() return jsonify(bookmarks=[bookmark.to_dict() for bookmark in _bookmarks]), 200