Prisma Where Statement with locked presets
Hey,
i am look for a solution for the following Problem:
I have a table that contains courses, i want to create a select function that i give default values to restrict sertain Queries to only see these courses.
function providing the preset:
goal:
usage:
the goal is currently giving we a TS error (picture) on the calling of the validator function.
(possible) SOLUTION:
since this is just a
where
statement the narrowing of the type isnt as neccessary as with select
statements, since Prisma doesn't infer types from where
statements (eg.: where: {deleted_at: null }
still returns type deleted_at: null | Date
) i could just remove the Prisma.validator() part of is.
Is there a known better way of doing that?0 Replies