I have TRPC question/problem

This works fine
getUser: publicProcedure
.input(z.object({ id: z.string()}))
.query(({ ctx ,input }) => {
const user = ctx.prisma.user.findUnique({
where:{
id:input.id,
}
})

return user
}),
getUser: publicProcedure
.input(z.object({ id: z.string()}))
.query(({ ctx ,input }) => {
const user = ctx.prisma.user.findUnique({
where:{
id:input.id,
}
})

return user
}),
But when I add
select:{
id:true,
image: true,
isTeacher: true,
classes: true,
name: true,
admin: true
}
select:{
id:true,
image: true,
isTeacher: true,
classes: true,
name: true,
admin: true
}
but all fields are valid
Solution:
npx prisma db push, restart your ide, should fix it
Jump to solution
3 Replies
Sturlen
Sturlen3y ago
make sure isTeacher is defined in your Prisma schema
Solution
-
-3y ago
npx prisma db push, restart your ide, should fix it
-
-3y ago
probably changed the schema but didnt push properly?

Did you find this page helpful?