Some fixes
This commit is contained in:
parent
f72c941a3a
commit
5aecf2d643
7
main.py
7
main.py
@ -86,7 +86,7 @@ class Back():
|
|||||||
return str(posts.insert_one(newPost).inserted_id)
|
return str(posts.insert_one(newPost).inserted_id)
|
||||||
|
|
||||||
def deletePost(self, name):
|
def deletePost(self, name):
|
||||||
return posts.delete_one({'name': name})
|
return bool(posts.delete_one({'name': name}).deleted_count)
|
||||||
|
|
||||||
|
|
||||||
@route('/post/<name>')
|
@route('/post/<name>')
|
||||||
@ -97,7 +97,7 @@ def post(name):
|
|||||||
return str(back.getPost(name))
|
return str(back.getPost(name))
|
||||||
|
|
||||||
|
|
||||||
@route('/post/<name>', method='POST')
|
@route('/admin/post/<name>', method='POST')
|
||||||
def postUpd(name):
|
def postUpd(name):
|
||||||
'''
|
'''
|
||||||
Insert/Update post
|
Insert/Update post
|
||||||
@ -106,12 +106,11 @@ def postUpd(name):
|
|||||||
return back.updatePost(name=name, body=body)
|
return back.updatePost(name=name, body=body)
|
||||||
|
|
||||||
|
|
||||||
@route('/post/<name>', method='DELETE')
|
@route('/admin/post/<name>', method='DELETE')
|
||||||
def postDel(name):
|
def postDel(name):
|
||||||
'''
|
'''
|
||||||
Delete post by name
|
Delete post by name
|
||||||
'''
|
'''
|
||||||
# return str(posts.delete_one({'name':name}))
|
|
||||||
return str(back.deletePost(name))
|
return str(back.deletePost(name))
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user