fix: harden furni import pipeline for production
- importSingleFurni: actually update an existing item instead of failing on a primary key INSERT collision; refuse to reassign a spriteId owned by a different classname - reconcileFurniDataWithItemsBase: also sync each entry's offerid to the DB sprite id, not just the id - Move the full-table interaction_modes_count verification out of the per-item import hot path and run it once per batch/single import - clone-import: apply the auto-detected interaction_type (was hardcoded 'default'), set FurnitureData offerid and catalog_items.offer_id to the new local sprite id (was the source hotel's id / -1) - clone batch route: run the same post-import reconcile/verify/ownership/RCON consolidation as the furni batch route - upload-import: set offer_id to the allocated id in both the direct insert and the generated SQL migration (was -1) - generateCatalogSql: use the classname as catalog_name and the item id as offer_id so rows match the app-managed import convention - stats + missing-nitro endpoints: match catalog membership via item_ids instead of the catalog_name join, so translated display names no longer break counts - deleteImportedItem/rollback: delete catalog rows by the canonical item_ids link only - classifyFurni: wall items always classify as 'walls' before prefix rules (rare_/val_/xmas_) can misfile them
This commit is contained in:
1 parent
2b9a015afb
commit
6021a91ef7
9 files changed
+162
-66
No files matched your search
@@ -13,6 +13,7 @@ import {
|
||||
importSingleFurni,
|
||||
reconcileImportedOfferIds,
|
||||
syncAssetsToGamedataBundle,
|
||||
verifyAndFixInteractionModesCount,
|
||||
} from "@/lib/services/furni-import";
|
||||
import { rcon } from "@/lib/services/rcon";
|
||||
import type { ImportSingleResult } from "@/types/furni";
|
||||
@@ -223,8 +224,10 @@ export const POST = withAdmin(
|
||||
let nitrosSynced: string[] = [];
|
||||
let iconsSynced: string[] = [];
|
||||
let furniDataFixedIds = 0;
|
||||
let furniDataFixedOfferIds = 0;
|
||||
let furniDataMissing = 0;
|
||||
let furniDataConflicts = 0;
|
||||
let interactionFixed = 0;
|
||||
try {
|
||||
offerIdsFixed = (await reconcileImportedOfferIds()).fixed;
|
||||
ownershipFixed = (await ensureFurniOwnership()).fixed;
|
||||
@@ -233,8 +236,10 @@ export const POST = withAdmin(
|
||||
iconsSynced = assetsSynced.copiedIcons;
|
||||
const furniReconcile = await reconcileFurniDataWithItemsBase();
|
||||
furniDataFixedIds = furniReconcile.fixedIds;
|
||||
furniDataFixedOfferIds = furniReconcile.fixedOfferIds;
|
||||
furniDataMissing = furniReconcile.missing;
|
||||
furniDataConflicts = furniReconcile.conflicts;
|
||||
interactionFixed = (await verifyAndFixInteractionModesCount()).fixed;
|
||||
} catch (err) {
|
||||
console.warn(
|
||||
"[import-furni] Post-import reconcile/ownership failed:",
|
||||
@@ -252,8 +257,10 @@ export const POST = withAdmin(
|
||||
nitrosSynced,
|
||||
iconsSynced,
|
||||
furniDataFixedIds,
|
||||
furniDataFixedOfferIds,
|
||||
furniDataMissing,
|
||||
furniDataConflicts,
|
||||
interactionFixed,
|
||||
duration: Date.now() - startTime,
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user