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.

refactor(resumeImport): replace direct resume ownership check with assertResumeOwnership for improved code clarity

Khuram Niaz40e248e830e0
diff --git a/src/actions/resumeImport.actions.ts b/src/actions/resumeImport.actions.ts
index 4e7d0da..1ab05b1 100644
--- a/src/actions/resumeImport.actions.ts
+++ b/src/actions/resumeImport.actions.ts
@@ -4,8 +4,8 @@
// each card type's save logic lives in its own module, with parseImportDate,
// wrapAsHtml and getOrCreateResumeSection shared across them via ./resumeImport/shared.
-import prisma from "@/lib/db";
import { requireUser } from "./shared";
+import { assertResumeOwnership } from "./profile/shared";
import { handleError } from "@/lib/utils";
import {
ImportContactInfo,
@@ -39,13 +39,7 @@ export async function resolveImportCard(
): Promise<ResolveResult> {
try {
const user = await requireUser();
-
- // Verify resume ownership
- const owned = await prisma.resume.findUnique({
- where: { id: resumeId, profile: { userId: user.id } },
- select: { id: true },
- });
- if (!owned) throw new Error("Resume not found or access denied");
+ await assertResumeOwnership(resumeId, user.id);
switch (card.type) {
case "contactInfo":