getAll: t.procedure
.input(z.object({
filters: z.object({ color: z.string() })
}).nullish())
.query(({ ctx, input }) => {
return ctx.prisma.user.findMany({
where: {
color: input?.filters.color //this works when we do want to filter for a color (red/blue); but when I don't pass down a filter for either red or blue, I want this whole line to gone.
},
});
}),
getAll: t.procedure
.input(z.object({
filters: z.object({ color: z.string() })
}).nullish())
.query(({ ctx, input }) => {
return ctx.prisma.user.findMany({
where: {
color: input?.filters.color //this works when we do want to filter for a color (red/blue); but when I don't pass down a filter for either red or blue, I want this whole line to gone.
},
});
}),