reactions-fix-2
This commit is contained in:
parent
8fcd856132
commit
e4a6735199
|
@ -78,7 +78,7 @@ async def update_reaction(_, info, inp):
|
||||||
|
|
||||||
with local_session() as session:
|
with local_session() as session:
|
||||||
user = session.query(User).filter(User.id == user_id).first()
|
user = session.query(User).filter(User.id == user_id).first()
|
||||||
reaction = session.query(Reaction).filter(Reaction.id == id).first()
|
reaction = session.query(Reaction).filter(Reaction.id == inp.id).first()
|
||||||
if not reaction:
|
if not reaction:
|
||||||
return {"error": "invalid reaction id"}
|
return {"error": "invalid reaction id"}
|
||||||
if reaction.createdBy != user.slug:
|
if reaction.createdBy != user.slug:
|
||||||
|
@ -148,14 +148,13 @@ async def get_reactions_for_shouts(_, info, shouts, offset, limit):
|
||||||
|
|
||||||
|
|
||||||
@query.field("reactionsByAuthor")
|
@query.field("reactionsByAuthor")
|
||||||
async def get_reactions_by_author(_, info, slug, page=1, size=50):
|
async def get_reactions_by_author(_, info, slug, limit=50, offset=0):
|
||||||
offset = page * size
|
|
||||||
reactions = []
|
reactions = []
|
||||||
with local_session() as session:
|
with local_session() as session:
|
||||||
reactions = (
|
reactions = (
|
||||||
session.query(Reaction)
|
session.query(Reaction)
|
||||||
.filter(Reaction.createdBy == slug)
|
.filter(Reaction.createdBy == slug)
|
||||||
.limit(size)
|
.limit(limit)
|
||||||
.offset(offset)
|
.offset(offset)
|
||||||
)
|
)
|
||||||
for r in reactions:
|
for r in reactions:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user