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
Sturlen2y ago
make sure isTeacher is defined in your Prisma schema
Solution
sheng2808
sheng28082y ago
npx prisma db push, restart your ide, should fix it
sheng2808
sheng28082y ago
probably changed the schema but didnt push properly?
Want results from more Discord servers?
Add your server