Пример #1
0
def update_table_warning(warning_id, **fields):
    warning = DataTableWarning.get(id=warning_id)
    verify_data_table_permission(warning.table_id)

    if "severity" in fields:
        fields["severity"] = DataTableWarningSeverity(fields["severity"])

    return DataTableWarning.update(
        id=warning_id,
        fields={
            **fields, "updated_by": current_user.id
        },
        field_names=["message", "severity", "updated_by"],
    )
Пример #2
0
def create_table_warning(table_id, message, severity):
    verify_data_table_permission(table_id)
    return DataTableWarning.create({
        "message":
        message,
        "severity":
        DataTableWarningSeverity(severity),
        "created_by":
        current_user.id,
        "updated_by":
        current_user.id,
        "table_id":
        table_id,
    })