..bump readme

This commit is contained in:
2022-08-09 13:17:31 +03:00
parent d20cd1e521
commit 158cb20717
4 changed files with 12 additions and 19 deletions

View File

@@ -105,20 +105,20 @@ async def delete_reaction(_, info, id):
return {}
@query.field("reactionsByShout")
def get_shout_reactions(_, info, slug)-> List[Reaction]:
def get_shout_reactions(_, info, slug):
#offset = page * size
#end = offset + size
return ReactionsStorage.reactions_by_shout.get(slug, []) #[offset:end]
@query.field("reactionsAll")
def get_all_reactions(_, info, page=1, size=10) -> List[Reaction]:
def get_all_reactions(_, info, page=1, size=10):
offset = page * size
end = offset + size
return ReactionsStorage.reactions[offset:end]
@query.field("reactionsByAuthor")
def get_reactions_by_author(_, info, slug, page=1, size=50) -> List[Reaction]:
def get_reactions_by_author(_, info, slug, page=1, size=50):
offset = page * size
end = offset + size
return ReactionsStorage.reactions_by_author.get(slug, [])[offset:end]

View File

@@ -57,9 +57,10 @@ async def get_shout_by_slug(_, info, slug):
options([
selectinload(Shout.topics),
selectinload(Shout.reactions),
selectinload(Shout.authors)
joinedload(Shout.authors, innerjoin=True),
selectinload(ShoutAuthor.caption)
]).\
join([ShoutAuthor.user, ShoutAuthor.caption], ShoutAuthor.shout == slug ).\
join(ShoutAuthor.caption.label('caption'), ShoutAuthor.shout == slug ).\
filter(Shout.slug == slug).first()
if not shout: