minor fixes
This commit is contained in:
parent
d765eaf390
commit
67713c1bf6
|
@ -9,7 +9,7 @@ from orm.shout import Shout, ShoutAuthor, ShoutTopic, ShoutRating, ShoutViewByDa
|
||||||
from orm.base import Base, engine, local_session
|
from orm.base import Base, engine, local_session
|
||||||
from orm.comment import Comment, CommentRating
|
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)
|
Base.metadata.create_all(engine)
|
||||||
Operation.init_table()
|
Operation.init_table()
|
||||||
|
|
|
@ -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, \
|
from resolvers.topics import topic_subscribe, topic_unsubscribe, topics_by_author, \
|
||||||
topics_by_community, topics_by_slugs
|
topics_by_community, topics_by_slugs
|
||||||
from resolvers.comments import create_comment
|
from resolvers.comments import create_comment
|
||||||
|
from resolvers.community import create_community, delete_community, get_community, get_communities
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"login",
|
"login",
|
||||||
|
@ -30,5 +31,9 @@ __all__ = [
|
||||||
"topics_by_community",
|
"topics_by_community",
|
||||||
"topics_by_author",
|
"topics_by_author",
|
||||||
"topic_subscribe",
|
"topic_subscribe",
|
||||||
"topic_unsubscribe"
|
"topic_unsubscribe",
|
||||||
|
"create_community",
|
||||||
|
"delete_community",
|
||||||
|
"get_community",
|
||||||
|
"get_communities"
|
||||||
]
|
]
|
||||||
|
|
|
@ -64,10 +64,7 @@ async def get_community(_, info, slug):
|
||||||
return { community }
|
return { community }
|
||||||
|
|
||||||
@query.field("getCommunities")
|
@query.field("getCommunities")
|
||||||
async def get_community(_, info, slugs):
|
async def get_communities(_, info):
|
||||||
with local_session() as session:
|
with local_session() as session:
|
||||||
communities = session.query(Community).filter(Community.slug in slugs)
|
communities = session.query(Community)
|
||||||
if not community:
|
|
||||||
return {"error": "invalid community id"}
|
|
||||||
|
|
||||||
return { communities }
|
return { communities }
|
Loading…
Reference in New Issue
Block a user