Exportjob-Insert ohne neue Importspalten ausführen
All checks were successful
Build and Push Docker Images / build-backend (push) Successful in 39s
Build and Push Docker Images / build-website (push) Successful in 22s
Build and Push Docker Images / build-frontend (push) Successful in 23s
Build and Push Docker Images / build-central-services-api (push) Successful in 21s
Build and Push Docker Images / build-central-services-admin (push) Successful in 22s
Build and Push Docker Images / build-docs (push) Successful in 22s

This commit is contained in:
root
2026-08-31 19:44:01 +00:00
parent bcc72974b5
commit a84bd0c445

View File

@@ -1,5 +1,5 @@
import { FastifyInstance, FastifyReply, FastifyRequest } from "fastify"; import { FastifyInstance, FastifyReply, FastifyRequest } from "fastify";
import { and, eq, inArray, isNull } from "drizzle-orm"; import { and, eq, inArray, isNull, sql } from "drizzle-orm";
import multipart from "@fastify/multipart"; import multipart from "@fastify/multipart";
import { GetObjectCommand } from "@aws-sdk/client-s3"; import { GetObjectCommand } from "@aws-sdk/client-s3";
@@ -534,17 +534,18 @@ export default async function adminRoutes(server: FastifyInstance) {
if (!tenant) return null; if (!tenant) return null;
const filename = tenantExportFilename(tenantId, tenant); const filename = tenantExportFilename(tenantId, tenant);
const [job] = await server.db const result = await server.db.execute(sql`
.insert(tenantExportJobs) INSERT INTO "tenant_export_jobs"
.values({ ("tenant_id", "created_by", "operation", "status", "filename", "updated_at")
tenantId, VALUES
createdBy: currentUserId, (${tenantId}, ${currentUserId}, 'export', 'queued', ${filename}, ${new Date()})
operation: "export", RETURNING "id", "status", "filename";
status: "queued", `);
filename, const [job] = result.rows as Array<{
updatedAt: new Date(), id: string;
}) status: string;
.returning(tenantExportJobColumns); filename: string;
}>;
void startTenantExportJob(job.id, tenantId, filename); void startTenantExportJob(job.id, tenantId, filename);