Skip to content

refactor: remove any usages and improve type safety in public routes#653

Open
pari7maheshwari wants to merge 1 commit into
Dev-Card:mainfrom
pari7maheshwari:fix/remove-any-public-routes
Open

refactor: remove any usages and improve type safety in public routes#653
pari7maheshwari wants to merge 1 commit into
Dev-Card:mainfrom
pari7maheshwari:fix/remove-any-public-routes

Conversation

@pari7maheshwari

Copy link
Copy Markdown
Contributor

Summary

Closes #553

Removes all any usages from apps/backend/src/routes/public.ts by introducing proper TypeScript types for query parameters and card link response mapping. No runtime behaviour is changed.


Type of Change

  • Bug fix
  • New feature
  • Refactor (no functional change)
  • UI / Design change
  • Tests only
  • Documentation
  • Infrastructure / DevOps
  • Security

What Changed

  • Added QrQuerystring interface ({ format?: 'png' | 'svg'; size?: string }) and typed the QR route's FastifyRequest with Querystring: QrQuerystring, replacing two (request.query as any) casts with direct request.query.format and request.query.size access
  • Added CardLinkWithPlatform type via Prisma.CardLinkGetPayload<{ include: { platformLink: true } }>, replacing (cl: any) in the /card/:cardId response mapping with a proper generated Prisma type
  • Added import type { Prisma } from '@prisma/client' to support the payload type — reuses the existing generated client, no new dependencies

How to Test

  1. Run npm run typecheck --workspaces --if-present — should pass with no new errors
  2. Run npm run lint — should pass
  3. Hit GET /api/u/:username/qr?format=svg&size=300 and GET /api/public/card/:cardId manually or via existing tests to confirm responses are unchanged

Checklist

  • My code follows the project's coding style (npm run lint passes)
  • TypeScript compiles without errors (npm run typecheck --workspaces --if-present)
  • I have added or updated tests for the changes I made
  • All tests pass locally (npm run test --workspaces --if-present)
  • No new console.log or debug statements left in the code
  • Breaking changes are documented in this PR description

Screenshots / 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.

@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

@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.

@github-actions github-actions Bot added backend gssoc:approved Required label for every approved PR. Gives the base +50 points and enables contribution tracking. labels Jun 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hi @pari7maheshwari,

Thanks for opening this pull request.

This PR has been automatically classified based on the files modified.

Applied Labels

  • gssoc:approved
  • backend

Primary Review Area

  • backend

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!

@github-actions

Copy link
Copy Markdown
Contributor

CI — All Checks Passed

Backend — PASS

Check Result
Lint PASS
Test PASS
Typecheck PASS

Mobile — SKIP

Check Result
Lint -
Test -

Web — SKIP

Check Result
Build -

Last updated: Tue, 30 Jun 2026 19:55:35 GMT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend gssoc:approved Required label for every approved PR. Gives the base +50 points and enables contribution tracking.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve Type Safety in public.ts and Remove Remaining any Usage

1 participant