Fix letterhead remapping in tenant import
All checks were successful
Build and Push Docker Images / build-backend (push) Successful in 33s
Build and Push Docker Images / build-frontend (push) Successful in 18s
Build and Push Docker Images / build-website (push) Successful in 17s
Build and Push Docker Images / build-docs (push) Successful in 17s
All checks were successful
Build and Push Docker Images / build-backend (push) Successful in 33s
Build and Push Docker Images / build-frontend (push) Successful in 18s
Build and Push Docker Images / build-website (push) Successful in 17s
Build and Push Docker Images / build-docs (push) Successful in 17s
This commit is contained in:
@@ -587,6 +587,10 @@ const remapTenantScopedExport = (
|
|||||||
nextRow.path = `${targetPathPrefix}${nextRow.path.slice(sourcePathPrefix.length)}`
|
nextRow.path = `${targetPathPrefix}${nextRow.path.slice(sourcePathPrefix.length)}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (table === "letterheads" && typeof nextRow.path === "string" && nextRow.path.startsWith(sourcePathPrefix)) {
|
||||||
|
nextRow.path = `${targetPathPrefix}${nextRow.path.slice(sourcePathPrefix.length)}`
|
||||||
|
}
|
||||||
|
|
||||||
return nextRow
|
return nextRow
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -851,8 +855,15 @@ export const importTenantFullExport = async (
|
|||||||
importedTables.push({ table: "bankstatements", rows: result.count })
|
importedTables.push({ table: "bankstatements", rows: result.count })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const letterheadMetadata = columnsByTable.get("letterheads")
|
||||||
|
if (letterheadMetadata) {
|
||||||
|
const result = await insertIdentityRowsWithRemap(client, "letterheads", exportData.tables.letterheads || [], letterheadMetadata)
|
||||||
|
remapTableColumn(exportData.tables.createddocuments, "letterhead", result.idMap)
|
||||||
|
importedTables.push({ table: "letterheads", rows: result.count })
|
||||||
|
}
|
||||||
|
|
||||||
for (const table of tableNames) {
|
for (const table of tableNames) {
|
||||||
if (["bankaccounts", "bankstatements"].includes(table)) continue
|
if (["bankaccounts", "bankstatements", "letterheads"].includes(table)) continue
|
||||||
|
|
||||||
const rows = exportData.tables[table] || []
|
const rows = exportData.tables[table] || []
|
||||||
const metadata = columnsByTable.get(table)
|
const metadata = columnsByTable.get(table)
|
||||||
|
|||||||
Reference in New Issue
Block a user