wip-author-caption
This commit is contained in:
parent
360373e84a
commit
72c9bf9bb7
|
@ -51,9 +51,10 @@ async def view_shout(_, info, slug):
|
||||||
@query.field("getShoutBySlug")
|
@query.field("getShoutBySlug")
|
||||||
async def get_shout_by_slug(_, info, slug):
|
async def get_shout_by_slug(_, info, slug):
|
||||||
all_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]
|
||||||
selected_fields = set(["authors", "topics", "reactions"]).intersection(all_fields)
|
selected_fields = set(["authors", "topics", "reactions", "captions"]).intersection(all_fields)
|
||||||
select_options = [selectinload(getattr(Shout, field)) for field in selected_fields]
|
select_options = [selectinload(getattr(Shout, field)) for field in selected_fields]
|
||||||
|
# select_options.append(selectinload(ShoutTopic.caption).label("captions"))
|
||||||
|
# TODO: append captions anyhow
|
||||||
with local_session() as session:
|
with local_session() as session:
|
||||||
shout = session.query(Shout).\
|
shout = session.query(Shout).\
|
||||||
options(select_options).\
|
options(select_options).\
|
||||||
|
|
|
@ -324,7 +324,7 @@ type Author {
|
||||||
slug: String!
|
slug: String!
|
||||||
name: String!
|
name: String!
|
||||||
userpic: String
|
userpic: String
|
||||||
caption: String
|
caption: String # only for full shout
|
||||||
}
|
}
|
||||||
|
|
||||||
# is publication
|
# is publication
|
||||||
|
|
Loading…
Reference in New Issue
Block a user