Fix for level 1 being added to skills (#73)

* single commit fix!

* fix tests!
This commit is contained in:
Shaheer Sarfaraz 2026-01-31 23:20:05 +00:00 committed by GitHub
parent 65952259ce
commit b02dac5fe8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -243,7 +243,7 @@ describe("PDF Service Skills Validation", () => {
expect(newSkill.description).toBe(""); expect(newSkill.description).toBe("");
// Optional but good to check // Optional but good to check
expect(newSkill.id).toBeDefined(); expect(newSkill.id).toBeDefined();
expect(newSkill.level).toBe(1); expect(newSkill.level).toBe(0);
// Check "Existing Skill" - should preserve existing fields if not overwritten? // Check "Existing Skill" - should preserve existing fields if not overwritten?
// In the implementation, we look up existing. // In the implementation, we look up existing.

View File

@ -117,8 +117,8 @@ export async function generatePdf(
const { email, password, baseUrl } = await getCredentials(); const { email, password, baseUrl } = await getCredentials();
const client = new RxResumeClient(baseUrl); const client = new RxResumeClient(baseUrl);
// Read base resume from profile (fetches from v4 API if configured) // Read base resume from profile (fetches from v4 API if configured, force fetch)
const baseResume = JSON.parse(JSON.stringify(await getProfile())); const baseResume = JSON.parse(JSON.stringify(await getProfile(true)));
// Sanitize skills: Ensure all skills have required schema fields (visible, description, id, level, keywords) // Sanitize skills: Ensure all skills have required schema fields (visible, description, id, level, keywords)
// This fixes issues where the base JSON uses a shorthand format (missing required fields) // This fixes issues where the base JSON uses a shorthand format (missing required fields)
@ -193,7 +193,7 @@ export async function generatePdf(
level: level:
newSkill.level !== undefined newSkill.level !== undefined
? (newSkill.level as number) ? (newSkill.level as number)
: ((existing?.level as number | undefined) ?? 1), : ((existing?.level as number | undefined) ?? 0),
keywords: keywords:
(newSkill.keywords as string[]) || (newSkill.keywords as string[]) ||
(existing?.keywords as string[]) || (existing?.keywords as string[]) ||