0.4.10-a
All checks were successful
Deploy on push / deploy (push) Successful in 44s

This commit is contained in:
2025-02-11 12:00:35 +03:00
parent 25b61c6b29
commit 5d87035885
27 changed files with 299 additions and 536 deletions

View File

@@ -66,11 +66,11 @@ async def get_topic(_, _info, slug: str):
# Мутация для создания новой темы
@mutation.field("create_topic")
@login_required
async def create_topic(_, _info, inp):
async def create_topic(_, _info, topic_input):
with local_session() as session:
# TODO: проверить права пользователя на создание темы для конкретного сообщества
# и разрешение на создание
new_topic = Topic(**inp)
new_topic = Topic(**topic_input)
session.add(new_topic)
session.commit()
@@ -80,14 +80,14 @@ async def create_topic(_, _info, inp):
# Мутация для обновления темы
@mutation.field("update_topic")
@login_required
async def update_topic(_, _info, inp):
slug = inp["slug"]
async def update_topic(_, _info, topic_input):
slug = topic_input["slug"]
with local_session() as session:
topic = session.query(Topic).filter(Topic.slug == slug).first()
if not topic:
return {"error": "topic not found"}
else:
Topic.update(topic, inp)
Topic.update(topic, topic_input)
session.add(topic)
session.commit()