Skip to content

I am new to pothos and graphql. i have some problems related to query. #1078

Discussion options

You must be logged in to vote

i finally find and answer for my problem.

builder.queryField("order_items", (t) =>
  t.prismaField({
    type: ["order_items"], // Assuming "Product" is the name of your product model
    args: { user_id: t.arg.string() },
    resolve: async (query, _parent, args, _ctx, _info) => {
      const { user_id } = args;
      return await prisma.order_items.findMany({
        ...query,
        where: {
          user_id: {
            contains: user_id? user_id : "",
            mode: "insensitive", // This makes the search case-insensitive
          },
        },
      });
    },
  })
);

Replies: 1 comment 2 replies

Comment options

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

hayes Nov 1, 2023
Maintainer

@MinhNguyen5199
Comment options

Answer selected by hayes
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