My logs
# orm-help
c
My logs
n
can you share the according resolver implementation?
c
Copy code
const resolvers = {
  Query: {
    publishedPosts(root, args, context) {
      return context.prisma.posts({ where: { published: true } })
    },
    post(root, args, context) {
      return <http://context.prisma.post|context.prisma.post>({ id: args.postId })
    },
    postsByUser(root, args, context) {
      return context.prisma.user({
        id: args.userId
      }).posts()
    }
  },
  Mutation: {
    createDraft(root, args, context) {
      return context.prisma.createPost(
        {
          data: {
            title: args.title,
            author: {
              connect: { id: args.userId }
            }
          },
        },

      )
    },
    publish(root, args, context) {
      return context.prisma.updatePost(
        {
          where: { id: args.postId },
          data: { published: true },
        },

      )
    },
    createUser(root, args, context) {
      return context.prisma.createUser(
        { name: args.name },
      )
    }
  },
  User: {
    posts(root, args, context) {
      return context.prisma.user({
        id: root.id
      }).posts()
    }
  },
  Post: {
    author(root, args, context) {
      return <http://context.prisma.post|context.prisma.post>({
        id: root.id
      }).author()
    }
  }
}
n
Interesting, can you share the
createDraft
mutation from your schema? 🙂 Please exclude other mutations or queries, it just makes it harder to find.
c
Hi nilan, in the example of the documentation does not appear
createDraft
n
hm, but it is a resolver in your schema!
to be clear, I am talking about your schema, not your data model 🙂
c
Copy code
type Mutation {
  createUser(name: String!): User
  createDraft(title: String!, userId: ID!): Post
  publish(postId: ID!): Post
}
I misunderstood xd
👍 1
n
Hmm ok, everything looks good from here 🤔 could you please share the problem in a new issue so we can take a closer look into this as soon as possible? 🙂 You can do so here: https://github.com/prisma/prisma/issues/new?template=documentation.md
c
okay, it's sound great, my firts issue.
🦜 1
😍 1
n
thanks for reporting that 🙏
💯 1