Skip to content

How to use args in t.relation with prisma plugin #997

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

You must be logged in to vote

I think something like this should work for you

builder.prismaObject("Project", {
  select: { id: true },
  fields: (t) => ({
    tasks: t.relation("tasks", {
      args: paginationArgs,
      query: (args) => ({
        skip: args.pageSize * (args.page - 1),
        take: args.pageSize,
      }),
    }),
  }),
});

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by khuongtp
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