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.

fix: foreign key constraint error, & sort skill by jobs

Khuram Niaza661603796a7
diff --git a/src/actions/tag.actions.ts b/src/actions/tag.actions.ts
index 9a7fdf8..a5595b1 100644
--- a/src/actions/tag.actions.ts
+++ b/src/actions/tag.actions.ts
@@ -43,7 +43,7 @@ export const getTagList = async (
value: true,
_count: { select: { jobs: true, questions: true } },
},
- orderBy: { label: "asc" },
+ orderBy: { jobs: { _count: "desc" } },
}),
prisma.tag.count({ where: { createdBy: user.id } }),
]);
diff --git a/src/lib/utils.ts b/src/lib/utils.ts
index 7385674..b965057 100644
--- a/src/lib/utils.ts
+++ b/src/lib/utils.ts
@@ -43,6 +43,13 @@ export function handleError(error: unknown, msg = "Server Error.") {
error.message =
"Fetch failed, please make sure selected AI service is running.";
}
+ if ("code" in error && (error as any).code === "P2003") {
+ return {
+ success: false,
+ message:
+ "Your session appears invalid. Please sign out and sign back in.",
+ };
+ }
return { success: false, message: error.message || msg };
}
}