You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm wondering how to make a validator for a custom query. For example, I have a function that pulls from three tables using inner joins, but find myself needing to write a validator manually and making sure it matches close enough to my database. I believe the answer is making a function that will return a drizzle query, running a createInsertSchema on that object, then be able to execute that object elsewhere to get the results.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm wondering how to make a validator for a custom query. For example, I have a function that pulls from three tables using inner joins, but find myself needing to write a validator manually and making sure it matches close enough to my database. I believe the answer is making a function that will return a drizzle query, running a createInsertSchema on that object, then be able to execute that object elsewhere to get the results.
Maybe something like this
Now I have both the
updateNoteSchema
, which gives me a zod/etc... schema, as well as, agetNote
function that will return the note I request.Beta Was this translation helpful? Give feedback.
All reactions