Skip to content
Discussion options

You must be logged in to vote

I currently have a base file like so:

base.ts

import { schema } from 'nexus'

// base Query type, extended in schemas as needed
schema.queryType({
  definition: () => {},
})

// base Mutation type, extended in schemas as needed
schema.mutationType({
  definition: () => {},
})

then in all my other files I have:

User.ts

schema.extendType({
  type: 'Query',
  definition: (t) => {
    t.field('me', {
      type: 'User',
      nullable: true,
      resolve: async (_parent, _args, { db, userId }) => {
        return await db.user.findOne({ where: { id: userId } })
      },
    })
  },
})

schema.extendType({
  type: 'Mutation',
  definition: (t) => {
    t.field('updateUser', {
      type: 'U…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@greywolvesco
Comment options

Comment options

You must be logged in to vote
2 replies
@greywolvesco
Comment options

@Weakky
Comment options

Answer selected by Weakky
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants