WaspW
Wasp2y ago
Dayne

Update return entity type

Didn't find this in the docs or through questions here.

I want typescript to respect the return type that has foreign relationships returned. For example, I have this query:
query getAllInventory {
  fn: import { getAllInventory } from "@server/queries.js",
  entities: [Inventory]
}

But it is selecting some related tables:
  const inventory = await context.entities.Inventory.findMany({
    where: {
      userId: context.user?.id,
    },
    include: {
      category: true,
      subcategory: true,
      store: true,
      partner: true,
      refund: true,
    },
  });

Is there a way to update it so that when I access this return type on the frontend I get typescript completion for the included tables? I can't seem to find a way to do this from the main.wasp file.

Thanks!!!
Was this page helpful?