Skip to content

[DD-42927] new REST endpoint to retrieve the list of hearing and associated cases for a given date#223

Merged
natrajmolala merged 10 commits into
mainfrom
dev/dd-42927
Jul 20, 2026
Merged

[DD-42927] new REST endpoint to retrieve the list of hearing and associated cases for a given date#223
natrajmolala merged 10 commits into
mainfrom
dev/dd-42927

Conversation

@natrajmolala

@natrajmolala natrajmolala commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

New endpoint: GET /hearing-cases-for-day?date=yyyy-MM-dd

  • Returns hearings + their prosecution cases for a given date, restricted to System Users (RBAC rule added in hearing-query-api.drl).

Key changes:

  • HearingQueryApi.findHearingCasesForDay — new handler for hearing.get.hearing-cases-for-day, requires a logged-in user in System Users group.
  • HearingQueryView.findHearingCasesForDay — parses the date param and delegates to HearingService.
  • HearingService.getHearingCasesForDay(LocalDate) — new method: fetches hearings for the date, filters out ones with no prosecution cases, maps each via new GetHearingCaseTransformer.
  • GetHearingCaseTransformer (new class) — builds HearingCases (hearingId, courtCentreId, courtRoomId, hearingDate, prosecutionCases), with logic to exclude group-proceeding members unless they're the group
    master.
  • HearingJPAMapper.fromJPAMinimal (new) — lightweight JPA→domain mapping (id, hearing days, court centre, prosecution cases only).
  • HearingRepository.findHearings(LocalDate) (new overload) — native SQL query joining ha_hearing/ha_hearing_day, excluding cancelled days, box hearings, and vacated trials.
  • RAML (hearing-query-api.raml) — new /hearing-cases-for-day GET resource with date query param, plus example/schema JSON files.
  • Tests added/updated: HearingQueryApiTest, HearingQueryTest, GetHearingCaseTransformerTest (new), HearingServiceTest, HearingRepositoryTest, and an integration test
    HearingForTodayIT.shouldRetrieveHearingCasesForDayForSystemUser.
  • Added FeatureControlGuard so the endpoint can be controlled via a feature flag.

@natrajmolala
natrajmolala requested a review from a team as a code owner July 13, 2026 08:58
@natrajmolala
natrajmolala requested review from JakeM-Kainos, mkarakaya55 and vikram-moj and removed request for a team July 13, 2026 08:58
@cpp-github-management

Copy link
Copy Markdown

Failed

1 similar comment
@cpp-github-management

Copy link
Copy Markdown

Failed

@cpp-github-management

Copy link
Copy Markdown

Passed

@cpp-github-management

Copy link
Copy Markdown

Passed

1 similar comment
@cpp-github-management

Copy link
Copy Markdown

Passed

return null;
}

private boolean shouldCaseBeIncluded(final Hearing hearing, final ProsecutionCase pc) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@natrajmolala check with Simon if cases belonging to group proceedings (assuming these are civil) should not be included for our use case..

@ServiceComponent(QUERY_VIEW)
private Requester requester;

@Inject

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@natrajmolala this needs to be at the API layer and should throw AccessControlException.. see existing patterns.. we should not let this request go through even if its only returning empty list..

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! moved FeatureControlGuard to api layer and throw AccessControlViolationError (403) when not enabled

public abstract List<Hearing> findHearings(@QueryParam("date") final LocalDate date,
@QueryParam("courtCentreId") final UUID courtCentreId);

@Query(value = "select h.*" +

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@natrajmolala not good with SQL queries.. i am hoping you have double checked this and go claude's approval as well.. do run this past Satish as well

@cpp-github-management

Copy link
Copy Markdown

Passed

2 similar comments
@cpp-github-management

Copy link
Copy Markdown

Passed

@cpp-github-management

Copy link
Copy Markdown

Passed

@cpp-github-management

Copy link
Copy Markdown

Failed

@cpp-github-management

Copy link
Copy Markdown

Passed

@natrajmolala
natrajmolala merged commit 42c0a93 into main Jul 20, 2026
3 checks passed
@natrajmolala
natrajmolala deleted the dev/dd-42927 branch July 20, 2026 16:52
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.

3 participants