id suffix removed from database relation fields
This commit is contained in:
@@ -52,7 +52,7 @@ async def create_shout(_, info, inp):
|
||||
session.add(new_collab)
|
||||
|
||||
# NOTE: shout made by one first author
|
||||
sa = ShoutAuthor.create(shoutId=new_shout.id, userId=user.id)
|
||||
sa = ShoutAuthor.create(shout=new_shout.id, user=user.id)
|
||||
session.add(sa)
|
||||
|
||||
reactions_follow(user, new_shout.slug, True)
|
||||
@@ -63,14 +63,14 @@ async def create_shout(_, info, inp):
|
||||
for slug in topic_slugs:
|
||||
topic = session.query(Topic).where(Topic.slug == slug).one()
|
||||
|
||||
st = ShoutTopic.create(shoutId=new_shout.id, topicId=topic.id)
|
||||
st = ShoutTopic.create(shout=new_shout.id, topic=topic.id)
|
||||
session.add(st)
|
||||
tf = session.query(TopicFollower).where(
|
||||
and_(TopicFollower.followerId == user.id, TopicFollower.topicId == topic.id)
|
||||
and_(TopicFollower.follower == user.id, TopicFollower.topic == topic.id)
|
||||
)
|
||||
|
||||
if not tf:
|
||||
tf = TopicFollower.create(followerId=user.id, topicId=topic.id, auto=True)
|
||||
tf = TopicFollower.create(follower=user.id, topic=topic.id, auto=True)
|
||||
session.add(tf)
|
||||
|
||||
new_shout.topic_slugs = topic_slugs
|
||||
@@ -100,7 +100,7 @@ async def update_shout(_, info, inp):
|
||||
if user_id not in authors:
|
||||
scopes = auth.scopes
|
||||
print(scopes)
|
||||
if Resource.shoutId not in scopes:
|
||||
if Resource.shout not in scopes:
|
||||
return {"error": "access denied"}
|
||||
else:
|
||||
shout.update(inp)
|
||||
@@ -108,7 +108,7 @@ async def update_shout(_, info, inp):
|
||||
session.add(shout)
|
||||
if inp.get("topics"):
|
||||
# remove old links
|
||||
links = session.query(ShoutTopic).where(ShoutTopic.shoutId == shout.id).all()
|
||||
links = session.query(ShoutTopic).where(ShoutTopic.shout == shout.id).all()
|
||||
for topiclink in links:
|
||||
session.delete(topiclink)
|
||||
# add new topic links
|
||||
|
||||
Reference in New Issue
Block a user