diff --git a/orm/__init__.py b/orm/__init__.py index a18511a9..d813e7e9 100644 --- a/orm/__init__.py +++ b/orm/__init__.py @@ -9,7 +9,7 @@ from orm.shout import Shout, ShoutAuthor, ShoutTopic, ShoutRating, ShoutViewByDa from orm.base import Base, engine, local_session from orm.comment import Comment, CommentRating -__all__ = ["User", "Role", "Operation", "Permission", "Message", "Shout", "Topic", "TopicSubscription", "Notification", "ShoutRating", "Comment", "CommentRating", "UserRating"] +__all__ = ["User", "Role", "Community", "Operation", "Permission", "Message", "Shout", "Topic", "TopicSubscription", "Notification", "ShoutRating", "Comment", "CommentRating", "UserRating"] Base.metadata.create_all(engine) Operation.init_table() diff --git a/resolvers/__init__.py b/resolvers/__init__.py index 86721717..d64ba328 100644 --- a/resolvers/__init__.py +++ b/resolvers/__init__.py @@ -6,6 +6,7 @@ from resolvers.profile import get_user_by_slug, get_current_user from resolvers.topics import topic_subscribe, topic_unsubscribe, topics_by_author, \ topics_by_community, topics_by_slugs from resolvers.comments import create_comment +from resolvers.community import create_community, delete_community, get_community, get_communities __all__ = [ "login", @@ -30,5 +31,9 @@ __all__ = [ "topics_by_community", "topics_by_author", "topic_subscribe", - "topic_unsubscribe" + "topic_unsubscribe", + "create_community", + "delete_community", + "get_community", + "get_communities" ] diff --git a/resolvers/community.py b/resolvers/community.py index e740893e..891c1099 100644 --- a/resolvers/community.py +++ b/resolvers/community.py @@ -64,10 +64,7 @@ async def get_community(_, info, slug): return { community } @query.field("getCommunities") -async def get_community(_, info, slugs): +async def get_communities(_, info): with local_session() as session: - communities = session.query(Community).filter(Community.slug in slugs) - if not community: - return {"error": "invalid community id"} - - return { communities } \ No newline at end of file + communities = session.query(Community) + return { communities } \ No newline at end of file