Giter VIP home page Giter VIP logo

Comments (9)

xang555 avatar xang555 commented on May 25, 2024 3

same problem

from prisma-binding.

gcangussu avatar gcangussu commented on May 25, 2024 2

@kbrandwijk If I do this I get an error saying I didn't make a subselection for the createUser mutation (Field 'createUser' of type 'User' must have a sub selection). I think the info argument from my signupCompany mutation is incompatible with Prisma's createUser.

from prisma-binding.

gcangussu avatar gcangussu commented on May 25, 2024 2

A tool that could allow us to easily take information from the info argument of the resolver would be useful on these cases I think. I thought about something like this:

async function myResolver(parent, args, ctx, info) {
  const userInfo = pluck('user', info);
  const user = await ctx.db.mutation.createUser({ ... }, userInfo);
  return { user };
}

I tried searching for a tool like pluck in my example, but failed to find anything. Then I also started studying the info structure to do it myself, but was overwhelmed by its complexity and couldn't put more time into it.

from prisma-binding.

kbrandwijk avatar kbrandwijk commented on May 25, 2024

I think just passing through the info argument should work, but I haven't looked at your example in detail.

from prisma-binding.

schickling avatar schickling commented on May 25, 2024

We'll look into this! 👀

from prisma-binding.

schickling avatar schickling commented on May 25, 2024

That's an interesting idea @gcangussu. Could you open a new issue for this and elaborate a bit further with a few examples?

from prisma-binding.

mzygmunt avatar mzygmunt commented on May 25, 2024

same

from prisma-binding.

gcangussu avatar gcangussu commented on May 25, 2024

@schickling I've done this on #118. But with only one example, I will try to add other examples later.

from prisma-binding.

maticzav avatar maticzav commented on May 25, 2024

Hey 👋,

guessing the mutations wouldn't make much sense because prisma-binding, even though it serves as a complement to Prisma, isn't tied directly to it in its core implementation.

As @kbrandwijk mentioned, you should find a way to pass down the info parameter. A solution to your problem is implementing AuthPayload which receives the correctly modified info parameter. Check the code I posted below.

const AuthPayload = {
  async user({ user: { id }}, args, ctx: Context, info) {
    return ctx.db.query.user({ where: { id }}, info)
  }
}

Due to inactivity of this issue, I'll close it but feel free to reopen it if you think we should further discuss its content. 🙂

from prisma-binding.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.