def delete_group(): payload = request.get_json(force=True) if payload is None: raise CalculatedError(403, "Malformed request") if 'id' in payload: entry = SavedGroup.delete_entry(payload['id']) elif 'ids' in payload: entry = [SavedGroup.delete_entry(id_) for id_ in payload['ids']] else: raise CalculatedError(403, "Malformed request") return jsonify({"uuid": entry})
def rename_group(): payload = request.get_json(force=True) if payload is None: raise CalculatedError(403, "Malformed request") if 'id' in payload: entry = SavedGroup.rename_entry(payload['id'], payload['name']) else: raise CalculatedError(403, "Malformed request") return jsonify({"uuid": entry})
def create_group(): payload = request.get_json(force=True) if payload is None: raise CalculatedError(403, "Malformed request") name = payload['name'] if 'name' in payload else None if 'parent' in payload: parent = payload['parent'] if 'game' in payload: entry = SavedGroup.add_game(parent, payload['game'], name) elif 'games' in payload: entry = [ SavedGroup.add_game(parent, game, name) for game in payload['games'] ] else: entry = SavedGroup.add_subgroup(parent, name) else: entry = SavedGroup.create(name) return jsonify({"uuid": entry})
def get_group_stats_team(query_params): return better_jsonify(SavedGroup.get_stats(query_params['id'], team=True))
def get_group_stats_player(query_params): return better_jsonify(SavedGroup.get_stats(query_params['id']))
def get_group(query_params): return better_jsonify( SavedGroup.get_info(query_params['id'] if 'id' in query_params else None))