slugs to ids, cover property added to ShoutInput
This commit is contained in:
parent
56e4700ace
commit
a45d47bb04
|
@ -93,11 +93,11 @@ async def create_shout(_, info, inp):
|
||||||
|
|
||||||
@mutation.field("updateShout")
|
@mutation.field("updateShout")
|
||||||
@login_required
|
@login_required
|
||||||
async def update_shout(_, info, slug, inp):
|
async def update_shout(_, info, shout_id, shout_input):
|
||||||
auth: AuthCredentials = info.context["request"].auth
|
auth: AuthCredentials = info.context["request"].auth
|
||||||
|
|
||||||
with local_session() as session:
|
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:
|
if not shout:
|
||||||
return {"error": "shout not found"}
|
return {"error": "shout not found"}
|
||||||
|
@ -109,10 +109,10 @@ async def update_shout(_, info, slug, inp):
|
||||||
if Resource.shout not in scopes:
|
if Resource.shout not in scopes:
|
||||||
return {"error": "access denied"}
|
return {"error": "access denied"}
|
||||||
else:
|
else:
|
||||||
shout.update(inp)
|
shout.update(shout_input)
|
||||||
shout.updatedAt = datetime.now(tz=timezone.utc)
|
shout.updatedAt = datetime.now(tz=timezone.utc)
|
||||||
|
|
||||||
if inp.get("topics"):
|
if shout_input.get("topics"):
|
||||||
# remove old links
|
# remove old links
|
||||||
links = session.query(ShoutTopic).where(ShoutTopic.shout == shout.id).all()
|
links = session.query(ShoutTopic).where(ShoutTopic.shout == shout.id).all()
|
||||||
for topiclink in links:
|
for topiclink in links:
|
||||||
|
|
|
@ -103,9 +103,7 @@ input ShoutInput {
|
||||||
community: Int
|
community: Int
|
||||||
mainTopic: String
|
mainTopic: String
|
||||||
subtitle: String
|
subtitle: String
|
||||||
versionOf: String
|
cover: String
|
||||||
visibleForRoles: [String] # role ids are strings
|
|
||||||
visibleForUsers: [String]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
input ProfileInput {
|
input ProfileInput {
|
||||||
|
@ -170,9 +168,9 @@ type Mutation {
|
||||||
|
|
||||||
# shout
|
# shout
|
||||||
createShout(inp: ShoutInput!): Result!
|
createShout(inp: ShoutInput!): Result!
|
||||||
updateShout(slug: String!, inp: ShoutInput!): Result!
|
updateShout(shout_id: Int!, shout_input: ShoutInput!): Result!
|
||||||
deleteShout(slug: String!): Result!
|
deleteShout(shout_id: Int!): Result!
|
||||||
publishShout(slug: String!, inp: ShoutInput!): Result!
|
publishShout(shout_id: Int!, shout_input: ShoutInput): Result!
|
||||||
|
|
||||||
# user profile
|
# user profile
|
||||||
rateUser(slug: String!, value: Int!): Result!
|
rateUser(slug: String!, value: Int!): Result!
|
||||||
|
|
Loading…
Reference in New Issue
Block a user