Previously (as in, last year), I was using somethi...
# orm-help
d
Previously (as in, last year), I was using something like this in a query:
Copy code
favourites: (_, { id }, context: Context, info) => {
    return context.prisma.query.user(
      {
        where: {
          id
        }
      },
      `
      {
        id
        favourites {
          id
          name
        }
      }
      `
    )
  },
I see that now, you’d instead use `context.prisma.user(...) but there’s no way of defining exactly what you want back. Is this intentional?
n
Yes, this is due to the switch from Prisma bindings to the Prisma client. The main reason for that was to get a simpler API and full type-safety (which wasn't possible when using schema delegation with the
info
object). You can read more about client vs bindings here: https://www.prisma.io/forum/t/help-understanding-prisma-clients-value-proposition/4394/17?u=nikolas 🙂
d
Hi, Nikolas. Thanks for the reply. I’ll take a look… 🙂
n
The biggest change now is how to resolve relations as they're not being resolved automagically any more. If you're not using nexus-prisma, you need to write explicit "type-resolvers" to resolve relations. There's some info on it here: https://www.prisma.io/tutorials/a-guide-to-common-resolver-patterns-ct08/#scenario:-implementing-relations-with-prisma-client
d
I see. I’ll read up on that. Thanks for your time. Have a good day. 🙂
🙌 1