From 50d2845c235e981f69378fed5a026c3d4cdc34af Mon Sep 17 00:00:00 2001 From: tonyrewin Date: Fri, 17 Jun 2022 16:11:18 +0300 Subject: [PATCH] info contain slugs only --- README.md | 3 ++- resolvers/profile.py | 2 +- schema.graphql | 12 ++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 1abd261b..63b4a925 100644 --- a/README.md +++ b/README.md @@ -32,11 +32,12 @@ nginx -s reload poetry install poetry run python server.py +poetry run python server.py inbox ``` ## Data prepare -Notice: you need db.sqlite3 file in your root folder or you have to migrate some data to see. +Also, you'll need to migrate some data ``` poetry run python migrate.py all diff --git a/resolvers/profile.py b/resolvers/profile.py index 9e7ed6b2..a0bf0c51 100644 --- a/resolvers/profile.py +++ b/resolvers/profile.py @@ -25,7 +25,7 @@ def _get_user_subscribed_topic_slugs(slug): def _get_user_subscribed_authors(slug): with local_session() as session: - authors = session.query(User).\ + authors = session.query(User.slug).\ join(AuthorSubscription, User.slug == AuthorSubscription.author).\ where(AuthorSubscription.subscriber == slug) return authors diff --git a/schema.graphql b/schema.graphql index 225e19c4..a57242f7 100644 --- a/schema.graphql +++ b/schema.graphql @@ -7,10 +7,10 @@ type Result { } type CurrentUserInfo { - totalUnreadMessages : Int - userSubscribedTopics : [String]! - userSubscribedAuthors : [User]! - userSubscribedCommunities : [String]! + totalUnreadMessages: Int + userSubscribedTopics: [String]! + userSubscribedAuthors: [String]! + userSubscribedCommunities: [String]! } type AuthResult { @@ -135,8 +135,8 @@ type Mutation { updateCommunity(community: CommunityInput!): Community! deleteCommunity(id: Int!): Result! - subscribe(subscription : SubscriptionType!, slug: String!): Result! - unsubscribe(subscription : SubscriptionType!, slug: String!): Result! + subscribe(what: SubscriptionType!, slug: String!): Result! + unsubscribe(what: SubscriptionType!, slug: String!): Result! } ################################### Query