feat: catalog audit can repair orphaned refs and duplicate classnames
- add repairOrphanedCatalog: remove catalog_items rows whose item_ids only reference missing items_base entries, strip orphaned ids from mixed rows - add repairDuplicateClassnames: merge items_base duplicates into one canonical row per classname, remap references, delete duplicate rows - add 'repair structural issues' checkbox + result display in audit UI
This commit is contained in:
1 parent
bee55e1fd4
commit
6fc14b9b84
4 files changed
+384
-1
No files matched your search
@@ -16,6 +16,7 @@ export const POST = withAdmin(
|
||||
let sql = false;
|
||||
let applySql = false;
|
||||
let repairFurniData = false;
|
||||
let repairStructure = false;
|
||||
try {
|
||||
const body = (await request.json().catch(() => ({}))) as {
|
||||
repair?: unknown;
|
||||
@@ -23,12 +24,14 @@ export const POST = withAdmin(
|
||||
sql?: unknown;
|
||||
applySql?: unknown;
|
||||
repairFurniData?: unknown;
|
||||
repairStructure?: unknown;
|
||||
};
|
||||
repair = body.repair === true;
|
||||
repairNitros = body.repairNitros === true;
|
||||
sql = body.sql === true;
|
||||
applySql = body.applySql === true;
|
||||
repairFurniData = body.repairFurniData === true;
|
||||
repairStructure = body.repairStructure === true;
|
||||
} catch {
|
||||
/* no body */
|
||||
}
|
||||
@@ -50,6 +53,7 @@ export const POST = withAdmin(
|
||||
sql,
|
||||
applySql,
|
||||
repairFurniData,
|
||||
repairStructure,
|
||||
});
|
||||
} catch (err) {
|
||||
send({
|
||||
|
||||
Reference in new issue
Block a user