feat(reporting): functional advanced reporting endpoints - #80
Merged
Conversation
… endpoints Wire AdvancedReportingService's static math helpers to real data: add JPQL aggregation queries on TicketRepository and SatisfactionRatingRepository, new report-building service methods that feed those datasets through the existing percentile/composite-score/date-series/period-change helpers, JSON report DTOs, and an admin-secured AdminReportController exposing per-report endpoints (overview, SLA, first-response time, resolution time, CSAT, volume, agent performance, period comparison). Tests: a @DataJpaTest asserting each report is correct over seeded tickets, and an end-to-end MockMvc test driving the real controller/service/repositories over a seeded database.
mpge
added a commit
that referenced
this pull request
Aug 2, 2026
… endpoints (#80) Wire AdvancedReportingService's static math helpers to real data: add JPQL aggregation queries on TicketRepository and SatisfactionRatingRepository, new report-building service methods that feed those datasets through the existing percentile/composite-score/date-series/period-change helpers, JSON report DTOs, and an admin-secured AdminReportController exposing per-report endpoints (overview, SLA, first-response time, resolution time, CSAT, volume, agent performance, period comparison). Tests: a @DataJpaTest asserting each report is correct over seeded tickets, and an end-to-end MockMvc test driving the real controller/service/repositories over a seeded database. Co-authored-by: Matt Gros <mpge@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AdvancedReportingServicepreviously contained only static percentile / composite-score / date-series math helpers — no data access and no HTTP surface, so no analytics could actually be retrieved. This PR makes advanced reporting functional and reachable by adding the missing layers around those helpers, mirroring the report surface of the Laravel host (ReportingService+Admin\ReportController).What was added
TicketRepository: created/resolved counts (countCreatedSince,countResolvedSince,*Between), grouped counts (countByStatusSince,countByPrioritySince,countByChannelSince), timing projections (firstResponseTimings,resolutionTimings,createdAtSince), SLA counts (countWithSlaSince,countFirstResponseBreaches,countResolutionBreaches,countSlaBreaches,countSla*ByPriority), and per-agent aggregates (agentTicketCounts,agentFirstResponseTimings). A sharedSLA_BREACH_PREDICATEconstant keeps the breach logic in one place.SatisfactionRatingRepository:avgRatingSince,countRatingsSince,countByRatingSince,ratingRowsSince,avgRatingByAgentSince.AdvancedReportingService(now a@Service) that pipe those datasets through the existing math helpers —calculatePercentiles,compositeScore,dateSeries,calculateChangesare all reused. The static helpers are untouched (their unit tests still pass).dev.escalated.dto.reporting, snake_case via@JsonProperty).AdminReportControllerat/escalated/api/admin/reports/*, admin-secured by the existing/escalated/api/**token filter chain like every other admin controller.Endpoints
GET /escalated/api/admin/reports/overviewGET /escalated/api/admin/reports/slaGET /escalated/api/admin/reports/first-response-timeGET /escalated/api/admin/reports/resolution-timeGET /escalated/api/admin/reports/csatGET /escalated/api/admin/reports/volumeGET /escalated/api/admin/reports/agent-performanceGET /escalated/api/admin/reports/period-comparisonAll take an optional
daysparam (default 30).Tests (TDD, run locally with
./gradlew check— green)AdvancedReportingServiceDbTest(@DataJpaTest): seeds a deterministic set of tickets/ratings and asserts each report's exact numbers (counts, avg hours, p50, SLA breach counts, composite ranking).AdminReportControllerTest: drives the real controller → service → repositories over a seeded H2 database through MockMvc, asserting each endpoint returns a populated JSON report.No regressions; full
check(all tests + checkstyle) passes.