Hvad jeg mangler 📝
Klik på en opgave for at tjekke den af. Dine afkrydsninger gemmes lokalt i denne browser.
Færdiggjort
6/27 (22%)
Supabase status
product_images
Tjekker…
products felter
Tjekker…
ordre-tabeller
Tjekker…
product-images bucket
Tjekker…
Login-test
Kontrolleret logout/login med maks. én refresh i denne browser-session.
Klar til kontrolleret logout/login-test.
Refresh-status: Ingen refresh kørt
Stripe & betaling
Email-system (ordrebekræftelser)
Database & ordrer
Levering & forsendelse (Pakke.dk)
Produkter & billeder
Sikkerhed & juridisk
Sociale medier & marketing
SQL der skal køres i Supabase
Kopier dette og kør i Supabase → SQL Editor. Det opretter ordre-tabeller, ekstra produktbilleder, lagerstyring og gør storage-bucket'en public.
-- ===== KUNDENS KØBSHISTORIK =====
create table if not exists public.orders (
id uuid primary key default gen_random_uuid(),
user_id uuid references auth.users(id) on delete set null,
stripe_session_id text unique,
customer_name text,
customer_email text,
customer_phone text,
shipping_method text,
shipping_address text,
pakkeshop_name text,
pakkeshop_address text,
pakkeshop_carrier text,
amount_total numeric not null default 0,
currency text default 'DKK',
status text not null default 'paid',
created_at timestamptz not null default now()
);
alter table public.orders enable row level security;
create policy "Users can read own orders"
on public.orders for select
using (auth.uid() = user_id);
create policy "Admins can read all orders"
on public.orders for select
using (public.has_role(auth.uid(), 'admin'));
create table if not exists public.order_items (
id uuid primary key default gen_random_uuid(),
order_id uuid not null references public.orders(id) on delete cascade,
product_id uuid references public.products(id) on delete set null,
name text not null,
price numeric not null,
qty int not null,
image_url text
);
alter table public.order_items enable row level security;
create policy "Users can read own order items"
on public.order_items for select
using (
exists (select 1 from public.orders o
where o.id = order_id and o.user_id = auth.uid())
);
create policy "Admins can read all order items"
on public.order_items for select
using (public.has_role(auth.uid(), 'admin'));
-- ===== FLERE BILLEDER PR. PRODUKT =====
create table if not exists public.product_images (
id uuid primary key default gen_random_uuid(),
product_id uuid not null references public.products(id) on delete cascade,
url text not null,
sort_order int not null default 0,
created_at timestamptz not null default now()
);
-- Hvis tabellen fandtes i forvejen uden de rigtige felter:
alter table public.product_images
add column if not exists product_id uuid references public.products(id) on delete cascade,
add column if not exists url text,
add column if not exists sort_order int default 0,
add column if not exists created_at timestamptz not null default now();
alter table public.product_images enable row level security;
create policy "Anyone can read product images"
on public.product_images for select using (true);
create policy "Admins can manage product images"
on public.product_images for all
using (public.has_role(auth.uid(), 'admin'))
with check (public.has_role(auth.uid(), 'admin'));
create index if not exists product_images_product_id_idx
on public.product_images(product_id);
-- ===== LAGERSTYRING =====
-- Tilføj 'stock' (antal på lager). NULL = ubegrænset / ikke tracket.
alter table public.products
add column if not exists stock integer;
-- ===== STORAGE BUCKET (kør i Supabase → Storage → eller SQL) =====
-- Hvis billeder ikke vises i butikken: bucket'en skal være PUBLIC.
update storage.buckets set public = true where id = 'product-images';
