Dayne
Dayne
WWasp-lang
Created by Dayne on 12/23/2023 in #đŸ™‹questions
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]
}
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,
},
});
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!!!
5 replies
WWasp-lang
Created by Dayne on 12/23/2023 in #đŸ™‹questions
[SOLVED] Using Decimal type with Prisma
I am trying to store dollar amounts and it seems Decimal is the type to go with. However, when I use it wasp it crashing on Type 'Decimal' is not assignable to type 'SuperJSONValue'. I am not sure if this is a wasp or maybe the superJson package. Any suggestions or a different type to use for this? đŸ¤”
15 replies
WWasp-lang
Created by Dayne on 12/23/2023 in #đŸ™‹questions
[SOLVED] Separate queries & actions to multiple files?
Anyone have success on splitting queries.ts and actions.ts into multiple files and import? I have tried and it errors on importing for me. I would love to be able to split these out just for readability đŸ™‚
7 replies
WWasp-lang
Created by Dayne on 12/21/2023 in #đŸ™‹questions
[SOLVED] Help with auth vs unauth routing...
Hi! đŸ‘‹ Anyone have techniques or ideas on setting up routing within the main.wasp to handle unauth routes vs auth routes if I want all auth to be prefixed with /app and redirect there if logged in? I know there is a rootComponent config but that applies to all. My idea was to have all the logged in app under /app and the landing pages to be /.
4 replies