refactor: remove any usages and improve type safety in public routes - #653
Conversation
|
@pari7maheshwari is attempting to deploy a commit to the Prashantkumar Khatri's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Hi @pari7maheshwari, Thanks for opening this pull request. This PR has been automatically classified based on the files modified. Applied Labels
Primary Review Area
Reviewer@Harxhit has been identified as the primary reviewer for this pull request. If you have any questions regarding the affected area or implementation details, feel free to reach out to the assigned reviewer. Thank you for your contribution! |
CI — All Checks PassedBackend — PASS
Mobile — SKIP
Web — SKIP
Last updated: |
|
Congratulations @pari7maheshwari on getting PR #653 merged! Thank you for your contribution to the project. To receive the appropriate GSSoC labels and recognition, please mention @Harxhit in the #get-labels channel on our Discord server and share your merged PR link. |
Summary
Closes #553
Removes all
anyusages fromapps/backend/src/routes/public.tsby introducing proper TypeScript types for query parameters and card link response mapping. No runtime behaviour is changed.Type of Change
What Changed
QrQuerystringinterface ({ format?: 'png' | 'svg'; size?: string }) and typed the QR route'sFastifyRequestwithQuerystring: QrQuerystring, replacing two(request.query as any)casts with directrequest.query.formatandrequest.query.sizeaccessCardLinkWithPlatformtype viaPrisma.CardLinkGetPayload<{ include: { platformLink: true } }>, replacing(cl: any)in the/card/:cardIdresponse mapping with a proper generated Prisma typeimport type { Prisma } from '@prisma/client'to support the payload type — reuses the existing generated client, no new dependenciesHow to Test
npm run typecheck --workspaces --if-present— should pass with no new errorsnpm run lint— should passGET /api/u/:username/qr?format=svg&size=300andGET /api/public/card/:cardIdmanually or via existing tests to confirm responses are unchangedChecklist
npm run lintpasses)npm run typecheck --workspaces --if-present)npm run test --workspaces --if-present)console.logor debug statements left in the codeScreenshots / Recordings
Not applicable — refactor only, no UI or API contract changes.
Note for reviewers: Two pre-existing TypeScript errors (
rateLimit does not exist in type FastifyContextConfig, lines 40 and 152) are visible in the Problems panel but were present before this PR and are out of scope for this issue.