Skip to content

refactor(auth): replace any-cast authenticate fallback with typed appauthenticate decorator in cards, event, and nfc routes#626

Merged
Harxhit merged 7 commits into
Dev-Card:mainfrom
yachikadev:fix/auth-cleanup-554
Jun 23, 2026
Merged

refactor(auth): replace any-cast authenticate fallback with typed appauthenticate decorator in cards, event, and nfc routes#626
Harxhit merged 7 commits into
Dev-Card:mainfrom
yachikadev:fix/auth-cleanup-554

Conversation

@yachikadev

Copy link
Copy Markdown
Contributor

Summary
Replaces all (app as any).authenticate fallback chains with properly
typed preHandler — same pattern established in for team.ts.

Changes
cards.ts — auth cleanup
connect.ts — auth cleanup
event.ts — auth cleanup + fixed TS generic types on route methods
nfc.ts — auth cleanup + removed unused imports
Test Results
tsc --noEmit — 0 errors
eslint — 0 errors, 0 warnings
Tests — 69/69 passed
Closes #594

….authenticate decorator in cards, event, and nfc routes (closes Dev-Card#594)
@vercel

vercel Bot commented Jun 21, 2026

Copy link
Copy Markdown

@yachikadev 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 21, 2026
@github-actions

Copy link
Copy Markdown

Hi @yachikadev,

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

github-actions Bot commented Jun 21, 2026

Copy link
Copy Markdown

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, 23 Jun 2026 07:16:49 GMT

Signed-off-by: Yachika Sharma <shakuntalaramphalsharma@gmail.com>
@yachikadev

Copy link
Copy Markdown
Contributor Author

@Harxhit,
the CI failure is due to @devcard/shared module not found error
which appears to be a pre-existing infrastructure issue unrelated to
my changes. Could you please check?

Signed-off-by: Yachika Sharma <shakuntalaramphalsharma@gmail.com>
Signed-off-by: Yachika Sharma <shakuntalaramphalsharma@gmail.com>
Signed-off-by: Yachika Sharma <shakuntalaramphalsharma@gmail.com>
@Harxhit

Harxhit commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

@Harxhit, the CI failure is due to @devcard/shared module not found error which appears to be a pre-existing infrastructure issue unrelated to my changes. Could you please check?

We have addressed it in our recent merge.

@yachikadev

Copy link
Copy Markdown
Contributor Author

CI failure note — pre-existing, unrelated to this PR
The backend-ci / typecheck failure here (cards.ts(111,7) — TS2741: Property 'links' is missing in type ... but required in type 'CardResponse') is not introduced by this PR's changes.
This is a pre-existing type mismatch in cardRoutes → updateCard, where the value returned by cardService.updateCard() doesn't satisfy the CardResponse type's links field. I encountered the identical error in PR #632 as well, on an unrelated set of changes, which confirms it's broken on main independent of either PR.

@Harxhit

Harxhit commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

CI failure note — pre-existing, unrelated to this PR
The backend-ci / typecheck failure here (cards.ts(111,7) — TS2741: Property 'links' is missing in type ... but required in type 'CardResponse') is not introduced by this PR's changes.
This is a pre-existing type mismatch in cardRoutes → updateCard, where the value returned by cardService.updateCard() doesn't satisfy the CardResponse type's links field. I encountered the identical error in PR #632 as well, on an unrelated set of changes, which confirms it's broken on main independent of either PR.

We have addressed it in recent merge

Signed-off-by: Yachika Sharma <shakuntalaramphalsharma@gmail.com>
@yachikadev

Copy link
Copy Markdown
Contributor Author

@Harxhit All CI checks are passing now. Could you please review when you get a chance?

@Harxhit

Harxhit commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Fix merge conflicts and pin me please .

Signed-off-by: Yachika Sharma <shakuntalaramphalsharma@gmail.com>
@yachikadev

Copy link
Copy Markdown
Contributor Author

@Harxhit done

@Harxhit Harxhit left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Approving

Comment thread apps/backend/src/routes/cards.ts Outdated
import { createCardSchema ,updateCardSchema, addPlatformLinkSchema} from '../validations/card.validation';

import type { CardResponse, UpdateCardBody, UpdatedCardResponse } from '../services/cardService';
import type { CardResponse, UpdateCardBody } from '../services/cardService';

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you removed the type ```UpatedCardResponse``?

@Harxhit Harxhit merged commit 5f60290 into Dev-Card:main Jun 23, 2026
5 of 6 checks passed
@github-actions

Copy link
Copy Markdown

Congratulations @yachikadev on getting PR #626 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.

ShantKhatri pushed a commit to ShantKhatri/DevCard that referenced this pull request Jun 23, 2026
…authenticate decorator in cards, event, and nfc routes (Dev-Card#626)

* refactor(auth): replace any-cast authenticate fallback with typed app.authenticate decorator in cards, event, and nfc routes (closes Dev-Card#594)

* Update cards.ts

Signed-off-by: Yachika Sharma <shakuntalaramphalsharma@gmail.com>

* Update event.ts

Signed-off-by: Yachika Sharma <shakuntalaramphalsharma@gmail.com>

* Update nfc.ts

Signed-off-by: Yachika Sharma <shakuntalaramphalsharma@gmail.com>

* Update cards.ts

Signed-off-by: Yachika Sharma <shakuntalaramphalsharma@gmail.com>

---------

Signed-off-by: Yachika Sharma <shakuntalaramphalsharma@gmail.com>
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.

refactor(backend): remove (app as any).authenticate fallback chains from remaining route files

2 participants