A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!
TypeScript agent-skillsaidsh-pluginhacktoberfestjavascriptmcp-serverreactresume-builderself-hostedtypescript
fix: enforce `hasPassword` to be a boolean
Amruth Pillai2f6a8904e4e4
diff --git a/packages/api/src/dto/resume.test.ts b/packages/api/src/dto/resume.test.tsnew file mode 100644index 000000000..c772ed139--- /dev/null+++ b/packages/api/src/dto/resume.test.ts@@ -0,0 +1,35 @@+import { describe, expect, it } from "vitest";+import { defaultResumeData } from "@reactive-resume/schema/resume/default";+import { redactResumeForViewer } from "../helpers/resume-access-policy";+import { resumeDto } from "./resume";++describe("resume DTO output validation", () => {+ it("accepts public resume responses after owner-only fields are redacted", () => {+ const dbResume = {+ id: "019e128d-0598-75d2-ae6a-771e2eb84614",+ userId: "019bef93-a165-72cb-9c0e-d96e00000000",+ name: "Armed Amaranth Catshark",+ slug: "armed-amaranth-catshark",+ tags: [],+ data: {+ ...defaultResumeData,+ metadata: {+ ...defaultResumeData.metadata,+ notes: "owner-only notes",+ },+ },+ isPublic: true,+ isLocked: false,+ hasPassword: false,+ };++ const publicResume = {+ ...redactResumeForViewer(dbResume, false),+ hasPassword: dbResume.hasPassword,+ };++ expect(publicResume.name).toBe("");+ expect(publicResume.data.metadata.notes).toBe("");+ expect(resumeDto.getBySlug.output.safeParse(publicResume).success).toBe(true);+ });+});diff --git a/packages/api/src/services/resume.ts b/packages/api/src/services/resume.tsindex bf8dc3670..0021686a1 100644--- a/packages/api/src/services/resume.ts+++ b/packages/api/src/services/resume.ts@@ -127,7 +127,7 @@ const analysis = {},};-function toSharedResumeResponse<TPassword extends boolean>(+function toSharedResumeResponse(resume: {id: string;name: string;@@ -137,7 +137,7 @@ function toSharedResumeResponse<TPassword extends boolean>(isPublic: boolean;isLocked: boolean;},- hasPassword: TPassword,+ hasPassword: boolean,) {return {id: resume.id,