Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

Add auth to export route

Khuram Niaz8a4a530a11ef
diff --git a/src/app/api/jobs/export/route.ts b/src/app/api/jobs/export/route.ts
index 04dc2f6..1f0da79 100644
--- a/src/app/api/jobs/export/route.ts
+++ b/src/app/api/jobs/export/route.ts
@@ -3,6 +3,7 @@ import Papa from "papaparse";
import { PassThrough } from "node:stream";
import { getJobsIterator } from "@/actions/job.actions";
import { format } from "date-fns";
+import { auth } from "@/auth";
const FIELDS: string[] = [
"index",
@@ -57,6 +58,11 @@ const transformJobData = (
};
export const POST = async () => {
+ const session = await auth();
+ if (!session) {
+ return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
+ }
+
const passThrough = new PassThrough();
let isFirstChunk = true;
let hasError = false;