shout related todos, schema update
This commit is contained in:
parent
0517dfc744
commit
ea06b61d3f
26
resolvers/zine.py
Normal file
26
resolvers/zine.py
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
from orm import Shout, User
|
||||||
|
from orm.base import global_session
|
||||||
|
|
||||||
|
from resolvers.base import mutation, query, subscription
|
||||||
|
|
||||||
|
# TODO: debug me
|
||||||
|
@mutation.field("createShout")
|
||||||
|
@login_required
|
||||||
|
async def create_post(_, info, input):
|
||||||
|
auth = info.context["request"].auth
|
||||||
|
user_id = auth.user_id
|
||||||
|
|
||||||
|
new_shout = Shout.create(
|
||||||
|
author = user_id,
|
||||||
|
body = input["body"], # TODO: add createShoutInput in scheme.graphql
|
||||||
|
title = input.get("title")
|
||||||
|
# TODO: generate slug
|
||||||
|
)
|
||||||
|
|
||||||
|
return {
|
||||||
|
"status": True,
|
||||||
|
"shout" : new_shout
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: paginate, get, update, delete
|
|
@ -37,6 +37,12 @@ type createMessagePayload {
|
||||||
message: Message
|
message: Message
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type createShoutPayload {
|
||||||
|
status: Boolean!
|
||||||
|
error: String
|
||||||
|
shout: Shout
|
||||||
|
}
|
||||||
|
|
||||||
################################### Mutation
|
################################### Mutation
|
||||||
|
|
||||||
type Mutation {
|
type Mutation {
|
||||||
|
@ -55,8 +61,8 @@ type Mutation {
|
||||||
registerUser(input: registerUserInput!): User!
|
registerUser(input: registerUserInput!): User!
|
||||||
|
|
||||||
# shout
|
# shout
|
||||||
createShout(body: String!, replyTo: [Int], title: String, versionOf: [Int], visibleForRoles: [Int], visibleForUsers: [Int]): Message!
|
createShout(): Shout!
|
||||||
deleteShout(shoutId: Int!): Message!
|
deleteShout(shoutId: Int!): Boolean!
|
||||||
rateShout(value: Int!): Boolean!
|
rateShout(value: Int!): Boolean!
|
||||||
|
|
||||||
# profile
|
# profile
|
||||||
|
|
Loading…
Reference in New Issue
Block a user