Handleiding voor Admins
Admins hebben toegang tot alle modules. Gebruik deze rechten verantwoord — alle acties worden gelogd.
1. Toegang
- Log in op fitfix.nl/admin.
- Toegang vereist rol admin in
user_roles(server-side viahas_role()functie).
2. Admin Dashboard
Het dashboard bevat secties:
- Orders — alle aanvragen, filter op status.
- Users — klanten, monteurs, planners, business clients.
- Kennisbank — artikelen en SEO.
- Service Agent — AI chatbot kennisbeheer.
- Content Agent — automatische content-generatie.
- Search Analytics — wat klanten zoeken.
- Invoices — facturatie & Exact Online sync.
3. User Management
- Tab Users: zoek op e-mail of naam.
- Wijs rollen toe via
user_roles(admin, planner, monteur, business_user). - Nooit rollen opslaan op de profiles-tabel — gebruik altijd
user_roles.
4. Klantdata verwijderen (AVG)
Bij verwijderverzoek: verwijder in deze volgorde i.v.m. foreign keys:
plannersrecordsinvoicesordersprofiles+ auth user
Gebruik de GDPR-delete edge function voor automatisering.
5. Kennisbank beheren
- Tab Kennisbank: maak/edit artikelen met markdown.
- Upload service-manuals: ze worden automatisch geknipt in chunks van 1500 chars en geëmbedded.
- Firecrawl-integratie: importeer externe bronnen (zoals Sportsmith) via URL.
6. AI Service Agent
- Tab Service Agent → Kennisbank.
- Voeg FAQ's, snippets en producten toe.
- Test de chatbot in de preview-modus voordat je live gaat.
- Rate limit: 10 vragen/uur per IP voor publieke endpoints.
7. AI Content Agent
- Automatische generator voor kennisbank-artikelen (wekelijks).
- Sitemap wordt automatisch geüpdatet.
- Bekijk logs in tab Content Agent.
8. Facturatie
- Tab Invoices:
- Status per factuur (concept, verstuurd, betaald).
- Knop Sync naar Exact Online.
- Handmatige betaalherinneringen verzenden via edge function.
- Idempotentie: facturen worden nooit dubbel aangemaakt (pre-check op
invoices.order_id). - Nummering loopt synchroon met Exact Online (RPC
next_invoice_number).
9. Stripe & Betalingen
- Stripe is single source of truth voor betaalstatus (alleen via webhook).
- Nooit handmatig
paid_atzetten in de database. - Idempotency: één order = één
stripe_session_id(409 conflict bij dubbel).
10. Servicecontracten
- Tab Contracten: zie alle lopende contracten met einddatum.
- Verlenging: knop Verleng stuurt automatisch een nieuw acceptatieverzoek.
11. Security
- Tab Security (in Cloud-paneel):
- Run security scan wekelijks.
- Los vulnerabilities op via RLS-policies of bucket-instellingen.
- Vereiste configuratie:
- OTP expiry ≤ 300s.
- Leaked Password Protection aan.
- Roles altijd valideren via
has_role(), nooit client-side.
12. Database wijzigingen
- Data (rijen): direct via SQL queries.
- Schema (tabellen, kolommen, RLS): altijd via migrations.
- Nooit generated columns updaten in client payloads.
13. Edge Functions
- Gepind op Deno
std@0.224.0en@supabase-js@2.45.0. - CORS-headers moeten
x-supabase-*includen. - Cron jobs: hardcoded Bearer tokens in
pg_cron(vault niet beschikbaar in cron-context).
14. Analytics & SEO
- Tab Search Analytics: top zoekwoorden klanten.
- SEO & AI search view (in Cloud-paneel) voor sitemaps, robots.txt, JSON-LD.
- 145+ flat routes worden automatisch in sitemap opgenomen.
15. Marketplace beheer
- Configureer claim-timer, 3-strike-drempel en matching-weights.
- Bekijk suspended monteurs in tab Monteurs → Geschorst.
16. Cron Jobs
Actieve cron jobs:
- Abandoned cart reminders — 3 stappen.
- Maintenance reminders — 6 maanden na laatste service.
- Newsletter digest — wekelijks.
- Content agent — wekelijks.
18. Incident response
- Check Edge Function logs in Supabase dashboard.
- Check Stripe webhook logs voor betaalproblemen.
- Roll back via migrations indien schema-wijziging de oorzaak is.
- Communiceer status via statuspagina.
19. AI-laag overzicht (Unified Engine)
Alle AI-features draaien op één centrale FitFix AI-laag: een unified engine die FAQs, RAG-chunks uit manuals en reparatiehistorie samenvoegt tot één doorzoekbare kennisbron.
Actieve AI-features per rol:
| Rol | Feature | Endpoint / Tab |
|------|---------|----------------|
| Klant | AI-diagnose chat | ai-diagnose-chat edge function |
| Klant | AI-zoek shop | shop-search edge function |
| Zakelijk | Predictief onderhoud | generate-business-maintenance-predictions |
| Zakelijk | Ticket triage | trigger op orders insert |
| Planner | Routeoptimalisatie | optimize-route edge function |
| Planner | Matching engine | marketplace-match edge function |
| Monteur | Reparatie Copilot | repair-copilot edge function |
| Monteur | Diagnose Assistent | ai-diagnose-assistant |
| Monteur | Spraak-naar-werkbon | voice-to-workorder |
| Admin | Service Agent | tab Service Agent |
| Admin | Content Agent | tab Content Agent (cron, wekelijks) |
Beheer (tab AI Kennisbeheer):
- Upload service-manuals → automatisch gechunkt op 1500 tekens en geëmbedded.
- Firecrawl-integratie voor externe bronnen.
- Per chunk: bekijk embedding-status, hertrain knop, zichtbaarheid toggle.
Rate limits & kosten:
- Publieke AI-endpoints: 10 req/uur per IP, server-side gecontroleerd.
- Authenticated endpoints (monteur/portal): geen hard limit, wel monitoring per gebruiker.
- Kosten zichtbaar in tab AI → Usage (tokens en € per dag/maand).
Governance & veiligheid:
- Alle AI-output is suggestie, nooit autoritatief — gebruiker eindverantwoordelijk.
- Geen PII in prompts (filter actief).
- Audit log van alle AI-calls in tabel
ai_audit_log. - Bij modelwissel: A/B-test verplicht via tab AI → Experiments.
20. Contact
- Lead developer — intern.
- Supabase support — voor infra-issues.