does prisma provide any default method to handle t...
# orm-help
a
does prisma provide any default method to handle this? I am directly filtering the products array which is not optimized at all.
Copy code
async productsByKeyword(_, { keyword }) {
    const products = await prisma.product.findMany({
      orderBy: { createdAt: 'desc' },
    });

    const lowerCasedKeyword = keyword.toLowerCase();

    const filteredProducts = products.filter((product) =>
      product.title.toLowerCase().includes(lowerCasedKeyword)
    );

    return filteredProducts;
  },
r
I use a
titleSearch
column and on insert my object looks like:
Copy code
{
   title: input.title,
   titleSearch: input.title.toLowerSring(),
   ...
}
then I query on that