MCPcopy
hub / github.com/vercel/next.js / updatePost

Function updatePost

examples/with-edgedb/pages/api/post/[id].ts:5–18  ·  view source on GitHub ↗
(
  postId: string,
  data: { title?: string; content?: string },
)

Source from the content-addressed store, hash-verified

3
4// PATCH /api/post/:id
5async function updatePost(
6 postId: string,
7 data: { title?: string; content?: string },
8) {
9 return await e
10 .update(e.Post, (post) => ({
11 filter: e.op(post.id, "=", e.uuid(postId)),
12 set: {
13 title: data.title,
14 content: data.content,
15 },
16 }))
17 .run(client);
18}
19
20// DELETE /api/post/:id
21async function deletePost(postId: string) {

Callers 1

handleFunction · 0.85

Calls 3

uuidMethod · 0.80
runMethod · 0.65
updateMethod · 0.45

Tested by

no test coverage detected