KI-AGENT: Matrix-Daten beim Tenant-Import neu provisionieren

This commit is contained in:
2026-06-03 10:43:40 +02:00
parent c660f62120
commit ccc66ebd0f
2 changed files with 89 additions and 0 deletions

View File

@@ -18,6 +18,7 @@ import { ensureTenantBaseData } from "../modules/bootstrap.service";
import { buildTenantFullExport, importTenantFullExport } from "../utils/tenantFullExport";
import type { TenantFullExport } from "../utils/tenantFullExport";
import { buildSystemStatus } from "../modules/system-status.service";
import { matrixService } from "../modules/matrix.service";
export default async function adminRoutes(server: FastifyInstance) {
const deriveNameFromEmail = (email: string) => {
@@ -1034,8 +1035,27 @@ export default async function adminRoutes(server: FastifyInstance) {
});
}
let matrixProvisioned = false;
let matrixProvisioningError: string | null = null;
if (process.env.MATRIX_REGISTRATION_SHARED_SECRET) {
try {
const matrix = matrixService(server);
await matrix.provisionTenantRoom(currentUser.id, result.tenantId, {
key: "allgemein",
name: "Allgemeiner Chat",
type: "general",
});
matrixProvisioned = true;
} catch (err: any) {
matrixProvisioningError = err?.message || String(err);
req.log.warn({ err }, "Matrix-Räume konnten nach Tenant-Import nicht neu provisioniert werden");
}
}
return {
success: true,
matrixProvisioned,
matrixProvisioningError,
...result,
};
} catch (err: any) {