-
Notifications
You must be signed in to change notification settings - Fork 731
feat: add query layer (CM-1059) #3942
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
0303ed8
3d6896b
0dfcefb
6ac6f60
0206c9a
748ab15
5da1213
33608e3
7d330df
a1d3713
18f9328
68efd6d
0d03b2c
6f70eae
162abfb
5e7a873
9bd11ca
2a933f8
ed4dc32
ef036f9
c9988c0
a6120bd
45b30e3
da9e76c
3274cdd
e6f6aba
3ac015d
6b1e34c
4662768
e5684b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,64 @@ | ||||||
| import type { Request, Response } from 'express' | ||||||
| import { z } from 'zod' | ||||||
|
|
||||||
| import { | ||||||
| findMembersByGithubHandles, | ||||||
| findVerifiedEmailsByMemberIds, | ||||||
| optionsQx, | ||||||
| resolveAffiliationsByMemberIds, | ||||||
| } from '@crowd/data-access-layer' | ||||||
|
|
||||||
| import { ok } from '@/utils/api' | ||||||
| import { validateOrThrow } from '@/utils/validation' | ||||||
|
|
||||||
| const MAX_HANDLES = 1000 | ||||||
|
|
||||||
| const bodySchema = z.object({ | ||||||
| githubHandles: z | ||||||
| .array(z.string().min(1)) | ||||||
|
||||||
| .array(z.string().min(1)) | |
| .array(z.string().trim().min(1)) |
Copilot
AI
Mar 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Response uses total_found (snake_case) while other public v1 endpoints consistently use camelCase response keys (e.g. projectAffiliations, memberId, workExperiences). Consider renaming this to totalFound (and keeping response casing consistent across this API surface).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Route mount path breaks all existing OAuth2 endpoints
High Severity
Changing the mount path from
'/v1/dev-stats'to'/v1'causesstaticApiKeyMiddlewareto intercept ALL/v1/*requests, not just dev-stats ones. When an OAuth2-authenticated request arrives (e.g.,POST /v1/members), the middleware tries to validate the OAuth2 Bearer token as a static API key, fails, and callsnext(new UnauthorizedError(...)). Express then skips the subsequentoauth2Middlewarelayer entirely and routes the error straight toerrorHandler, returning 401 for all existing OAuth2-protected endpoints. Additionally, the endpoint path becomes/v1/affiliationsinstead of the documented/v1/dev-stats/affiliations.