Function
updatePost
(
postId: string,
data: { title?: string; content?: string },
)
Source from the content-addressed store, hash-verified
| 3 | |
| 4 | // PATCH /api/post/:id |
| 5 | async 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 |
| 21 | async function deletePost(postId: string) { |
Tested by
no test coverage detected