Skip to content

Migrating from Prisma+Nexus to Prisma+Pothos #511

Answered by hayes
baconcheese113 asked this question in Q&A
Discussion options

You must be logged in to vote

All Query entrypoints require an Auth token, so all prismaObjects should be using my IAuthContext instead of the IContext. Before I would just cast the context to IAuthContext in the resolvers, but it seems like there's a better way if I use ScopeAuth. So I tried this:

If all entrypoints guarantee a user, you can use just make your auth context the default context:

export const builder = new SchemaBuilder<{
    Context: IAuthContext;
    AuthScopes: { loggedIn: boolean }
}>({...})

The plugin isn't currently changing the context type automatically for fields of a type that have defined scopes. To change the context based on scopes you need to use either the t.authField method, or the t.w…

Replies: 1 comment 12 replies

Comment options

You must be logged in to vote
12 replies
@hayes
Comment options

@hayes
Comment options

@hayes
Comment options

@baconcheese113
Comment options

@hayes
Comment options

Answer selected by baconcheese113
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants