Add reversible Maximo/WINC machine-adoption import
Machine data arrives as a Maximo asset export (validated against the WINC site) that must update existing machines in place, not create canonical per-table rows, so it does not fit the ShopDB-native/Azure/Thor CSV adapter path. Bulk edits to live machines also need an escape hatch, so the whole commit is journaled and can be undone as one batch. Add a dedicated dry-run analyzer, approval packet, resolver/suggest helpers, and a reversible writer/undo backed by a new importbatches/importjournalentries schema (with migration). Expose preview/commit/batches/undo settings routes and a matching frontend source card and panel, and surface the batch/journal contract through shopdb.api for plugins.
This commit is contained in:
@@ -140,6 +140,22 @@ from shopdb.utils.mailer import send_email, send_alert, send_webhook
|
||||
from shopdb.utils.cmmc_usb_db import cmmc_usb_connection
|
||||
|
||||
|
||||
# Reversible bulk-import journal. A plugin that drives a bulk import (a site
|
||||
# asset adoption, an integration sync) records the primitive changes it makes so
|
||||
# the whole batch can be undone. ImportBatch is the identity approval, write, and
|
||||
# undo all reference; ImportJournalEntry is one reversible mutation. Exposed so a
|
||||
# plugin's import UI can list applied batches and reverse one without reaching
|
||||
# into core internals. See docs/PLUGIN-HOOKS.md.
|
||||
from shopdb.core.models import (
|
||||
ImportBatch,
|
||||
ImportJournalEntry,
|
||||
BATCH_APPLIED,
|
||||
BATCH_UNDONE,
|
||||
OP_UPDATE,
|
||||
OP_INSERT,
|
||||
)
|
||||
|
||||
|
||||
def audit_log(
|
||||
action: str,
|
||||
entitytype: str,
|
||||
|
||||
Reference in New Issue
Block a user