diff --git a/pyproject.toml b/pyproject.toml index 3df3fcf1..bc5726b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,11 +22,12 @@ opensearch-py = "^2.6.0" httpx = "^0.27.0" dogpile-cache = "^1.3.1" colorlog = "^6.8.2" +fakeredis = "^2.25.1" + [tool.poetry.group.dev.dependencies] ruff = "^0.4.7" isort = "^5.13.2" -fakeredis = "^2.25.1" [build-system] requires = ["poetry-core>=1.0.0"] diff --git a/resolvers/reaction.py b/resolvers/reaction.py index 42c5c997..4072a528 100644 --- a/resolvers/reaction.py +++ b/resolvers/reaction.py @@ -329,12 +329,11 @@ async def update_reaction(_, info, reaction): try: reaction_query = query_reactions().filter(Reaction.id == rid) reaction_query = add_reaction_stat_columns(reaction_query) - reaction_query = reaction_query.group_by(Reaction.id) + reaction_query = reaction_query.group_by(Reaction.id, Author.id, Shout.id) result = session.execute(reaction_query).unique().first() if result: - r, commented_stat, rating_stat = result - author = session.query(Author).filter(Author.user == user_id).first() + r, author, shout, commented_stat, rating_stat = result if not r or not author: return {"error": "Invalid reaction ID or unauthorized"} diff --git a/services/search.py b/services/search.py index 8e195d19..d19731fd 100644 --- a/services/search.py +++ b/services/search.py @@ -141,9 +141,10 @@ class SearchService: if isinstance(result, dict): mapping = result.get(self.index_name, {}).get("mappings") logger.info(f"Найдена структура индексации: {mapping['properties'].keys()}") - if mapping and mapping["properties"].keys() != expected_mapping["properties"].keys(): + expected_keys = expected_mapping["properties"].keys() + if mapping and mapping["properties"].keys() != expected_keys: logger.info(f"Ожидаемая структура индексации: {expected_mapping}") - logger.warn("[!!!] Требуется переиндексация всех данных") + logger.warning("[!!!] Требуется переиндексация всех данных") self.delete_index() self.client = None else: