diff --git a/src/app/api/admin/import/furni/batch/route.ts b/src/app/api/admin/import/furni/batch/route.ts index dcea9886b8..60eba7617f 100644 --- a/src/app/api/admin/import/furni/batch/route.ts +++ b/src/app/api/admin/import/furni/batch/route.ts @@ -6,7 +6,9 @@ import { getSource } from "@/lib/services/clone-sources"; import { appendFurniEntriesBatch } from "@/lib/services/furni-data"; import { ensureDirectories, + ensureFurniOwnership, importSingleFurni, + reconcileImportedOfferIds, } from "@/lib/services/furni-import"; import { rcon } from "@/lib/services/rcon"; import type { ImportSingleResult } from "@/types/furni"; @@ -211,11 +213,26 @@ export const POST = withAdmin( } } + // Reconcile offer_id and fix asset ownership across the whole tree + let offerIdsFixed = 0; + let ownershipFixed: string[] = []; + try { + offerIdsFixed = (await reconcileImportedOfferIds()).fixed; + ownershipFixed = (await ensureFurniOwnership()).fixed; + } catch (err) { + console.warn( + "[import-furni] Post-import reconcile/ownership failed:", + (err as Error).message, + ); + } + send({ type: "batch_complete", succeeded, failed, warnings: withWarnings, + offerIdsFixed, + ownershipFixed, duration: Date.now() - startTime, });