MCPcopy Index your code
hub / github.com/Dokploy/dokploy / createPatch

Function createPatch

packages/server/src/services/patch.ts:14–40  ·  view source on GitHub ↗
(input: z.infer<typeof apiCreatePatch>)

Source from the content-addressed store, hash-verified

12export type Patch = typeof patch.$inferSelect;
13
14export const createPatch = async (input: z.infer<typeof apiCreatePatch>) => {
15 if (!input.applicationId && !input.composeId) {
16 throw new TRPCError({
17 code: "BAD_REQUEST",
18 message: "Either applicationId or composeId must be provided",
19 });
20 }
21
22 const newPatch = await db
23 .insert(patch)
24 .values({
25 ...input,
26 content: input.content,
27 enabled: true,
28 })
29 .returning()
30 .then((value) => value[0]);
31
32 if (!newPatch) {
33 throw new TRPCError({
34 code: "BAD_REQUEST",
35 message: "Error creating the patch",
36 });
37 }
38
39 return newPatch;
40};
41
42export const findPatchById = async (patchId: string) => {
43 const result = await db.query.patch.findFirst({

Callers 2

patch.tsFile · 0.90
markPatchForDeletionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected