const results = await db.query.assignments.findMany({
where: (assignments, { eq: localEq }) =>
localEq(assignments.assignedTo, candidateId),
limit,
offset,
columns: {
id: true,
startsAt: true,
},
with: {
assessment: {
where: (assessments, { lt }) => lt(assessments.createdAt, new Date()), // <--- the error is here
columns: {
id: true,
title: true,
timeLimit: true,
},
},
assigner: {
columns: {
name: true,
},
},
},
extras: {
totalRecords: db
.$count(assignments, eq(assignments.assignedTo, candidateId))
.as("total_records"),
},
});
const results = await db.query.assignments.findMany({
where: (assignments, { eq: localEq }) =>
localEq(assignments.assignedTo, candidateId),
limit,
offset,
columns: {
id: true,
startsAt: true,
},
with: {
assessment: {
where: (assessments, { lt }) => lt(assessments.createdAt, new Date()), // <--- the error is here
columns: {
id: true,
title: true,
timeLimit: true,
},
},
assigner: {
columns: {
name: true,
},
},
},
extras: {
totalRecords: db
.$count(assignments, eq(assignments.assignedTo, candidateId))
.as("total_records"),
},
});