Skip to content

Conversation

@theosiemensrhodes
Copy link
Collaborator

Summary

This branch introduces a complete Coverage Requests page and the reusable filter-bar system it depends on.

Main Features

The new /coverage route is now fully wired end-to-end. On the frontend, coverage requests are loaded in an infinite, day-grouped list with a contextual aside that supports selection and next/previous navigation. Each request shows key shift/request metadata, and the aside exposes action controls (Take Shift / Withdraw) with confirmation flows.

To support this, the branch adds src/components/ui/filter-bar.tsx as a generic, query-param-backed filtering primitive. Coverage uses this to power tab state plus class/date filters, and keeps filter state in the URL so views are shareable and restorable.

On the backend, coverage list APIs were expanded to accept date and class constraints, and the service now applies those filters when querying requests. The class API also now exposes a lightweight names endpoint used by the coverage filter UI.

Data Model / Migration

Coverage requests now store requestedAt in the database (requested_at), with a migration that backfills existing rows and enforces non-null going forward. This timestamp is propagated through model/service responses and surfaced in coverage list + aside UI.

Additional Notes

This branch also includes a handful of unrelated cleanups/fixes outside the core coverage work (styling/lint refactors and a password reset field binding fix), but the primary scope is the coverage page + filter framework + supporting API/data changes.

@theosiemensrhodes theosiemensrhodes linked an issue Feb 10, 2026 that may be closed by this pull request
@greptile-apps
Copy link

greptile-apps bot commented Feb 10, 2026

Greptile Overview

Greptile Summary

This PR adds a new authorized /coverage route with an infinite, day-grouped coverage requests list and an interactive aside (selection + next/prev + take/withdraw flows). To support that UI, it introduces a reusable, URL-query-backed filter-bar component and hooks/utilities to keep coverage tab/filter state shareable and restorable.

On the backend it extends the coverage list API/service to accept date bounds and course/class constraints, and adds a lightweight class.names endpoint to populate the class filter. The data model is updated to store requestedAt (requested_at) for coverage requests, including a migration that backfills existing rows and enforces non-null going forward.

Blocking issues are primarily around filter semantics (tab date bounds being overridden by explicit date range), API ordering changes (coverage list sort flipped to ascending), and authorization/data scoping for the new class names endpoint.

Confidence Score: 2/5

  • This PR should not be merged until a few correctness/authz issues are addressed.
  • Two functional regressions are clear in the diff: (1) coverage tab date bounds are overwritten by the date-range filter, breaking tab semantics; (2) coverage list ordering flipped from descending to ascending, which can break pagination/UX assumptions. Additionally, class.names exposes global class enumeration behind a weaker permission than existing class endpoints. Fixing these should make the rest of the changes safe to merge.
  • src/components/coverage/filters/utils.ts, src/server/services/entity/coverageService.ts, src/server/api/routers/class-router.ts, src/server/services/entity/classService.ts

Important Files Changed

Filename Overview
src/app/(authorized)/coverage/page.tsx Wires /coverage page to new coverage list + filters; no blocking issues found.
src/components/coverage/filters/utils.ts Builds backend filter input from tab+UI filters; BUG: dateRange overrides tab bounds, breaking tab semantics.
src/components/ui/filter-bar.tsx Adds reusable query-param-backed filter bar primitive; no blocking issues found.
src/server/api/routers/class-router.ts Adds class.names endpoint; BUG: permission uses coverage:view while returning all class names (enumeration).
src/server/db/migrations/0004_add_requested_at_to_coverage_request.sql Adds requested_at column with backfill and NOT NULL constraint; looks correct.
src/server/services/cacheService.ts Large cache service refactor/cleanup; no specific blocking issue identified in review.
src/server/services/entity/classService.ts Adds getClassNames used by class.names endpoint; returns all courses without scoping (problem combined with router permission).
src/server/services/entity/coverageService.ts Adds from/to/course filtering for coverage list; BUG: sort order changed to ascending which may break pagination/UX expectations.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

8 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link

greptile-apps bot commented Feb 10, 2026

Additional Comments (1)

src/server/services/entity/coverageService.ts
Sort order regression
This changes list ordering from desc(shift.startAt), desc(coverageRequest.id) to ascending orderBy(shift.startAt, coverageRequest.id) (line 188). That will flip pagination and the UI’s “most recent/urgent first” behavior if callers assume descending. If chronological oldest-first is intended, make sure the frontend pagination/infinite list and any tests/UX expectations are updated accordingly; otherwise restore the desc(...) ordering.

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.

Add the coverage page

3 participants