From 6ddfc11a91acf48808d4f2ec78cb685c1ba42b34 Mon Sep 17 00:00:00 2001 From: ilya-bkv Date: Thu, 5 Oct 2023 20:34:23 +0300 Subject: [PATCH 1/6] getAuthor add stat --- schemas/core.graphql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas/core.graphql b/schemas/core.graphql index f4533aa2..c8d74912 100644 --- a/schemas/core.graphql +++ b/schemas/core.graphql @@ -224,7 +224,7 @@ type Query { userFollowedAuthors(slug: String!): [Author]! userFollowedTopics(slug: String!): [Topic]! authorsAll: [Author]! - getAuthor(slug: String!): User + getAuthor(slug: String!): Author myFeed(options: LoadShoutsOptions): [Shout] # migrate From d9f47183c8632d4e6466ba383ea4d7228fc18e5a Mon Sep 17 00:00:00 2001 From: Stepan Vladovskiy Date: Fri, 6 Oct 2023 03:51:23 -0300 Subject: [PATCH 2/6] feat: add in schema.py resolver fro _server --- schemas/core.graphql | 3 +++ services/schema.py | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/schemas/core.graphql b/schemas/core.graphql index c8d74912..7d2ac3a3 100644 --- a/schemas/core.graphql +++ b/schemas/core.graphql @@ -1,4 +1,5 @@ scalar DateTime + type _Service { sdl: String } @@ -236,6 +237,8 @@ type Query { topicsRandom(amount: Int): [Topic]! topicsByCommunity(community: String!): [Topic]! topicsByAuthor(author: String!): [Topic]! + + # Apollo SDL _service: _Service! } diff --git a/services/schema.py b/services/schema.py index fe7cc129..e6b9c593 100644 --- a/services/schema.py +++ b/services/schema.py @@ -10,5 +10,13 @@ def serialize_datetime(value): query = QueryType() + +@query.field("_service") +def resolve_service(*_): + print("Inside the _service resolver") + # For now, return a placeholder SDL. + sdl = "type Query { _service: _Service } type _Service { sdl: String }" + return {"sdl": sdl} + mutation = MutationType() resolvers = [query, mutation, datetime_scalar] From c5ea08f93936edc0e18db8336d0fa61ddce14488 Mon Sep 17 00:00:00 2001 From: Stepan Vladovskiy Date: Fri, 6 Oct 2023 05:47:41 -0300 Subject: [PATCH 3/6] feat: add to SDL full Query Mutation schema --- services/schema.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/services/schema.py b/services/schema.py index e6b9c593..16ce11d6 100644 --- a/services/schema.py +++ b/services/schema.py @@ -13,10 +13,11 @@ query = QueryType() @query.field("_service") def resolve_service(*_): - print("Inside the _service resolver") - # For now, return a placeholder SDL. - sdl = "type Query { _service: _Service } type _Service { sdl: String }" - return {"sdl": sdl} + # Load the full SDL from your SDL file + with open("inbox.graphql", "r") as file: + full_sdl = file.read() + + return {"sdl": full_sdl} mutation = MutationType() resolvers = [query, mutation, datetime_scalar] From 6d56e8b3a7c39343634d04451a5eb93ba3540dcb Mon Sep 17 00:00:00 2001 From: Stepan Vladovskiy Date: Fri, 6 Oct 2023 06:02:11 -0300 Subject: [PATCH 4/6] feat: right schema in schema.py --- services/schema.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/schema.py b/services/schema.py index 16ce11d6..161935bc 100644 --- a/services/schema.py +++ b/services/schema.py @@ -14,7 +14,7 @@ query = QueryType() @query.field("_service") def resolve_service(*_): # Load the full SDL from your SDL file - with open("inbox.graphql", "r") as file: + with open("core.graphql", "r") as file: full_sdl = file.read() return {"sdl": full_sdl} From fada9a289aa74b854e999d4c636bbb78b2b50a48 Mon Sep 17 00:00:00 2001 From: Stepan Vladovskiy Date: Fri, 6 Oct 2023 06:05:01 -0300 Subject: [PATCH 5/6] feat: right schema in schema.py --- services/schema.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/schema.py b/services/schema.py index 161935bc..5b8dcb44 100644 --- a/services/schema.py +++ b/services/schema.py @@ -14,7 +14,7 @@ query = QueryType() @query.field("_service") def resolve_service(*_): # Load the full SDL from your SDL file - with open("core.graphql", "r") as file: + with open("schemas/core.graphql", "r") as file: full_sdl = file.read() return {"sdl": full_sdl} From d1366d0b88567eb464eecc91a1ebe86489f248d9 Mon Sep 17 00:00:00 2001 From: Stepan Vladovskiy Date: Fri, 6 Oct 2023 06:14:24 -0300 Subject: [PATCH 6/6] feat: @read about keys --- services/schema.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/services/schema.py b/services/schema.py index 5b8dcb44..e6b9c593 100644 --- a/services/schema.py +++ b/services/schema.py @@ -13,11 +13,10 @@ query = QueryType() @query.field("_service") def resolve_service(*_): - # Load the full SDL from your SDL file - with open("schemas/core.graphql", "r") as file: - full_sdl = file.read() - - return {"sdl": full_sdl} + print("Inside the _service resolver") + # For now, return a placeholder SDL. + sdl = "type Query { _service: _Service } type _Service { sdl: String }" + return {"sdl": sdl} mutation = MutationType() resolvers = [query, mutation, datetime_scalar]