Skip to content

Commit 770ccec

Browse files
committed
fix: page are query aprams
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
1 parent 38da586 commit 770ccec

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

backend/src/api/public/v1/dev-stats/getAffiliations.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,16 @@ const bodySchema = z.object({
1919
.array(z.string().min(1))
2020
.min(1)
2121
.max(MAX_HANDLES, `Maximum ${MAX_HANDLES} handles per request`),
22-
page: z.number().int().min(1).default(1),
23-
pageSize: z.number().int().min(1).max(MAX_HANDLES).default(DEFAULT_PAGE_SIZE),
22+
})
23+
24+
const querySchema = z.object({
25+
page: z.coerce.number().int().min(1).default(1),
26+
pageSize: z.coerce.number().int().min(1).max(MAX_HANDLES).default(DEFAULT_PAGE_SIZE),
2427
})
2528

2629
export async function getAffiliations(req: Request, res: Response): Promise<void> {
27-
const { githubHandles, page, pageSize } = validateOrThrow(bodySchema, req.body)
30+
const { githubHandles } = validateOrThrow(bodySchema, req.body)
31+
const { page, pageSize } = validateOrThrow(querySchema, req.query)
2832
const qx = optionsQx(req)
2933

3034
const lowercasedHandles = githubHandles.map((h) => h.toLowerCase())

0 commit comments

Comments
 (0)