Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
2026-08-31 21:40:50 +02:00

View File

@@ -34,6 +34,27 @@ export default async function adminRoutes(server: FastifyInstance) {
limits: { fileSize: 1024 * 1024 * 1024 } limits: { fileSize: 1024 * 1024 * 1024 }
}); });
// Migration 0064 added import-only columns to this table. Keep export
// endpoints usable while an older main instance still has the 0055 schema.
const tenantExportJobColumns = {
id: tenantExportJobs.id,
createdAt: tenantExportJobs.createdAt,
updatedAt: tenantExportJobs.updatedAt,
completedAt: tenantExportJobs.completedAt,
tenantId: tenantExportJobs.tenantId,
createdBy: tenantExportJobs.createdBy,
operation: tenantExportJobs.operation,
previousTenantLocked: tenantExportJobs.previousTenantLocked,
status: tenantExportJobs.status,
filename: tenantExportJobs.filename,
storagePath: tenantExportJobs.storagePath,
contentType: tenantExportJobs.contentType,
fileSize: tenantExportJobs.fileSize,
error: tenantExportJobs.error,
filesTotal: tenantExportJobs.filesTotal,
filesDone: tenantExportJobs.filesDone,
};
const deriveNameFromEmail = (email: string) => { const deriveNameFromEmail = (email: string) => {
const localPart = email.split("@")[0] || "Benutzer"; const localPart = email.split("@")[0] || "Benutzer";
const normalized = localPart.replace(/[._-]+/g, " ").trim(); const normalized = localPart.replace(/[._-]+/g, " ").trim();
@@ -523,7 +544,7 @@ export default async function adminRoutes(server: FastifyInstance) {
filename, filename,
updatedAt: new Date(), updatedAt: new Date(),
}) })
.returning(); .returning(tenantExportJobColumns);
void startTenantExportJob(job.id, tenantId, filename); void startTenantExportJob(job.id, tenantId, filename);
@@ -1335,7 +1356,7 @@ export default async function adminRoutes(server: FastifyInstance) {
const { export_id } = req.params as { export_id: string }; const { export_id } = req.params as { export_id: string };
const [job] = await server.db const [job] = await server.db
.select() .select(tenantExportJobColumns)
.from(tenantExportJobs) .from(tenantExportJobs)
.where(eq(tenantExportJobs.id, export_id)) .where(eq(tenantExportJobs.id, export_id))
.limit(1); .limit(1);
@@ -1352,6 +1373,7 @@ export default async function adminRoutes(server: FastifyInstance) {
filesDone: job.filesDone, filesDone: job.filesDone,
filesTotal: job.filesTotal, filesTotal: job.filesTotal,
error: job.error, error: job.error,
statusMessage: null,
createdAt: job.createdAt, createdAt: job.createdAt,
updatedAt: job.updatedAt, updatedAt: job.updatedAt,
completedAt: job.completedAt, completedAt: job.completedAt,
@@ -1373,7 +1395,7 @@ export default async function adminRoutes(server: FastifyInstance) {
const { export_id } = req.params as { export_id: string }; const { export_id } = req.params as { export_id: string };
const [job] = await server.db const [job] = await server.db
.select() .select(tenantExportJobColumns)
.from(tenantExportJobs) .from(tenantExportJobs)
.where(eq(tenantExportJobs.id, export_id)) .where(eq(tenantExportJobs.id, export_id))
.limit(1); .limit(1);