Skip to content
Discussion options

You must be logged in to vote

As it turns out, all I had to do was create a User object type and export it just like I did with the Animal.ts file.
I guess I was worrying for no reason

//User.ts

import { extendType, objectType, nonNull } from "nexus";
import { Animal } from "./Animal";

export const User = objectType({
  name: "User",
  definition(t: any) {
    t.string("id"),
      t.string("name"),
      t.string("image"),
      t.string("email"),
      t.list.field("favoriteAnimals", {
        type: Animal,
        async resolve(parent: any, _args: any, context: any) {
          return await context.prisma.user
            .findUnique({
              where: {
                id: parent.id,
              },
        …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by EricPezzulo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
question Ask how to do something or how something works
1 participant
Converted from issue

This discussion was converted from issue #3975 on February 14, 2022 19:12.