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