Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -34,6 +34,27 @@ export default async function adminRoutes(server: FastifyInstance) {
|
||||
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 localPart = email.split("@")[0] || "Benutzer";
|
||||
const normalized = localPart.replace(/[._-]+/g, " ").trim();
|
||||
@@ -523,7 +544,7 @@ export default async function adminRoutes(server: FastifyInstance) {
|
||||
filename,
|
||||
updatedAt: new Date(),
|
||||
})
|
||||
.returning();
|
||||
.returning(tenantExportJobColumns);
|
||||
|
||||
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 [job] = await server.db
|
||||
.select()
|
||||
.select(tenantExportJobColumns)
|
||||
.from(tenantExportJobs)
|
||||
.where(eq(tenantExportJobs.id, export_id))
|
||||
.limit(1);
|
||||
@@ -1352,6 +1373,7 @@ export default async function adminRoutes(server: FastifyInstance) {
|
||||
filesDone: job.filesDone,
|
||||
filesTotal: job.filesTotal,
|
||||
error: job.error,
|
||||
statusMessage: null,
|
||||
createdAt: job.createdAt,
|
||||
updatedAt: job.updatedAt,
|
||||
completedAt: job.completedAt,
|
||||
@@ -1373,7 +1395,7 @@ export default async function adminRoutes(server: FastifyInstance) {
|
||||
|
||||
const { export_id } = req.params as { export_id: string };
|
||||
const [job] = await server.db
|
||||
.select()
|
||||
.select(tenantExportJobColumns)
|
||||
.from(tenantExportJobs)
|
||||
.where(eq(tenantExportJobs.id, export_id))
|
||||
.limit(1);
|
||||
|
||||
Reference in New Issue
Block a user