graphql-nexus / nexus

Code-First, Type-Safe, GraphQL Schema Construction
https://nexusjs.org
MIT License
3.4k stars 275 forks source link

How to 'alias' when removing nexus-plugin-prisma for 'vanilla nexus' #1014

Open matt-paul opened 2 years ago

matt-paul commented 2 years ago

Hello. Firstly, thanks for your work on this.

I am following this guide for removing nexus-plugin-prisma, to use 'vanilla nexus'.

However, i'm struggling to replicate the following.

t.model.id({ alias: 'databaseId' });

Can anyone enlighten me please?

Context: Relay expects 'id' to be globally unique, so I need to alias the id of the record coming back from prisma/database.

PatrykWalach commented 2 years ago
t.nonNull.id('databaseId' { resolve: ({ id }) => id });