def post(self, request, table_name=None):
"""Post endpoint. Create a new row.
:param request: Sanic Request.
:param table_name: Name of the table to access.
"""
if not check_csrf(request):
return json({'message': 'access denied'}, status=403)
waf = get_jawaf()
table = registry.get(table_name)
if not table:
return json({'message': 'access denied'}, status=403)
async with Connection(table['database']) as con:
stmt = table['table'].insert().values(**request.json)
await con.execute(stmt)
await add_audit_action('post', 'admin', table_name, request['session']['user'])
return json({'message': 'success'}, status=201)
评论列表
文章目录