chore: deploy Phase 2A backend to live Supabase project (Task 9)
Substitutes the real admin UID everywhere the placeholder appeared, points the Edge Functions base URL at the deployed project, and adds production JWT verification: trigger functions now send the anon key as a bearer token so verify_jwt can stay enabled instead of leaving the functions open to unauthenticated calls from the public internet. Also adds scripts/create-admin.ts (one-off helper used to create Mira's admin auth user), documents the seed script's non-VITE env vars in .env.example, and closes a gitignore gap where plain .env wasn't excluded alongside .env.local. Claude-Session: https://claude.ai/code/session_01NhxA4npAXAxmCDEJt6kxSH
This commit is contained in:
@@ -81,48 +81,48 @@ alter table public.inquiries enable row level security;
|
||||
create policy "products_public_read" on public.products
|
||||
for select using (true);
|
||||
create policy "products_admin_write" on public.products
|
||||
for all using ((select auth.uid()) = '00000000-0000-0000-0000-000000000001'::uuid)
|
||||
with check ((select auth.uid()) = '00000000-0000-0000-0000-000000000001'::uuid);
|
||||
for all using ((select auth.uid()) = '21c90224-e0b2-412e-a431-8e7f097c1cef'::uuid)
|
||||
with check ((select auth.uid()) = '21c90224-e0b2-412e-a431-8e7f097c1cef'::uuid);
|
||||
|
||||
-- services: public read, admin write
|
||||
create policy "services_public_read" on public.services
|
||||
for select using (true);
|
||||
create policy "services_admin_write" on public.services
|
||||
for all using ((select auth.uid()) = '00000000-0000-0000-0000-000000000001'::uuid)
|
||||
with check ((select auth.uid()) = '00000000-0000-0000-0000-000000000001'::uuid);
|
||||
for all using ((select auth.uid()) = '21c90224-e0b2-412e-a431-8e7f097c1cef'::uuid)
|
||||
with check ((select auth.uid()) = '21c90224-e0b2-412e-a431-8e7f097c1cef'::uuid);
|
||||
|
||||
-- schedule_template: public read, admin write
|
||||
create policy "schedule_template_public_read" on public.schedule_template
|
||||
for select using (true);
|
||||
create policy "schedule_template_admin_write" on public.schedule_template
|
||||
for all using ((select auth.uid()) = '00000000-0000-0000-0000-000000000001'::uuid)
|
||||
with check ((select auth.uid()) = '00000000-0000-0000-0000-000000000001'::uuid);
|
||||
for all using ((select auth.uid()) = '21c90224-e0b2-412e-a431-8e7f097c1cef'::uuid)
|
||||
with check ((select auth.uid()) = '21c90224-e0b2-412e-a431-8e7f097c1cef'::uuid);
|
||||
|
||||
-- schedule_exceptions: public read, admin write
|
||||
create policy "schedule_exceptions_public_read" on public.schedule_exceptions
|
||||
for select using (true);
|
||||
create policy "schedule_exceptions_admin_write" on public.schedule_exceptions
|
||||
for all using ((select auth.uid()) = '00000000-0000-0000-0000-000000000001'::uuid)
|
||||
with check ((select auth.uid()) = '00000000-0000-0000-0000-000000000001'::uuid);
|
||||
for all using ((select auth.uid()) = '21c90224-e0b2-412e-a431-8e7f097c1cef'::uuid)
|
||||
with check ((select auth.uid()) = '21c90224-e0b2-412e-a431-8e7f097c1cef'::uuid);
|
||||
|
||||
-- bookings: anyone can insert (submit a booking); only admin can read/update/delete
|
||||
create policy "bookings_public_insert" on public.bookings
|
||||
for insert with check (true);
|
||||
create policy "bookings_admin_all" on public.bookings
|
||||
for all using ((select auth.uid()) = '00000000-0000-0000-0000-000000000001'::uuid)
|
||||
with check ((select auth.uid()) = '00000000-0000-0000-0000-000000000001'::uuid);
|
||||
for all using ((select auth.uid()) = '21c90224-e0b2-412e-a431-8e7f097c1cef'::uuid)
|
||||
with check ((select auth.uid()) = '21c90224-e0b2-412e-a431-8e7f097c1cef'::uuid);
|
||||
|
||||
-- booked_slots: public read; only admin policy exists for writes (in practice only
|
||||
-- the security-definer trigger in the next migration ever writes here)
|
||||
create policy "booked_slots_public_read" on public.booked_slots
|
||||
for select using (true);
|
||||
create policy "booked_slots_admin_write" on public.booked_slots
|
||||
for all using ((select auth.uid()) = '00000000-0000-0000-0000-000000000001'::uuid)
|
||||
with check ((select auth.uid()) = '00000000-0000-0000-0000-000000000001'::uuid);
|
||||
for all using ((select auth.uid()) = '21c90224-e0b2-412e-a431-8e7f097c1cef'::uuid)
|
||||
with check ((select auth.uid()) = '21c90224-e0b2-412e-a431-8e7f097c1cef'::uuid);
|
||||
|
||||
-- inquiries: anyone can insert; only admin can read/update/delete
|
||||
create policy "inquiries_public_insert" on public.inquiries
|
||||
for insert with check (true);
|
||||
create policy "inquiries_admin_all" on public.inquiries
|
||||
for all using ((select auth.uid()) = '00000000-0000-0000-0000-000000000001'::uuid)
|
||||
with check ((select auth.uid()) = '00000000-0000-0000-0000-000000000001'::uuid);
|
||||
for all using ((select auth.uid()) = '21c90224-e0b2-412e-a431-8e7f097c1cef'::uuid)
|
||||
with check ((select auth.uid()) = '21c90224-e0b2-412e-a431-8e7f097c1cef'::uuid);
|
||||
|
||||
Reference in New Issue
Block a user