Skip to content

fix(backend): Fixes typecheck issues #623

Closed
Harxhit wants to merge 46 commits into
Dev-Card:mainfrom
Harxhit:fix/typecheck
Closed

fix(backend): Fixes typecheck issues #623
Harxhit wants to merge 46 commits into
Dev-Card:mainfrom
Harxhit:fix/typecheck

Conversation

@Harxhit

@Harxhit Harxhit commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes typecheck issues.

Closes #


Type of Change

  • Bug fix
  • Refactor (no functional change)

Screenshots / Recordings

2026-06-21_15-52-09

Harxhit and others added 30 commits June 3, 2026 14:27
* feat(mobile-new): add Metro React Native app with demo mode

* feat(mobile-new): refine demo app screens and theme support

* refactor(mobile): move updated app into mobile folder

* fix(mobile): correct monorepo package paths

* docs(mobile): add Android build notes

* fix(mobile): rename native app to DevCard

* docs(mobile): clean up Android README
* docs: add SECURITY.md with vulnerability reporting policy

* docs: update SECURITY.md to fix reporting channel
* feat(backend): log method and url for each request

* test(backend): set env before app build, fix import order

* fix(backend): resolve eslint errors in app.ts

* fix(backend): generate prisma client on install
) (Dev-Card#385)

* fix(cards): prevent concurrent default card race condition (Dev-Card#344)

* fix(cards): address review feedback

* fix(cards): address lint feedback

* chore: remove accidental file from PR

* fix: throw not found error instead of returning

* fix: throw last card error instead of returning

---------

Signed-off-by: SOMAPURAM UDAY <udaysomapuram@gmail.com>
* fix: resolve typecheck errors across the repository

* fix: Lint issues in card.ts
* feat(auth): add JWT token revocation with Redis blocklist

Adds secure logout that revokes the current JWT by storing a hash of its
signature in Redis with a TTL equal to the token's remaining lifetime.
The entry self-cleans when the JWT naturally expires, keeping Redis lean.

Changes:
- utils/jwt.ts: extractRawJwt() and blocklistKey(SHA-256(sig)) utilities
- app.ts:       authenticate decorator checks Redis blocklist before jwtVerify;
                registers @fastify/cookie before @fastify/jwt so cookie-based
                auth works for web browser clients (was silently broken before)
- routes/auth.ts: DELETE /auth/logout endpoint (requires valid JWT);
                  POST /auth/logout simplified to cookie-clear only (backward compat)
- logout.test.ts: 36 tests covering revocation flow, cookie auth, Redis failures,
                  edge cases, and end-to-end invariants
- app.test.ts:  set JWT_SECRET/ENCRYPTION_KEY fallbacks so CI can call buildApp()
- package.json: add typecheck script consumed by CI workflow
- ciScript.js:  fix path generation — test files in __tests__/ were being
                double-suffixed (logout.test.ts -> logout.test.test.ts)

Security decisions documented inline:
- Fail-open on Redis outage (acceptable for a portfolio app; JWT expiry is backup)
- SHA-256 hash of signature as blocklist key (claims never stored in Redis)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(lint): add explicit return types

* extract OAuth helpers and improve logout logging

---------

Signed-off-by: J.ANTHARYA <antharyajalligampala@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
…#481)

* refactor(auth): restructure user schema for enhanced authentication

* fix: Added inline comment

* fix: add role to schema

Signed-off-by: Harshit <harsxit04@gmail.com>

* feat(auth): implement OAuth authentication flow

* fix(auth): add account linking logic and resolve lint issues

* test(auth): update logout tests for access token cookies

* fix: Updated test file

* fix: Lint issues

---------

Signed-off-by: Harshit <harsxit04@gmail.com>
…ard#506)

* feat: add GitHub platform autodiscovery

* fix: resolve lint and type issues in autodiscovery

* fix: restore reply parameter in github autodiscovery route

* fix: resolve unused reply lint issue
…#555)

* feat(shared): add isSupportedPlatform helper and unit tests

- Add exported isSupportedPlatform helper to platforms.ts

- Add tests in __tests__/platforms.test.ts for existing and unknown platform IDs

Closes Dev-Card#9

* fix(shared): address Copilot review feedback on isSupportedPlatform

- Use Object.prototype.hasOwnProperty.call for safer own-property check

- Remove redundant per-platform assertions covered by the loop test

- Rename misleading test description to reflect casing check intent

* fix(shared): add vitest types to tsconfig for IDE type resolution
* fix: improve feature card readability and contrast (Dev-Card#319)

* feat(web): add smooth theme transition animation
… (Dev-Card#560)

* add AuthenticatedUser type for the jwt user payload

* refactor(types): declare authenticate decorator on FastifyInstance

* refactor(app): type the authenticate decorator instead of any

* refactor(auth): drop any cast on request.user in /me route

* refactor(auth): drop remaining any cast in secure logout route
…ma where clause (Dev-Card#546) (Dev-Card#563)

* refactor(backend): type authenticate decorator and jwt user payload

* refactor(backend): use typed authenticate prehandler and jwt user in analytics routes

* refactor(backend): type analytics where clause with prisma cardviewwhereinput
yachikadev and others added 16 commits June 21, 2026 15:54
…ard#550) (Dev-Card#575)

* fix: remove any usages in follow.ts, reuse Fastify/JWT types (Dev-Card#550)

* fix: type jwtVerify payload with AuthenticatedUser

* fix: add explicit return type and rename unused catch variable for ESLint
…#593)

* feat(auth): add Zod validation for OAuth callback endpoints

Validates code and state query params in /auth/github/callback and
/auth/google/callback before any token exchange or DB work happens.
Adds oauthCallbackSchema to validators.ts and tests covering missing/
empty code, missing/empty state, and state cookie mismatch scenarios.

* fix(auth): address review feedback on OAuth callback validation

- rename oauthCallbackSchema to oAuthCallbackSchema to match naming convention
- add .trim() to code and state fields to reject whitespace-only values
- export OAuthCallbackQuery type from auth.validation.ts and remove duplicate local interface

* fix(auth): clear oauth_state cookie on validation failure and add trailing newline

* fix(auth): clear oauth_state cookie on all failure paths and drop details from 400 response
…ndlers (Dev-Card#294)

* fix(public): prevent owner self-views from inflating analytics when unauthenticated

* fix(public): revert unintended changes, keep only isSelfView fix

* fixed

* fix(public): add missing return types to publicService functions

---------

Signed-off-by: hariom888 <hariom880088@gmail.com>
Co-authored-by: Hari Om <hariom888@users.noreply.github.com>
* feat: apply card sharing backend changes with auth fix

* chore: update npm cleanup references

* fix: restore oauth callback validation type

* fix: restore oauth callback zod validation

---------

Signed-off-by: Pushkar Kulkarni <omplayz4456@gmail.com>
…response (Dev-Card#596)

Collapses the 4 boilerplate preauth blocks (GET /status, GET /github, GET /github/autodiscover, DELETE /:platform) down to preHandler: [app.authenticate], matching the pattern already used in auth.ts's /me and DELETE /logout routes. The FastifyJWT augmentation in types/fastify.d.ts already types request.user as AuthenticatedUser, so the (request.user as any).id casts are no longer needed.

Also types the GitHub token-exchange response in github/callback using GitHubTokenResponse/GitHubTokenErrorResponse and isGitHubTokenError from utils/error.util.ts, reusing the same types auth.ts already defines for the equivalent login-flow exchange instead of �s any.

Co-authored-by: Hari Om <hariom888@users.noreply.github.com>
@vercel

vercel Bot commented Jun 21, 2026

Copy link
Copy Markdown

@Harxhit 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 devops gssoc:approved Required label for every approved PR. Gives the base +50 points and enables contribution tracking. mobile web labels Jun 21, 2026
@github-actions

Copy link
Copy Markdown

Hi @Harxhit,

Thanks for opening this pull request.

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

Applied Labels

  • gssoc:approved
  • backend
  • mobile
  • web
  • devops

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!

@Harxhit Harxhit closed this Jun 21, 2026
@Harxhit Harxhit removed backend mobile web devops 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

CI — Checks Failed

Backend — FAIL

Check Result
Lint FAIL
Test FAIL
Typecheck PASS

Mobile — FAIL

Check Result
Lint FAIL
Test PASS

Web — PASS

Check Result
Build PASS

Last updated: Sun, 21 Jun 2026 10:28:06 GMT

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.