Add tenant merge review page
All checks were successful
Build and Push Docker Images / build-backend (push) Successful in 39s
Build and Push Docker Images / build-frontend (push) Successful in 1m43s
Build and Push Docker Images / build-central-services-api (push) Successful in 23s
Build and Push Docker Images / build-docs (push) Successful in 24s
Build and Push Docker Images / build-website (push) Successful in 26s
Build and Push Docker Images / build-central-services-admin (push) Successful in 24s

This commit is contained in:
2026-08-06 12:35:31 +02:00
parent e2fdfe9c0a
commit 291f278d99
3 changed files with 299 additions and 1 deletions

View File

@@ -61,6 +61,35 @@ export type TenantImportResult = {
filesDone?: number
filesTotal?: number
error?: string | null
reviewUrl?: string
}
export type TenantMergeKind = "import" | "existing" | "conflict" | "id_collision"
export type TenantMergeDecision = "source" | "target"
export type TenantMergeItem = {
id: string
table: string
kind: TenantMergeKind
label: string
sourceKey: string
targetKey: string | null
defaultDecision: TenantMergeDecision
allowedDecisions: TenantMergeDecision[]
differences: string[]
sourceRow: Record<string, any>
targetRow: Record<string, any> | null
}
export type TenantMergeReview = {
importId: string
tenantId: number
status: string
filename: string
summary: Record<TenantMergeKind, number>
tables: string[]
total: number
offset: number
limit: number
items: TenantMergeItem[]
}
export type TenantExportJob = {
@@ -222,6 +251,20 @@ export const useAdmin = () => {
})
}
const getTenantImportReview = async (
importId: string,
query: { kind?: string; table?: string; offset?: number; limit?: number } = {},
): Promise<TenantMergeReview> => {
return await $api(`/api/admin/tenant-imports/${importId}/review`, { query })
}
const executeTenantImportMerge = async (importId: string, decisions: Record<string, TenantMergeDecision>) => {
return await $api(`/api/admin/tenant-imports/${importId}/execute`, {
method: "POST",
body: { decisions },
})
}
const getSystemStatus = async (): Promise<SystemStatus> => {
return await $api("/api/admin/system-status")
}
@@ -262,5 +305,7 @@ export const useAdmin = () => {
getTenantExport,
downloadTenantExport,
importTenant,
getTenantImportReview,
executeTenantImportMerge,
}
}