mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-07-13 22:37:14 +10:00
fix(api): allow empty name in public resume output schema (#3012)
The redactResumeForViewer helper intentionally blanks the dashboard title for non-owner viewers (the title can leak owner-only context like "Senior Eng @ Foo - final draft"), but the getBySlug output schema inherits name.min(1) from resumeSchema. Zod rejects the redacted payload, oRPC throws Output validation failed, and every public resume URL returns HTTP 500. Relax the constraint to z.string() on the getBySlug output only - ownership-gated procedures (getById, update, patch, list, ...) keep min(1). Fixes #3011 Co-authored-by: Amruth Pillai <im.amruth@gmail.com>
This commit is contained in:
@@ -39,7 +39,13 @@ export const resumeDto = {
|
||||
|
||||
getBySlug: {
|
||||
input: z.object({ username: z.string(), slug: z.string() }),
|
||||
output: resumeSchema.omit({ password: true, userId: true, createdAt: true, updatedAt: true }),
|
||||
// `name` is the owner-chosen dashboard title and is intentionally redacted
|
||||
// to an empty string for non-owner viewers (see redactResumeForViewer in
|
||||
// helpers/resume-access-policy.ts). Relax the `min(1)` constraint here so
|
||||
// the redacted public response passes output validation.
|
||||
output: resumeSchema
|
||||
.omit({ name: true, password: true, userId: true, createdAt: true, updatedAt: true })
|
||||
.extend({ name: z.string() }),
|
||||
},
|
||||
|
||||
create: {
|
||||
|
||||
Reference in New Issue
Block a user