Conversation
There was a problem hiding this comment.
Pull request overview
The PR's stated goal is to bypass the Google account picker on sign-in by removing the prompt: "select_account" parameter and adding an hd: "andrew.cmu.edu" hosted-domain hint to the OIDC authorization URL. However, it also includes a sizable set of unrelated changes: a new QueryUtils.getReportsAfter query helper, a refactor of the /v2/locations/:locationId/reports endpoint to use it with a 1-day window, a new reportCount field on the locations API response, a new pnpm-workspace.yaml, and pure formatting churn in auth.ts (trailing commas).
Changes:
- Replace
prompt: "select_account"withhd: "andrew.cmu.edu"in the OIDC auth URL. - Add
QueryUtils.getReportsAfter, wire it into the reports endpoint and intogetAllLocationsFromDBto expose a newreportCountper location. - Add a
pnpm-workspace.yamlworkspace config and apply formatting tweaks acrossauth.ts.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| src/endpoints/auth.ts | Core PR change: swap prompt: "select_account" for hd: "andrew.cmu.edu"; otherwise formatting-only edits. |
| src/endpoints/reviews.ts | Refactor /v2/locations/:locationId/reports to use QueryUtils.getReportsAfter with a 1-day window; leaves several unused imports. |
| src/db/dbQueryUtils.ts | New getReportsAfter(start_time, for_location_id?) helper using gt + optional eq filter on reportsTable. |
| src/db/getLocations.ts | Fetch reports since timeSearchCutoff, aggregate by location, attach reportCount to each location object. |
| pnpm-workspace.yaml | New pnpm workspace file declaring packages: [.] and strictDepBuilds: false. |
Comments suppressed due to low confidence (1)
src/endpoints/reviews.ts:154
- The endpoint's response schema (lines 145–154) declares
createdAt: t.Date(), butgetReportsAfterreturns rows fromreportsTabledirectly, which typically yields a JSDatefrom drizzle but serializes over HTTP as an ISO string or number depending on the schema column type. Please double‑check that thereportsTable.createdAtcolumn type produces a value compatible witht.Date()(Elysia validates outgoing payloads), otherwise responses may fail validation at runtime. Note the other endpoint above usescreatedAt: t.Number()for review timestamps — confirm the inconsistency is intentional.
response: t.Array(
t.Object({
id: t.Number(),
userId: t.Nullable(t.Number()),
createdAt: t.Date(),
locationId: t.String(),
message: t.String()
})
)
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||
Also adds report data on both the primary
v2/locationsendpoint and a new endpoint for fetching the reports of a single location