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
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:
@@ -1,5 +1,5 @@
|
||||
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 { GetObjectCommand } from "@aws-sdk/client-s3";
|
||||
|
||||
@@ -534,17 +534,18 @@ export default async function adminRoutes(server: FastifyInstance) {
|
||||
if (!tenant) return null;
|
||||
|
||||
const filename = tenantExportFilename(tenantId, tenant);
|
||||
const [job] = await server.db
|
||||
.insert(tenantExportJobs)
|
||||
.values({
|
||||
tenantId,
|
||||
createdBy: currentUserId,
|
||||
operation: "export",
|
||||
status: "queued",
|
||||
filename,
|
||||
updatedAt: new Date(),
|
||||
})
|
||||
.returning(tenantExportJobColumns);
|
||||
const result = await server.db.execute(sql`
|
||||
INSERT INTO "tenant_export_jobs"
|
||||
("tenant_id", "created_by", "operation", "status", "filename", "updated_at")
|
||||
VALUES
|
||||
(${tenantId}, ${currentUserId}, 'export', 'queued', ${filename}, ${new Date()})
|
||||
RETURNING "id", "status", "filename";
|
||||
`);
|
||||
const [job] = result.rows as Array<{
|
||||
id: string;
|
||||
status: string;
|
||||
filename: string;
|
||||
}>;
|
||||
|
||||
void startTenantExportJob(job.id, tenantId, filename);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user