Need help with joined tables
Hi,
I have some relations in my data schema. I have the type "questionnaire" which is linked to an entity called project:
In mein queries.ts I made this query:
Now the problem (see second screenshot): when I iterate over this array, IDE says that there is an issue with the type.
I am not even sure if its an WASP issue or a simple TS/React thing where I fail to solve.
Thank you for your help
I have some relations in my data schema. I have the type "questionnaire" which is linked to an entity called project:
That works fine in the database as I can observe in the db studio.entity Questionnaire {=psl id String @id @default(uuid()) ... project Project? @relation(fields: [projectId], references: [id]) projectId Int? ... psl=}
In mein queries.ts I made this query:
That also works fine. In a console log, I perfectly see my project object as part of my questionnaire array. (see screenshot)export const getQuestionnaires: GetQuestionnaires<void, Questionnaire[]> = async (_args, context) => { if (!context.user) { throw new HttpError(401); } return context.entities.Questionnaire.findMany({ where: { userId: context.user.id }, **include: { project: true,** }, orderBy: { createdAt: 'desc', }, }); };
Now the problem (see second screenshot): when I iterate over this array, IDE says that there is an issue with the type.
I am not even sure if its an WASP issue or a simple TS/React thing where I fail to solve.
Thank you for your help




