This commit is contained in:
Tony Rewin 2021-11-27 09:15:02 +03:00
parent b489760617
commit aecdcb09e6
3 changed files with 11 additions and 1 deletions

View File

@ -4,7 +4,7 @@ from resolvers.zine import create_shout, get_shout_by_slug, top_month, top_overa
recent_shouts, top_authors, top_viewed recent_shouts, top_authors, top_viewed
from resolvers.profile import get_user_by_slug, get_current_user, authors_by_slugs from resolvers.profile import get_user_by_slug, get_current_user, authors_by_slugs
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, topics_all
from resolvers.comments import create_comment from resolvers.comments import create_comment
from resolvers.community import create_community, delete_community, get_community, get_communities from resolvers.community import create_community, delete_community, get_community, get_communities
@ -27,6 +27,7 @@ __all__ = [
"top_month", "top_month",
"top_overall", "top_overall",
"top_viewed", "top_viewed",
"topics_all",
"topics_by_slugs", "topics_by_slugs",
"topics_by_community", "topics_by_community",
"topics_by_author", "topics_by_author",

View File

@ -5,6 +5,14 @@ from resolvers.zine import ShoutSubscriptions
from auth.authenticate import login_required from auth.authenticate import login_required
import asyncio import asyncio
@query.field("topicsAll")
async def topics_ball(_, info):
topics = []
with local_session() as session:
topics = session.query(Topic)
return topics
@query.field("topicsBySlugs") @query.field("topicsBySlugs")
async def topics_by_slugs(_, info, slugs): async def topics_by_slugs(_, info, slugs):
topics = [] topics = []

View File

@ -143,6 +143,7 @@ type Query {
topAuthors(limit: Int): [User]! topAuthors(limit: Int): [User]!
# topics # topics
topicsAll: [Topic]!
topicsBySlugs(slugs: [String]!): [Topic]! topicsBySlugs(slugs: [String]!): [Topic]!
topicsByCommunity(community: String!): [Topic]! topicsByCommunity(community: String!): [Topic]!
topicsByAuthor(author: String!): [Topic]! topicsByAuthor(author: String!): [Topic]!