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 pathlib import Path
|
||||||
from sqlalchemy import select, func, desc, and_
|
from sqlalchemy import select, func, desc, and_
|
||||||
from sqlalchemy.orm import selectinload
|
from sqlalchemy.orm import selectinload
|
||||||
|
import pprint
|
||||||
|
|
||||||
|
|
||||||
class GitTask:
|
class GitTask:
|
||||||
|
|
||||||
|
@ -350,9 +352,10 @@ async def view_shout(_, info, shout_id):
|
||||||
|
|
||||||
@query.field("getShoutBySlug")
|
@query.field("getShoutBySlug")
|
||||||
async def get_shout_by_slug(_, info, slug):
|
async def get_shout_by_slug(_, info, slug):
|
||||||
slug_fields = [node.name.value for node in info.field_nodes[0].selection_set.selections]
|
all_fields = [node.name.value for node in info.field_nodes[0].selection_set.selections]
|
||||||
slug_fields = set(["authors", "comments", "topics"]).intersection(slug_fields)
|
pprint(all_fields)
|
||||||
select_options = [selectinload(getattr(Shout, field)) for field in slug_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:
|
with local_session() as session:
|
||||||
shout = session.query(Shout).\
|
shout = session.query(Shout).\
|
||||||
|
|
|
@ -247,7 +247,7 @@ type Message {
|
||||||
|
|
||||||
type Comment {
|
type Comment {
|
||||||
id: Int!
|
id: Int!
|
||||||
author: Int!
|
author: User!
|
||||||
body: String!
|
body: String!
|
||||||
replyTo: Int
|
replyTo: Int
|
||||||
createdAt: DateTime!
|
createdAt: DateTime!
|
||||||
|
|
Loading…
Reference in New Issue
Block a user