better runtime assertion

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Shaheer Sarfaraz
2026-01-19 19:45:15 +00:00
committed by GitHub
co-authored by Copilot
parent cdf395cc01
commit 5bd57c1b9f
+5 -1
View File
@@ -842,7 +842,11 @@ apiRouter.post('/manual-jobs/import', async (req: Request, res: Response) => {
// Score asynchronously so the import returns immediately.
(async () => {
try {
const profile = (await loadResumeProfile()) as Record<string, unknown>;
const rawProfile = await loadResumeProfile();
if (!rawProfile || typeof rawProfile !== 'object' || Array.isArray(rawProfile)) {
throw new Error('Invalid resume profile format');
}
const profile = rawProfile as Record<string, unknown>;
const { score, reason } = await scoreJobSuitability(createdJob, profile);
await jobsRepo.updateJob(createdJob.id, {
suitabilityScore: score,