MCPcopy Create free account
hub / github.com/prisma/prisma-examples / createDraft

Function createDraft

orm/grpc/server/server.ts:75–90  ·  view source on GitHub ↗
(call: any, callback: any)

Source from the content-addressed store, hash-verified

73}
74
75async function createDraft(call: any, callback: any) {
76 const { title, content, authorEmail } = call.request
77 try {
78 const newDraft = await prisma.post.create({
79 data: {
80 title,
81 content,
82 published: false,
83 author: { connect: { email: authorEmail } },
84 },
85 })
86 callback(null, newDraft)
87 } catch (e) {
88 callback(e, null)
89 }
90}
91
92async function deletePost(call: any, callback: any) {
93 const { id } = call.request

Callers 1

DraftFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected