def api_delete_comments(id, request): check_admin(request) c = yield from Comment.find(id) if c is None: raise APIResourceNotFoundError('Comment') yield from c.remove() return dict(id=id)
def api_delete_comments(id, request): check_admin(request) c = yield from Comment.find(id) if c is None: raise ApiResourceNotFoundError('Comment') yield from c.remove() return dict(id=id)
async def api_delete_comment(id, request): check_admin(request) comment = Comment.find(id) if comment is None: raise APIResourceNotFoundError('Comment') await comment.remove() return dict(id=id)
def delete_comment(post_id, comment_id): user = SESSION.get(request.headers.get('Authorization')) if user is None: abort(400, {'message': 'TOKEN_NOT_FOUND'}) from model import Comment comment_exist = Comment.find(comment_id) if comment_exist is None: abort(400, {'message': 'COMMENT_NOT_FOUND'}) comment_exist.delete() return "DELETED"