This commit is contained in:
@@ -369,7 +369,7 @@ async def admin_merge_topics(_: None, _info: GraphQLResolveInfo, merge_input: di
|
||||
# Обновляем parent_ids дочерних топиков
|
||||
for source_topic in source_topics:
|
||||
# Находим всех детей исходной темы
|
||||
child_topics = session.query(Topic).where(Topic.parent_ids.contains(int(source_topic.id))).all() # type: ignore[arg-type]
|
||||
child_topics = session.query(Topic).where(Topic.parent_ids.contains(int(source_topic.id))).all()
|
||||
|
||||
for child_topic in child_topics:
|
||||
current_parent_ids = list(child_topic.parent_ids or [])
|
||||
@@ -747,10 +747,10 @@ async def admin_update_reaction(_: None, _info: GraphQLResolveInfo, reaction: di
|
||||
if "body" in reaction:
|
||||
db_reaction.body = reaction["body"]
|
||||
if "deleted_at" in reaction:
|
||||
db_reaction.deleted_at = int(time.time()) # type: ignore[assignment]
|
||||
db_reaction.deleted_at = int(time.time())
|
||||
|
||||
# Обновляем время изменения
|
||||
db_reaction.updated_at = int(time.time()) # type: ignore[assignment]
|
||||
db_reaction.updated_at = int(time.time())
|
||||
|
||||
session.commit()
|
||||
|
||||
@@ -774,7 +774,7 @@ async def admin_delete_reaction(_: None, _info: GraphQLResolveInfo, reaction_id:
|
||||
return {"success": False, "error": "Реакция не найдена"}
|
||||
|
||||
# Устанавливаем время удаления
|
||||
db_reaction.deleted_at = int(time.time()) # type: ignore[assignment]
|
||||
db_reaction.deleted_at = int(time.time())
|
||||
|
||||
session.commit()
|
||||
|
||||
|
||||
@@ -987,11 +987,11 @@ def create_author(**kwargs) -> Author:
|
||||
"""
|
||||
author = Author()
|
||||
# Use setattr to avoid MyPy complaints about Column assignment
|
||||
author.id = kwargs.get("user_id") # type: ignore[assignment] # Связь с user_id из системы авторизации # type: ignore[assignment]
|
||||
author.slug = kwargs.get("slug") # type: ignore[assignment] # Идентификатор из системы авторизации # type: ignore[assignment]
|
||||
author.created_at = int(time.time()) # type: ignore[assignment]
|
||||
author.updated_at = int(time.time()) # type: ignore[assignment]
|
||||
author.name = kwargs.get("name") or kwargs.get("slug") # type: ignore[assignment] # если не указано # type: ignore[assignment]
|
||||
author.id = kwargs.get("user_id") # Связь с user_id из системы авторизации
|
||||
author.slug = kwargs.get("slug") # Идентификатор из системы авторизации
|
||||
author.created_at = int(time.time())
|
||||
author.updated_at = int(time.time())
|
||||
author.name = kwargs.get("name") or kwargs.get("slug") # если не указано
|
||||
|
||||
with local_session() as session:
|
||||
session.add(author)
|
||||
|
||||
@@ -259,8 +259,7 @@ async def set_featured(session: Session, shout_id: int) -> None:
|
||||
s = session.query(Shout).where(Shout.id == shout_id).first()
|
||||
if s:
|
||||
current_time = int(time.time())
|
||||
# Use setattr to avoid MyPy complaints about Column assignment
|
||||
s.featured_at = current_time # type: ignore[assignment]
|
||||
s.update({"featured_at": current_time})
|
||||
session.commit()
|
||||
author = session.query(Author).where(Author.id == s.created_by).first()
|
||||
if author:
|
||||
|
||||
@@ -77,8 +77,8 @@ def query_with_stat(info: GraphQLResolveInfo, force_topics: bool = False) -> Sel
|
||||
"""
|
||||
q = select(Shout).where(
|
||||
and_(
|
||||
Shout.published_at.is_not(None), # type: ignore[union-attr]
|
||||
Shout.deleted_at.is_(None), # type: ignore[union-attr]
|
||||
Shout.published_at.is_not(None),
|
||||
Shout.deleted_at.is_(None),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user