how can I validate what the user is sending the server? I'm currently using nextjs with client side code to write to the db. I'm using Yup for client-side validation, but I'm not sure how to do serverside validation with supabase.
n
Needle
03/22/2022, 12:58 AM
Hello @Lukas!
This thread has been automatically created from your message in #843999948717555735 a ``few seconds ago``.
Pinging @User so that they see this as well!
Want to unsubscribe from this thread?
Right-click the thread in Discord (or use the ... menu) and select Leave Thread to unsubscribe from future updates.
Want to change the title?
Use the
/title
command!
We have solved your problem?
Click the button below to archive it.
g
garyaustin
03/22/2022, 1:05 AM
The Postgres database has a concept called column constraints that you can apply to insure data inserted meets your conditions. You should still validate at the client level for friendliness in my opinion and use data base constraints for critical checks.
Technical detail: https://www.postgresql.org/docs/14/ddl-constraints.html
Edit: I guess to be complete you can also do some checking in RLS on insert/update or write a postgres function with all kinds of checks and call it with an rpc call with all the data to insert....
n
Needle
03/22/2022, 1:05 AM
Lukas (2022-03-22)
l
Lukas
03/22/2022, 5:59 AM
is there any documentation on how I can accomplish that (your edit I mean)? Also it would be nice if supbabase had a regex check where the db query would error if it doesn't match teh regex to make it super simple for people