I have some connected relations that I can't help ...
# orm-help
w
I have some connected relations that I can't help but feel there is a better way to query:
User -in-> Organization -has_many-> Skus
At the moment I am doing:
Copy code
let inventory = await prisma.user
    .findUnique({ where: { id } })
    .organization()
    .skus({
      where: {
        product: {
          ...(name && { name: { contains: name, mode: "insensitive" } }),
        },
      },
      select: {
        id: true,
        organization: true,
        condition: true,
        language: true,
        binLocation: true,
        inventoryEntries: true,
        product: {
          select: { uuid: true, identifiers: true, name: true },
        },
      },
    });
is there a way to do it from:
prisma.sku.findMany()
or am I needlessly worried?
r
@William Stanley 👋 This query seems fine. Are you facing any issues?