Skip to content

feat(reports): vendor + admin reports, CSV export, demand forecasting#23

Merged
kashkoool merged 2 commits into
mainfrom
feat/reports-demand
Jun 3, 2026
Merged

feat(reports): vendor + admin reports, CSV export, demand forecasting#23
kashkoool merged 2 commits into
mainfrom
feat/reports-demand

Conversation

@kashkoool

Copy link
Copy Markdown
Owner

What

Reporting + a statistical demand forecast — all SQL-aggregated (no in-memory summing), company-scoped for vendors.

Endpoints

  • Vendor: 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).
  • 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 (weekend / summer / Dec–Jan), with a sample-size-based confidence. No ML dependency.

Safety

CsvWriter is dependency-free with RFC-4180 quoting plus formula-injection defense (neutralizes a leading = + - @) per the check-security skill.

Tests

ReportsTests (Testcontainers): vendor + admin reports reflect a confirmed, paid booking (revenue/seats/occupancy), the CSV export is text/csv with 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).

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.
@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@kashkoool, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9ad9c9c4-a724-4078-af5e-6cf42b31db2c

📥 Commits

Reviewing files that changed from the base of the PR and between a3b6d18 and 1f0754a.

📒 Files selected for processing (8)
  • src/TransportPlatform.Api/Endpoints/AdminEndpoints.cs
  • src/TransportPlatform.Api/Endpoints/VendorEndpoints.cs
  • src/TransportPlatform.Application/Common/CsvWriter.cs
  • src/TransportPlatform.Application/DependencyInjection.cs
  • src/TransportPlatform.Application/Reports/AdminReports.cs
  • src/TransportPlatform.Application/Reports/PredictDemand.cs
  • src/TransportPlatform.Application/Reports/VendorReports.cs
  • tests/TransportPlatform.IntegrationTests/ReportsTests.cs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/reports-demand

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread src/TransportPlatform.Application/Reports/VendorReports.cs Fixed
@kashkoool kashkoool merged commit 274ddae into main Jun 3, 2026
9 checks passed
@kashkoool kashkoool deleted the feat/reports-demand branch June 3, 2026 02:54
kashkoool added a commit that referenced this pull request Jun 3, 2026
…#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants