Restrict tenant imports to new tenants

This commit is contained in:
2026-08-06 15:19:11 +02:00
parent c66d04f0b5
commit cb37970074
12 changed files with 38 additions and 1867 deletions

View File

@@ -61,35 +61,6 @@ 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 = {
@@ -251,20 +222,6 @@ 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")
}
@@ -305,7 +262,5 @@ export const useAdmin = () => {
getTenantExport,
downloadTenantExport,
importTenant,
getTenantImportReview,
executeTenantImportMerge,
}
}