reviewed resolvers

This commit is contained in:
2022-09-22 13:31:44 +03:00
parent c292d7da55
commit 64914028fb
8 changed files with 77 additions and 68 deletions

View File

@@ -56,7 +56,11 @@ async def topics_by_author(_, _info, author):
@mutation.field("createTopic")
@login_required
async def create_topic(_, _info, inp):
new_topic = Topic.create(**inp)
with local_session() as session:
# TODO: check user permissions to create topic for exact community
new_topic = Topic.create(**inp)
session.add(new_topic)
session.commit()
await TopicStorage.update_topic(new_topic)
return {"topic": new_topic}