From a45d47bb048f906650b2f32c4e9fa2dd9a44c98d Mon Sep 17 00:00:00 2001 From: bniwredyc Date: Sun, 7 May 2023 18:21:12 +0200 Subject: [PATCH] slugs to ids, cover property added to ShoutInput --- resolvers/create/editor.py | 8 ++++---- schema.graphql | 10 ++++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/resolvers/create/editor.py b/resolvers/create/editor.py index a6412436..fee28554 100644 --- a/resolvers/create/editor.py +++ b/resolvers/create/editor.py @@ -93,11 +93,11 @@ async def create_shout(_, info, inp): @mutation.field("updateShout") @login_required -async def update_shout(_, info, slug, inp): +async def update_shout(_, info, shout_id, shout_input): auth: AuthCredentials = info.context["request"].auth with local_session() as session: - shout = session.query(Shout).filter(Shout.slug == slug).first() + shout = session.query(Shout).filter(Shout.id == shout_id).first() if not shout: return {"error": "shout not found"} @@ -109,10 +109,10 @@ async def update_shout(_, info, slug, inp): if Resource.shout not in scopes: return {"error": "access denied"} else: - shout.update(inp) + shout.update(shout_input) shout.updatedAt = datetime.now(tz=timezone.utc) - if inp.get("topics"): + if shout_input.get("topics"): # remove old links links = session.query(ShoutTopic).where(ShoutTopic.shout == shout.id).all() for topiclink in links: diff --git a/schema.graphql b/schema.graphql index a56bd52b..04fccba0 100644 --- a/schema.graphql +++ b/schema.graphql @@ -103,9 +103,7 @@ input ShoutInput { community: Int mainTopic: String subtitle: String - versionOf: String - visibleForRoles: [String] # role ids are strings - visibleForUsers: [String] + cover: String } input ProfileInput { @@ -170,9 +168,9 @@ type Mutation { # shout createShout(inp: ShoutInput!): Result! - updateShout(slug: String!, inp: ShoutInput!): Result! - deleteShout(slug: String!): Result! - publishShout(slug: String!, inp: ShoutInput!): Result! + updateShout(shout_id: Int!, shout_input: ShoutInput!): Result! + deleteShout(shout_id: Int!): Result! + publishShout(shout_id: Int!, shout_input: ShoutInput): Result! # user profile rateUser(slug: String!, value: Int!): Result!