In the second instalment of this tutorial (<https:...
# orm-help
m
In the second instalment of this tutorial (https://www.prisma.io/blog/fullstack-nextjs-graphql-prisma-2-fwpc6ds155#pagination), the final step has an instruction to update the resolver to add a results const. I don’t know where to put that const (it doesn’t fit with the resolver file as it is currently setup) and then the code provided for the index.tsx file does not define links. Has anyone figured out how to complete this step of the tutorial? How do I update the resolver and how do I define links in the index.tsx? Thank you.
n
Maybe @Mahmoud can help here 🙂
m
Hey Mel! 👋🏻 Sorry to hear you’re running into an issue in completing the tutorial , do you mind clarifying for me which part is not clear? 😄
Also if you have any future questions you can ping me any time
m
Hi @Mahmoud - thanks so much for this. I love how clearly you break down each step of this tutorial. I’m just stuck at the last step of Part 2. Under the heading “Updating the resolver to return paginated data from the database”, it says I need to add an id to the resolver - but I can’t see where or how to do that. The resolver in part 1 is different to what is in that paragraph. There is a 404 for the link to the part 2 repo, so I can’t check what has been done on github and the part 3 repo doesn’t have a resolver file at all. Then, in the index.tsx file, at the very end, ‘links’ is used but not defined - so I get an error using that code. Where do you define it? Thank you again.
m
Oh so sorry for the confusion! This code block is just a demonstration for what a cursor-based paginated query looks like
Copy code
const results = await prisma.link.findMany({
  take: 4,
  skip: 1,
  cursor: {
    id: myCursor,
  },
})
This is not a file, so that’s why I don’t have a comment at the top indicating the file name
Also this is the end of part-2 branch https://github.com/m-abdelwahab/awesome-links/tree/part-3 I have a single repo where each branch corresponds to the beginning of a part so you can follow along
Also the resolver file is not necessary to make nexus work, this is from the schema-first approach, so you can delete that file
I hope this clears things up a bit, otherwise let me know 😄
m
How did you get part 2 to work without defining links in index.tsx? I copied your part 1 repo and have been following along, but at the end of part 2, i still have a resolver (unused and thanks for the above explanation), but I cant get the code to run or the graphql explorer to work. My error message says: { “Property ‘links’ does not exist on type ‘unknown’. Is there a generator step that I need to run to get it to look inside the allLinksQuery to solve that? thank you again 🙂
m
Heyy, so sorry for the late reply, do you mind sharing a repo so that I can take a look? 😄
m
Hi @Mahmoud - sorry, I just saw this. Sure, what’s you’re github address. I’ll add you now. How are you going with part 3? I’m happy to try the full tutorial, starting from your part 3 repo for that tutorial, to make sure I don’t bring anything redundant along. Maybe that will solve some of the mess I created in part 2 by not starting from your second repo. Thank you again for making this.
m
Hey! so my GitHub is m-abdelwahab. I’m currently on a leave so I’m not actively working on the course at the moment
m
@Mahmoud - enjoy your break. I won’t bother you with questions about the first parts of your tutorial. I’m sure they are mistakes that are made because I continued using the part 1 repo as I worked through part 2. Hope to see your final instalment one day.
🙌 2