update comment schema and debug resolvers
This commit is contained in:
parent
1a4b7a6f0a
commit
cf020f8f3e
|
@ -14,6 +14,8 @@ from datetime import datetime, timedelta
|
|||
from pathlib import Path
|
||||
from sqlalchemy import select, func, desc, and_
|
||||
from sqlalchemy.orm import selectinload
|
||||
import pprint
|
||||
|
||||
|
||||
class GitTask:
|
||||
|
||||
|
@ -350,9 +352,10 @@ async def view_shout(_, info, shout_id):
|
|||
|
||||
@query.field("getShoutBySlug")
|
||||
async def get_shout_by_slug(_, info, slug):
|
||||
slug_fields = [node.name.value for node in info.field_nodes[0].selection_set.selections]
|
||||
slug_fields = set(["authors", "comments", "topics"]).intersection(slug_fields)
|
||||
select_options = [selectinload(getattr(Shout, field)) for field in slug_fields]
|
||||
all_fields = [node.name.value for node in info.field_nodes[0].selection_set.selections]
|
||||
pprint(all_fields)
|
||||
selected_fields = set(["authors", "comments", "topics"]).intersection(all_fields)
|
||||
select_options = [selectinload(getattr(Shout, field)) for field in selected_fields]
|
||||
|
||||
with local_session() as session:
|
||||
shout = session.query(Shout).\
|
||||
|
|
|
@ -247,7 +247,7 @@ type Message {
|
|||
|
||||
type Comment {
|
||||
id: Int!
|
||||
author: Int!
|
||||
author: User!
|
||||
body: String!
|
||||
replyTo: Int
|
||||
createdAt: DateTime!
|
||||
|
|
Loading…
Reference in New Issue
Block a user