def unarchive(id): result = { } try: database.unarchive_link(id) result = { 'success': True } except Exception as error: result = { 'success': False, 'message': str(error) } return jsonify(result)
def star(id): result = { } try: link = database.get_link_by_id(id) if link.unread: result['moved_from_inbox'] = True result['moved_from_archive'] = False else: result['moved_from_inbox'] = False result['moved_from_archive'] = True database.mark_link_as_starred(id) database.unarchive_link(id) result['success'] = True except Exception as error: result = { 'success': False, 'message': str(error) } return jsonify(result)