Skip to content

refactor(api): type pages api routes against prisma - #1535

Open
Code-Parth wants to merge 3 commits into
SuperteamDAO:mainfrom
Code-Parth:split/server-types-pages-api
Open

Code-Parth wants to merge 3 commits into
SuperteamDAO:mainfrom
Code-Parth:split/server-types-pages-api

Conversation

@Code-Parth

Copy link
Copy Markdown
Contributor

What does this PR do?

Types every route under src/pages/api except the sponsor dashboard against the Prisma models instead of any (62 files: user, sponsors, listings, agents, submission, pow, grants, comment, feed, hackathon, member invites, auth).

  • catch clauses are unknown and read through getErrorMessage.
  • Request bodies, sessions and JSON columns use the Prisma models, the next-auth session type and the route selects instead of casts.

No intended behavior change.

Where should the reviewer start?

  • src/pages/api/auth/[...nextauth].ts, which now uses the typed session fields.
  • src/pages/api/submission/create.ts and update.ts
  • src/pages/api/pow/edit.ts

How should this be manually tested?

  • Sign in and link an X account. The handle shows on the profile.
  • Create and edit a submission, and add or edit a proof of work.
  • Post a comment on a listing.
  • pnpm check-types passes and pnpm lint reports 0 errors.

Any background context you want to provide?

Removes 87 explicit any.

What are the relevant issues?

None.

Screenshots (if appropriate)

None.

🤖 Generated with Claude Code

Code-Parth and others added 3 commits November 20, 2026 17:02
Adds getErrorMessage, jsonResponse, parseQuestionAnswers,
parseQuestionConfigs, getPaymentAmount and the skills and linkedTwitter
parsers, and types the shared server utils against the Prisma models
instead of any. No call sites in API routes change here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
catch clauses are unknown and narrowed, request bodies and JSON columns
are parsed instead of cast. The OG image routes fall back to "?" when the
name param is missing, and scout generation keeps existing scouts and
returns early when the bounty has no matchable skills.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Covers every route under src/pages/api except the sponsor dashboard.
catch clauses are unknown and narrowed, and request bodies, sessions and
JSON columns use the Prisma models and route selects instead of casts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 20, 2026

Copy link
Copy Markdown

@Code-Parth is attempting to deploy a commit to the Superteam Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Too many files!

This PR contains 128 files, which is 28 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

CodeRabbit couldn't verify your organization's usage billing state, so no usage-priced review was started. Retry after the billing service recovers.

Check out review usage here.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f30d2386-7ad9-431d-b08d-264f843455fb
Commits

Reviewing files that changed from the base of the PR and between 7faae49 and f4e143a.

