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
parent cdf395cc01
commit 5bd57c1b9f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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,