def index(): vm = IndexViewModel() if not vm.user_id: return flask.redirect("account/login") searches = search_services.find_all_searches_for_user(vm.user_id) if searches == []: return vm.to_dict() for search in searches: vm.search_list.append(search_services.convert_to_dict(search)) return vm.to_dict()
def index(): vm = IndexViewModel() if not vm.user: return flask.redirect('/account/login') test_packages = package_service.get_latest_packages() return { 'gis': test_packages, 'user_id': cookie_auth.get_user_id_via_auth_cookie(flask.request), }
def load_user_preferences(): vm = IndexViewModel() if not vm.user_id: return flask.redirect("account/login") preferences = user_service.get_user_preferences(vm.user_id) if preferences == {}: return jsonify("status: no preferences") return jsonify(preferences)
def toggle_search_status(): vm = IndexViewModel() if not vm.user_id: return flask.redirect("account/login") request = request_dict.data_create("") success = search_services.toggle_search_status(request["id"], request["is_active"]) if not success: return jsonify({"status": "could not find search"}) return jsonify({"status": "success"})
def toggle_setting_status(): vm = IndexViewModel() if not vm.user_id: return flask.redirect("account/login") request = request_dict.data_create("") success = user_service.update_setting(vm.user, request["setting"], request["is_checked"]) if not success: return jsonify({"status": "could not update setting"}) return jsonify({"status": "success"})
def load_search_list(): vm = IndexViewModel() if not vm.user_id: return flask.redirect("account/login") searches = search_services.find_all_searches_for_user(vm.user_id) if searches == []: return jsonify({"searchList": None}) search_list = [] for search in searches: search_list.append(search_services.convert_to_dict(search)) return jsonify({"searchList": search_list})
def index(): vm = IndexViewModel() if not vm.user: return flask.redirect('/account/login') return vm.to_dict()
def confirmation(): vm = IndexViewModel() return vm.to_dict()