Page Introduction

Page contract details

This contract page maps concrete frontend page behavior to API calls, payloads, and response fields.

  • Use the endpoint matrix as implementation checklist.
  • Use page-specific try-it for fast request verification.
  • Keep request/response shape aligned with listed frontend usage fields.

Platform Page Contract

09 - Reports

## Page purpose Rapportsiden (`/dashboard/reports`) shows KPI-overview, kategorioppdeling, rating-trend og eksportflyt.

6Mapped endpoints
1Frontend files
32Lines
2.0 KBFile size

Source: API-DOC/page-api-mapping/09-rapporter.md

Mapped endpoints for this page

MethodPathScopeUI usageTest
GET/api/ws/reports/overviewPage-specificKPI-dataTry-It
GET/api/ws/reports/services/by-categoryPage-specificTabell per kategoriTry-It
GET/api/ws/reports/ratings/timeseriesPage-specificRating-trendTry-It
POST/api/ws/v2/reports/exportsPage-specific (kanonisk export)Create async eksportjobbTry-It
GET/api/ws/v2/reports/exports/:job_idPage-specific (kanonisk export)Polling av jobbstatusTry-It
GET/api/ws/v2/reports/exports/:job_id/downloadPage-specific (kanonisk export)NedlastingTry-It
GET/api/ws/reports/overview

Scope: Page-specific

UI usage: KPI-data

Response fields used: jobs.done_in_range, jobs.revenue_in_range, services.total, ratings.avg, ratings.count

GET/api/ws/reports/services/by-category

Scope: Page-specific

UI usage: Tabell per kategori

Response fields used: items[].category, items[].count

GET/api/ws/reports/ratings/timeseries

Scope: Page-specific

UI usage: Rating-trend

Response fields used: points[].period, points[].count, points[].avg

POST/api/ws/v2/reports/exports

Scope: Page-specific (kanonisk export)

UI usage: Create async eksportjobb

Response fields used: job_id, status, created_at, estimated_completion

GET/api/ws/v2/reports/exports/:job_id

Scope: Page-specific (kanonisk export)

UI usage: Polling av jobbstatus

Response fields used: status, progress, download_url, error

GET/api/ws/v2/reports/exports/:job_id/download

Scope: Page-specific (kanonisk export)

UI usage: Nedlasting

Response fields used: blob + filnavn

Try this page endpoints

Interactive console below is filtered to endpoints mapped for this page contract.

Source markdown

09 - Reports

Page purpose

Rapportsiden (/dashboard/reports) shows KPI-overview, kategorioppdeling, rating-trend og eksportflyt.

Frontend methods and components

  • src/app/(private)/dashboard/reports/page.tsx
    • getWorkshopOverviewReport(...)
    • getWorkshopServicesByCategory(...)
    • getWorkshopRatingsTimeseries(...)
    • createReportExportJob(...)
    • getReportExportJobStatus(...)
    • downloadReportExportJob(...)

Endpoint matrix

Scope Method Endpoint UI usage Request Response fields used by frontend
Page-specific GET /api/ws/reports/overview KPI-data date_from, date_to jobs.done_in_range, jobs.revenue_in_range, services.total, ratings.avg, ratings.count
Page-specific GET /api/ws/reports/services/by-category Tabell per kategori date_from, date_to items[].category, items[].count
Page-specific GET /api/ws/reports/ratings/timeseries Rating-trend date_from, date_to, group=month points[].period, points[].count, points[].avg
Page-specific (kanonisk export) POST /api/ws/v2/reports/exports Create async eksportjobb { type, format, filters } job_id, status, created_at, estimated_completion
Page-specific (kanonisk export) GET /api/ws/v2/reports/exports/{job_id} Polling av jobbstatus path job_id status, progress, download_url, error
Page-specific (kanonisk export) GET /api/ws/v2/reports/exports/{job_id}/download Nedlasting path job_id blob + filnavn

Contract status

  • Frontend er migrert til async v2-eksport for alle typer (ratings, services, bookings, revenue).
  • Legacy sync eksport (/api/ws/reports/export) brukes ikke i ny flyt.

What frontend expects from backend

  • Konsistent dato-filterkontrakt (date_from, date_to) på alle rapport-endepunkter.
  • Stabil jobbstatusmodell (pending, processing, completed, failed, expired, cancelled).