Reconcile FurnitureData.json with items_base after import
After every single import, batch import and batch-regen, cross-check all items_base rows against the local FurnitureData.json: entries whose spriteId drifted are corrected to the DB id, and missing entries plus real id conflicts are reported in the API/SSE response. Entries that are missing entirely are counted (rebuilding them needs SWF/nitro metadata).
This commit is contained in:
1 parent
b4021f6b42
commit
b4968a9967
4 files changed
+118
-1
No files matched your search
@@ -3,7 +3,10 @@ import { apiError } from "@/lib/api-response";
|
||||
import { PERMS } from "@/lib/permissions";
|
||||
import { logAudit } from "@/lib/services/audit";
|
||||
import { getSource } from "@/lib/services/clone-sources";
|
||||
import { appendFurniEntriesBatch } from "@/lib/services/furni-data";
|
||||
import {
|
||||
appendFurniEntriesBatch,
|
||||
reconcileFurniDataWithItemsBase,
|
||||
} from "@/lib/services/furni-data";
|
||||
import {
|
||||
ensureDirectories,
|
||||
ensureFurniOwnership,
|
||||
@@ -219,12 +222,19 @@ export const POST = withAdmin(
|
||||
let ownershipFixed: string[] = [];
|
||||
let nitrosSynced: string[] = [];
|
||||
let iconsSynced: string[] = [];
|
||||
let furniDataFixedIds = 0;
|
||||
let furniDataMissing = 0;
|
||||
let furniDataConflicts = 0;
|
||||
try {
|
||||
offerIdsFixed = (await reconcileImportedOfferIds()).fixed;
|
||||
ownershipFixed = (await ensureFurniOwnership()).fixed;
|
||||
const assetsSynced = await syncAssetsToGamedataBundle();
|
||||
nitrosSynced = assetsSynced.copiedNitros;
|
||||
iconsSynced = assetsSynced.copiedIcons;
|
||||
const furniReconcile = await reconcileFurniDataWithItemsBase();
|
||||
furniDataFixedIds = furniReconcile.fixedIds;
|
||||
furniDataMissing = furniReconcile.missing;
|
||||
furniDataConflicts = furniReconcile.conflicts;
|
||||
} catch (err) {
|
||||
console.warn(
|
||||
"[import-furni] Post-import reconcile/ownership failed:",
|
||||
@@ -241,6 +251,9 @@ export const POST = withAdmin(
|
||||
ownershipFixed,
|
||||
nitrosSynced,
|
||||
iconsSynced,
|
||||
furniDataFixedIds,
|
||||
furniDataMissing,
|
||||
furniDataConflicts,
|
||||
duration: Date.now() - startTime,
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user