shout related todos, schema update

This commit is contained in:
2021-07-27 07:58:06 +03:00
parent 0517dfc744
commit ea06b61d3f
2 changed files with 34 additions and 2 deletions

26
resolvers/zine.py Normal file
View 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