Description
Some initial feedback in lieu of a PR.
-
natural-db/supabase/migrations/001_create_initial_schema.sql
Lines 39 to 40 in e6b8f42
natural-db/supabase/functions/natural-db/db-utils.ts
Lines 236 to 237 in e6b8f42
-
natural-db/supabase/migrations/001_create_initial_schema.sql
Lines 45 to 56 in e6b8f42
We should wrapauth.uid()
inselect
as described here. -
natural-db/supabase/migrations/001_create_initial_schema.sql
Lines 78 to 87 in e6b8f42
Did the app break without these? -
JSON.stringify()
would be cleaner here. -
natural-db/supabase/functions/telegram-input/index.ts
Lines 204 to 221 in e6b8f42
Usingzod
to validate & type would be cleaner & more robust. -
Any reason for choosingUUID
as the ID datatype (over integer or bigint)? -
natural-db/supabase/migrations/001_create_initial_schema.sql
Lines 127 to 133 in e6b8f42
Best practice would be to use postgres RLS for this instead of application. You would need to add user_id to this table, or track chats by ID in the DB and associate to a user_id. I didn't see auth checks in the edge function either btw, but might have missed it. -
natural-db/supabase/functions/natural-db/index.ts
Lines 215 to 227 in e6b8f42
I would use zod here too.