Files selected for processing: 128

  • src/app/api/dynamic-og/category/route.tsx
  • src/app/api/dynamic-og/grant/route.tsx
  • src/app/api/dynamic-og/listing/route.tsx
  • src/app/api/dynamic-og/pro-talent/route.tsx
  • src/app/api/dynamic-og/pro-x/route.tsx
  • src/app/api/dynamic-og/region/route.tsx
  • src/app/api/dynamic-og/skill/route.tsx
  • src/app/api/dynamic-og/sponsor/route.tsx
  • src/app/api/dynamic-og/talent/route.tsx
  • src/app/api/dynamic-og/winners/route.tsx
  • src/app/api/grant-application/create/route.ts
  • src/app/api/grant-application/request-tranche/route.ts
  • src/app/api/grant-application/update/route.ts
  • src/app/api/homepage/feed/route.ts
  • src/app/api/homepage/recent-earners/route.ts
  • src/app/api/homepage/sponsor-count/route.ts
  • src/app/api/homepage/stats/route.ts
  • src/app/api/homepage/user-count/route.ts
  • src/app/api/sponsor-dashboard/ai-generate/questions/route.ts
  • src/app/api/sponsor-dashboard/ai-generate/rewards/route.ts
  • src/app/api/sponsor-dashboard/ai-generate/skills/route.ts
  • src/app/api/sponsor-dashboard/ai-generate/title/route.ts
  • src/app/api/sponsor-dashboard/ai-generate/token/route.ts
  • src/app/api/sponsor-dashboard/grant-application/ai/commit-reviewed/route.ts
  • src/app/api/sponsor-dashboard/grant-application/ai/unreviewed/route.ts
  • src/app/api/sponsor-dashboard/grants/update-tranche-status/route.ts
  • src/app/api/sponsor-dashboard/listing/[id]/announce/route.ts
  • src/app/api/sponsor-dashboard/listing/[id]/delete/route.ts
  • src/app/api/sponsor-dashboard/listing/[id]/publish/route.ts
  • src/app/api/sponsor-dashboard/listing/[id]/scout/invite/[userId]/route.ts
  • src/app/api/sponsor-dashboard/listing/[id]/scout/route.ts
  • src/app/api/sponsor-dashboard/listing/[id]/unpublish/route.ts
  • src/app/api/sponsor-dashboard/listing/[id]/update/route.ts
  • src/app/api/sponsor-dashboard/listing/check-slug/route.ts
  • src/app/api/sponsor-dashboard/submissions/ai/commit-reviewed/route.ts
  • src/app/api/sponsor-dashboard/submissions/ai/unreviewed/route.ts
  • src/app/api/sponsor-dashboard/templates/[slug]/route.ts
  • src/app/api/sponsor-dashboard/templates/route.ts
  • src/app/api/user/complete-profile/route.ts
  • src/app/api/user/credit/balance/route.ts
  • src/app/api/user/credit/history/route.ts
  • src/features/feed/constants/homeFeed.ts
  • src/features/grants/utils/grantApplicationSchema.ts
  • src/features/listings/utils/paymentDetails.ts
  • src/features/listings/utils/submissionFormSchema.ts
  • src/features/social/utils/linkedTwitter.ts
  • src/interface/next-auth.d.ts
  • src/interface/skills.ts
  • src/lib/api.ts
  • src/lib/image-upload/cloudinary-client.ts
  • src/lib/image-upload/errors.ts
  • src/lib/rateLimiterService.ts
  • src/pages/api/agents/claim.ts
  • src/pages/api/agents/comments/[id].ts
  • src/pages/api/agents/comments/create.ts
  • src/pages/api/agents/index.ts
  • src/pages/api/agents/submissions/create.ts
  • src/pages/api/agents/submissions/update.ts
  • src/pages/api/auth/[...nextauth].ts
  • src/pages/api/comment/[id]/delete.ts
  • src/pages/api/comment/[id]/index.ts
  • src/pages/api/comment/[id]/pin.ts
  • src/pages/api/comment/create.ts
  • src/pages/api/email/manual/welcome-sponsor.ts
  • src/pages/api/feed/[type]/[id]/get.ts
  • src/pages/api/feed/get.ts
  • src/pages/api/grant-application/get.ts
  • src/pages/api/grant-application/like.ts
  • src/pages/api/grants/[slug].ts
  • src/pages/api/grants/delete/[id].ts
  • src/pages/api/grants/live.ts
  • src/pages/api/grants/update/[id].ts
  • src/pages/api/hackathon/subscribe/get.ts
  • src/pages/api/hackathon/subscribe/toggle.ts
  • src/pages/api/listings/[listingId]/submission-count.ts
  • src/pages/api/listings/[listingId]/winners.ts
  • src/pages/api/listings/bookmarks.ts
  • src/pages/api/listings/details/[slug].ts
  • src/pages/api/listings/latest-active-slug.ts
  • src/pages/api/listings/submissions/[slug].ts
  • src/pages/api/member-invites/accept.ts
  • src/pages/api/member-invites/send.ts
  • src/pages/api/pow/create.ts
  • src/pages/api/pow/edit.ts
  • src/pages/api/pow/get.ts
  • src/pages/api/pow/like.ts
  • src/pages/api/search/[query].ts
  • src/pages/api/sponsor/verification.ts
  • src/pages/api/sponsors/check-name.ts
  • src/pages/api/sponsors/check-slug.ts
  • src/pages/api/sponsors/create.ts
  • src/pages/api/sponsors/edit.ts
  • src/pages/api/sponsors/index.ts
  • src/pages/api/sponsors/list.ts
  • src/pages/api/sponsors/stats.ts
  • src/pages/api/sponsors/update-entity-name.ts
  • src/pages/api/sponsors/usersponsor-details.ts
  • src/pages/api/submission/check.ts
  • src/pages/api/submission/create.ts
  • src/pages/api/submission/get.ts
  • src/pages/api/submission/like.ts
  • src/pages/api/submission/update.ts
  • src/pages/api/twitter/tweet-stats.ts
  • src/pages/api/user/create.ts
  • src/pages/api/user/edit.ts
  • src/pages/api/user/pfps.ts
  • src/pages/api/user/random-username.ts
  • src/pages/api/user/referral/verify.ts
  • src/pages/api/user/resolve-privy-dids.ts
  • src/pages/api/user/search.ts
  • src/pages/api/user/update-email-settings.ts
  • src/pages/api/user/update-survey.ts
  • src/pages/api/user/update.ts
  • src/pages/api/user/username.ts
  • src/prisma.ts
  • src/utils/airtable.ts
  • src/utils/atoms.ts
  • src/utils/cloudinary.ts
  • src/utils/filterAllowedFields.ts
  • src/utils/getErrorMessage.ts
  • src/utils/jsonResponse.ts
  • src/utils/ogHelpers.ts
  • src/utils/parseQuestionAnswers.ts
  • src/utils/parseQuestionConfigs.ts
  • src/utils/safeStringify.ts
  • src/utils/solanaTransactionHelpers.ts
  • src/utils/truncatePublicKey.ts
  • src/utils/undefinedToNull.ts

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@Code-Parth

Copy link
Copy Markdown
Contributor Author

Merge order: 3 of 8. Please merge after #1534; until then this diff also shows the earlier PRs' files. Next is #1536.

This branch has not been deployed

No deployments
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.

1 participant