From aecdcb09e65f525f77ee81e51132a402f289b491 Mon Sep 17 00:00:00 2001 From: Tony Rewin Date: Sat, 27 Nov 2021 09:15:02 +0300 Subject: [PATCH] topicall --- resolvers/__init__.py | 3 ++- resolvers/topics.py | 8 ++++++++ schema.graphql | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/resolvers/__init__.py b/resolvers/__init__.py index c1422e21..489bc7ad 100644 --- a/resolvers/__init__.py +++ b/resolvers/__init__.py @@ -4,7 +4,7 @@ from resolvers.zine import create_shout, get_shout_by_slug, top_month, top_overa recent_shouts, top_authors, top_viewed 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, \ - topics_by_community, topics_by_slugs + topics_by_community, topics_by_slugs, topics_all from resolvers.comments import create_comment from resolvers.community import create_community, delete_community, get_community, get_communities @@ -27,6 +27,7 @@ __all__ = [ "top_month", "top_overall", "top_viewed", + "topics_all", "topics_by_slugs", "topics_by_community", "topics_by_author", diff --git a/resolvers/topics.py b/resolvers/topics.py index 36627f4f..750b3852 100644 --- a/resolvers/topics.py +++ b/resolvers/topics.py @@ -5,6 +5,14 @@ from resolvers.zine import ShoutSubscriptions from auth.authenticate import login_required 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") async def topics_by_slugs(_, info, slugs): topics = [] diff --git a/schema.graphql b/schema.graphql index d4060f09..bd373bb0 100644 --- a/schema.graphql +++ b/schema.graphql @@ -143,6 +143,7 @@ type Query { topAuthors(limit: Int): [User]! # topics + topicsAll: [Topic]! topicsBySlugs(slugs: [String]!): [Topic]! topicsByCommunity(community: String!): [Topic]! topicsByAuthor(author: String!): [Topic]!