mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-07-25 17:34:52 +10:00
Feature: Implement Atomic Resume Patching API (#2692)
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user