🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Remove getImportStatus.ts
Edward Cuid934f6da423b
diff --git a/server/src/api/import/getImportStatus.ts b/server/src/api/import/getImportStatus.tsdeleted file mode 100644index 86e87c2df..000000000--- a/server/src/api/import/getImportStatus.ts+++ /dev/null@@ -1,74 +0,0 @@-import { FastifyReply, FastifyRequest } from "fastify";-import { getUserHasAccessToSite } from "../../lib/auth-utils.js";-import { ImportStatusManager } from "../../lib/importStatus.js";-import { z } from "zod";--const getImportStatusRequestSchema = z.object({- params: z.object({- site: z.string().min(1),- }),- body: z.object({- importId: z.string(),- }),-}).strict();--type GetImportStatusRequest = {- Params: z.infer<typeof getImportStatusRequestSchema.shape.params>;- Body: z.infer<typeof getImportStatusRequestSchema.shape.body>;-};--export async function getImportStatus(- request: FastifyRequest<GetImportStatusRequest>,- reply: FastifyReply,-) {- try {- const parsed = getImportStatusRequestSchema.safeParse({- params: request.params,- body: request.body,- });-- if (!parsed.success) {- return reply.status(400).send({- error: "Validation failed",- details: parsed.error.flatten(),- });- }-- const { site } = parsed.data.params;- const { importId } = parsed.data.body;-- const userHasAccess = await getUserHasAccessToSite(request, site);- if (!userHasAccess) {- return reply.status(403).send({ error: "Forbidden" });- }-- const importStatus = await ImportStatusManager.getImportStatus(importId);- if (!importStatus) {- return reply.status(404).send({ error: "Import not found" });- }-- return reply.send({- importId: importStatus.importId,- status: importStatus.status,- progress: {- totalRows: importStatus.totalRows,- processedRows: importStatus.processedRows,- chunksCompleted: importStatus.chunksCompleted,- totalChunks: importStatus.totalChunks,- percentage: importStatus.totalRows- ? Math.round((importStatus.processedRows / importStatus.totalRows) * 100)- : 0,- },- timestamps: {- startedAt: importStatus.startedAt,- completedAt: importStatus.completedAt,- },- error: importStatus.errorMessage,- source: importStatus.source,- fileName: importStatus.fileName,- });- } catch (error) {- console.error("Error fetching import status:", error);- return reply.status(500).send({ error: "Internal server error" });- }-}diff --git a/server/src/index.ts b/server/src/index.tsindex 8d766c9b2..3d5f30f58 100644--- a/server/src/index.ts+++ b/server/src/index.ts@@ -73,7 +73,6 @@ import { importData } from "./api/import/importData.js";import boss from "./lib/boss.js";import { registerCsvParseWorker } from "./workers/csvParseWorker.js";import { registerDataInsertWorker } from "./workers/dataInsertWorker.js";-import { getImportStatus } from "./api/import/getImportStatus.js";import { listSiteImports } from "./api/import/listSiteImports.js";const __filename = fileURLToPath(import.meta.url);@@ -293,7 +292,6 @@ server.get("/api/session-replay/:sessionId/:site", getSessionReplayEvents);// Importsserver.post("/api/import/:organization/:site", importData);-server.post("/api/import-status/:organization/:site", getImportStatus);server.get("/api/list-site-imports/:organization/:site", listSiteImports);// Administrative