(patchId: string, data: Partial<Patch>)
| 81 | }; |
| 82 | |
| 83 | export const updatePatch = async (patchId: string, data: Partial<Patch>) => { |
| 84 | const result = await db |
| 85 | .update(patch) |
| 86 | .set({ |
| 87 | ...data, |
| 88 | ...(data.content && { |
| 89 | content: data.content.endsWith("\n") |
| 90 | ? data.content |
| 91 | : `${data.content}\n`, |
| 92 | }), |
| 93 | updatedAt: new Date().toISOString(), |
| 94 | }) |
| 95 | .where(eq(patch.patchId, patchId)) |
| 96 | .returning(); |
| 97 | |
| 98 | return result[0]; |
| 99 | }; |
| 100 | |
| 101 | export const deletePatch = async (patchId: string) => { |
| 102 | const result = await db |
no outgoing calls
no test coverage detected