Context entities in a query

First steps in Wasp-lang coming from PHP

Trying to get to know Wasp-lang I'm working on a job list, where users can post jobs. So in entity Job i have userId and User as relation.

Passing the user entity with the job in the getJobs query
query getJobs {
fn: import { getJobs } from "@src/server/queries.js",
entities: [Job, User]
}

I tried to inlcude the user but I'm not sure how I can use this in a result. I can show the job.userId but not the related user object for example user.username.

export const getJobs: GetJobs<void, Job[]> = async (args, context) => {
return context.entities.Job.findMany({

orderBy: { id: 'asc' },
include: {
user: true,
}
})
Screenshot_2024-05-14_220257.png
Screenshot_2024-05-14_215859.png
Was this page helpful?