Beispiel #1
0
def table_invalid_error(origin_request: EventModel) -> typing.Dict[str, str]:
    return {
        "error": "table_invalid",
        "msg": "should match the table name",
        "request": origin_request.to_dict(),
        "stack": EMPTY_VALUE,
    }
Beispiel #2
0
def json_invalid_error(origin_request: EventModel) -> typing.Dict[str, str]:
    return {
        "error": "json_invalid",
        "msg": "content in your request is not a valid json format",
        "request": origin_request.to_dict(),
        "stack": EMPTY_VALUE,
    }
Beispiel #3
0
def auth_invalid_error(origin_request: EventModel) -> typing.Dict[str, str]:
    return {
        "error": "auth_invalid",
        "msg": "auth failed, check your secret",
        "request": origin_request.to_dict(),
        "stack": EMPTY_VALUE,
    }
Beispiel #4
0
def db_operator_error(origin_request: EventModel,
                      error: str) -> typing.Dict[str, str]:
    return {
        "error": "db_operator",
        "msg": "operate failed",
        "request": origin_request.to_dict(),
        "stack": error,
    }
Beispiel #5
0
 def json_upload_form(
         *,
         table: str = Form(...),
         action: str = Form(...),
         content: str = Form(...),
         secret: str = Form(...),
 ):
     new_event = EventModel(table, action, content, secret)
     return handler.handle(new_event)
Beispiel #6
0
 def wrapper(origin_request: EventModel, *args, **kwargs):
     origin_request.drop_secret()
     return func(origin_request, *args, **kwargs)
Beispiel #7
0
 def json_upload_raw(*, request: JsonRequestModel):
     new_event = EventModel(request.table, request.action, request.content,
                            request.secret)
     return handler.handle(new_event)