Feature: Implement Atomic Resume Patching API (#2692)

This commit is contained in:
Amruth Pillai
2026-02-08 00:16:11 +01:00
committed by GitHub
parent 5e8e1349bc
commit cc01fb9418
8 changed files with 594 additions and 205 deletions
+26
View File
@@ -1,3 +1,4 @@
import type { Operation } from "fast-json-patch";
import z from "zod";
import { sampleResumeData } from "@/schema/resume/sample";
import { generateRandomName, slugify } from "@/utils/string";
@@ -193,6 +194,31 @@ export const resumeRouter = {
});
}),
patch: protectedProcedure
.route({
method: "PATCH",
path: "/resume/{id}",
tags: ["Resume"],
summary: "Patch a resume",
description:
"Apply JSON Patch (RFC 6902) operations to partially update a resume's data. This allows you to make small, targeted changes without sending the entire resume object.",
})
.input(resumeDto.patch.input)
.output(resumeDto.patch.output)
.errors({
INVALID_PATCH_OPERATIONS: {
message: "The patch operations are invalid or produced an invalid resume.",
status: 400,
},
})
.handler(async ({ context, input }) => {
return await resumeService.patch({
id: input.id,
userId: context.user.id,
operations: input.operations as Operation[],
});
}),
setLocked: protectedProcedure
.route({
method: "POST",