feat: implement server-side pricing calculation and add site settings management

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
LagoESP
2026-04-29 20:39:21 +02:00
parent b0bea0bef1
commit 3298efe54b
11 changed files with 288 additions and 44 deletions
+32
View File
@@ -0,0 +1,32 @@
-- 09-site-settings.sql
-- Site-wide settings (key-value). Used for configurable assets like hero image.
create table if not exists public.site_settings (
key text primary key,
value text not null default '',
updated_at timestamptz not null default now()
);
alter table public.site_settings enable row level security;
-- Anyone can read settings (public site needs hero image URL)
drop policy if exists "settings_public_read" on public.site_settings;
create policy "settings_public_read"
on public.site_settings for select
using (true);
-- Only authenticated admins can modify
drop policy if exists "settings_admin_all" on public.site_settings;
create policy "settings_admin_all"
on public.site_settings for all to authenticated
using (true) with check (true);
grant select on public.site_settings to anon, authenticated, service_role;
grant all on public.site_settings to authenticated, service_role;
-- Seed default hero image
insert into public.site_settings (key, value)
values ('hero_image_url', '/images/ferrari-main-car.png')
on conflict (key) do nothing;
notify pgrst, 'reload schema';