From ee53fe75083e279107025f7206f014c2b7d7bbb7 Mon Sep 17 00:00:00 2001 From: Untone Date: Sat, 30 Oct 2021 19:58:15 +0300 Subject: [PATCH] needed queries --- resolvers/zine.py | 6 ++++++ schema.graphql | 12 ++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/resolvers/zine.py b/resolvers/zine.py index 0e9fa89e..c7e1fbaf 100644 --- a/resolvers/zine.py +++ b/resolvers/zine.py @@ -93,6 +93,12 @@ class TopShouts: async with TopShouts.lock: TopShouts.shouts_by_rating = shouts + @staticmethod + async def prepare_shouts_by_time(): + month_ago = datetime.now() - timedelta(days = 30) + with local_session() as session: + # TODO: select recent shouts + @staticmethod async def prepare_favorites_shouts(): with local_session() as session: diff --git a/schema.graphql b/schema.graphql index abb521cd..74f4d49e 100644 --- a/schema.graphql +++ b/schema.graphql @@ -98,12 +98,12 @@ type Query { getMessages(count: Int = 100, page: Int = 1): [Message!]! # shouts - getShoutBySlug(slug: String!): Shout! # NOTE: with .comments: Comments[] - # getShoutRating(shout: Int): Int! - # shoutsByAuthor(author: Int): [Shout]! - # shoutsByReplyTo(shout: Int): [Shout]! - # shoutsByTags(tags: [String]): [Shout]! - # shoutsByTime(time: DateTime): [Shout]! + getShoutBySlug(slug: String!): Shout! + # NOTE: with .comments: Comments[] + recentShouts(limit: Int): [Shout]! + shoutsByTopic(topic: String!, limit: Int!): [Shout]! + shoutsByAuthor(author: String!, limit: Int!): [Shout]! + shoutsByCommunity(community: String!, limit: Int!): [Shout]! # mainpage topShoutsByView(limit: Int): [Shout]!