better runtime assertion
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
cdf395cc01
commit
5bd57c1b9f
@ -842,7 +842,11 @@ apiRouter.post('/manual-jobs/import', async (req: Request, res: Response) => {
|
|||||||
// Score asynchronously so the import returns immediately.
|
// Score asynchronously so the import returns immediately.
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
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);
|
const { score, reason } = await scoreJobSuitability(createdJob, profile);
|
||||||
await jobsRepo.updateJob(createdJob.id, {
|
await jobsRepo.updateJob(createdJob.id, {
|
||||||
suitabilityScore: score,
|
suitabilityScore: score,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user