const todaysVisits = await db.query.visits.findMany({
where: sql`DATE(${visits.date}) = ${date.format("YYYY-MM-DD")}`,
with: {
job: {
// getting type error here but the data is fetching correctly
where: eq(jobs.company_id, user.privateMetadata.company_id as string),
columns: {
instructions: true,
},
with: {
property: {
columns: {
nick_name: true,
address: true,
},
with: {
client: {
columns: {
full_name: true,
},
},
},
},
},
},
},
})
const todaysVisits = await db.query.visits.findMany({
where: sql`DATE(${visits.date}) = ${date.format("YYYY-MM-DD")}`,
with: {
job: {
// getting type error here but the data is fetching correctly
where: eq(jobs.company_id, user.privateMetadata.company_id as string),
columns: {
instructions: true,
},
with: {
property: {
columns: {
nick_name: true,
address: true,
},
with: {
client: {
columns: {
full_name: true,
},
},
},
},
},
},
},
})