KI-AGENT: Importiere Export in bestehenden Zielmandanten
This commit is contained in:
@@ -970,8 +970,15 @@ export default async function adminRoutes(server: FastifyInstance) {
|
||||
const currentUser = await requireAdmin(req, reply);
|
||||
if (!currentUser) return;
|
||||
|
||||
const exportData = req.body as TenantFullExport;
|
||||
const result = await importTenantFullExport(server, exportData);
|
||||
const body = req.body as TenantFullExport | { exportData?: TenantFullExport; targetTenantId?: number };
|
||||
const exportData = "format" in body ? body : body.exportData;
|
||||
const targetTenantId = "format" in body ? null : Number(body.targetTenantId || 0) || null;
|
||||
|
||||
if (!exportData) {
|
||||
return reply.code(400).send({ error: "exportData required" });
|
||||
}
|
||||
|
||||
const result = await importTenantFullExport(server, exportData, { targetTenantId });
|
||||
const fallbackName = deriveNameFromEmail(currentUser.email);
|
||||
|
||||
await server.db
|
||||
|
||||
Reference in New Issue
Block a user