upgrade schema, resolvers, panel added

This commit is contained in:
2025-05-16 09:23:48 +03:00
parent 8a60bec73a
commit 2d382be794
80 changed files with 8641 additions and 1100 deletions

View File

@@ -1,4 +1,4 @@
from orm.author import Author
from auth.orm import Author
from orm.community import Community, CommunityFollower
from services.db import local_session
from services.schema import mutation, query
@@ -74,9 +74,9 @@ async def update_community(_, info, community_data):
if slug:
with local_session() as session:
try:
session.query(Community).where(Community.created_by == author_id, Community.slug == slug).update(
community_data
)
session.query(Community).where(
Community.created_by == author_id, Community.slug == slug
).update(community_data)
session.commit()
except Exception as e:
return {"ok": False, "error": str(e)}
@@ -90,7 +90,9 @@ async def delete_community(_, info, slug: str):
author_id = author_dict.get("id")
with local_session() as session:
try:
session.query(Community).where(Community.slug == slug, Community.created_by == author_id).delete()
session.query(Community).where(
Community.slug == slug, Community.created_by == author_id
).delete()
session.commit()
return {"ok": True}
except Exception as e: