feat(reports): vendor + admin reports, CSV export, demand forecasting#23
Conversation
Reporting and a statistical demand forecast — all SQL-aggregated (no in-memory summing), company-scoped for vendors. - Vendor: GET /api/vendor/reports/summary (trips, confirmed bookings, seats sold, revenue from completed payments, occupancy %), /reports/trips (per-trip rows), and /reports/trips/export (CSV download). - Admin: GET /api/admin/reports/summary (platform-wide companies/active/trips/ confirmed-bookings/revenue). - Demand: GET /api/vendor/demand/predict?origin&destination&date — forecasts seats from the company's last-90-days history (day-of-week baseline × recent-vs-earlier trend × seasonal factor), with a sample-size-based confidence. No ML dependency. - CsvWriter: dependency-free, RFC-4180 quoting + formula-injection defense (neutralizes a leading = + - @) per the security skill. 53 unit + 32 integration green (reports reflect a confirmed paid booking; CSV is text/csv with the data; demand returns a well-formed forecast); 0 warnings. Note: XLSX/PDF exports and a frontend reporting dashboard are follow-ups; this PR delivers the data + CSV via the API.
|
Warning Review limit reached
More reviews will be available in 11 minutes and 56 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…#45) Completes the dashboards against the analytics + sales backend (#23/#37/#40) and the admin notify/reports endpoints: - Vendor Reports: date-range financial/occupancy summary cards, per-trip table, CSV/XLSX/PDF download, and a demand-forecast widget. - Vendor Promo: list + create (percent/fixed, caps, expiry) + deactivate. - Vendor Desk: counter cash booking (trip + customer + passengers) and a company-bookings list with cancel/refund — reachable by managers AND staff (the vendor nav now shows only the Desk to staff). - Admin: per-company in-app Notify composer, plus a platform overview page (companies/trips/bookings/revenue) behind a new admin nav. Frontend only. ng build + ng lint clean.
What
Reporting + a statistical demand forecast — all SQL-aggregated (no in-memory summing), company-scoped for vendors.
Endpoints
GET /api/vendor/reports/summary(trips, confirmed bookings, seats sold, revenue from completed payments, occupancy %),/reports/trips(per-trip rows),/reports/trips/export(CSV download).GET /api/admin/reports/summary(platform-wide companies / active / trips / confirmed bookings / revenue).GET /api/vendor/demand/predict?origin&destination&date— forecasts seats from the company's last-90-days history: day-of-week baseline × recent-vs-earlier trend × seasonal factor (weekend / summer / Dec–Jan), with a sample-size-based confidence. No ML dependency.Safety
CsvWriteris dependency-free with RFC-4180 quoting plus formula-injection defense (neutralizes a leading=+-@) per thecheck-securityskill.Tests
ReportsTests(Testcontainers): vendor + admin reports reflect a confirmed, paid booking (revenue/seats/occupancy), the CSV export istext/csvwith the data, and the demand endpoint returns a well-formed forecast. 53 unit + 32 integration green; 0 warnings.Note
XLSX/PDF exports and a frontend reporting dashboard are follow-ups; this PR delivers the data + CSV via the API.
Part of the phased roadmap (indexes ✅ → Google OAuth ✅ → staff ✅ → payments ✅ → notifications/real-time ✅ → reports/demand → observability).