typegraphql-prisma
emits the generated TypeGraphQL classes to node_modules/@generated/typegraphql-prisma
whenever npx prisma generate
is invoked.
It also generates a number of model classes, enums as well CRUD and relation resolver based on your schema.prisma
file. The generated CRUD resolvers match the operations of the Prisma Client API:
create
update
delete
findUnique
findFirst
findMany
updateMany
deleteMany
upsert
aggregate
groupBy
Below are example operations that you can send to the API using the GraphQL Playground. You can explore other operations in the Docs section of the GraphQL Playground.
Feel free to adjust any operation by adding or removing fields. The GraphQL Playground helps you with its auto-completion and query validation features.
query {
posts {
id
title
content
published
author {
id
name
email
}
}
}
See more API operations
mutation {
createUser(data: {
name: "Sarah",
email: "[email protected]"
}
) {
id
}
}
mutation {
createPost(
data: {
title: "Join the Prisma Slack",
content: "https://slack.prisma.io"
author: {
connect: {
email: "[email protected]"
}
}
}
) {
id
published
}
}
mutation {
updatePost(data: { published: { set: true } }, where: { id: __POST_ID__ }){
id
published
}
}
Note: You need to replace the
__POST_ID__
-placeholder with an actualid
from aPost
item. You can find one e.g. using thefilterPosts
-query.
{
posts(
where: {
OR: { content: { contains: "graphql" }, title: { contains: "graphql" } }
}
) {
id
title
content
published
author {
id
name
email
}
}
}
{
post(where: { id: __POST_ID__ }) {
id
title
content
published
author {
id
name
email
}
}
}
Note: You need to replace the
__POST_ID__
-placeholder with an actualid
from aPost
item. You can find one e.g. using thefilterPosts
-query.
mutation{
deletePost(where:{id: __POST_ID__}){
id
}
}
Note: You need to replace the
__POST_ID__
-placeholder with an actualid
from aPost
item. You can find one e.g. using thefilterPosts
-query.