Skip to content

refactor(api): type sponsor dashboard api routes against prisma - #1536

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

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

Conversation

@Code-Parth

Copy link
Copy Markdown
Contributor

What does this PR do?

Types the routes under src/pages/api/sponsor-dashboard against the Prisma models instead of any (28 files).

  • catch clauses are unknown and read through getErrorMessage.
  • Listing rewards, paymentDetails entries and the export-sheet rows use typed shapes instead of any.

One behavior change: payment history stored in an unexpected shape is refused with an error instead of being treated as empty. Before, a non-array paymentDetails value was replaced by the next payment write. This applies to submission/add-payment.ts and listings/verify-external-payment.ts. A malformed entry counts as 0 in totals instead of producing NaN.

Where should the reviewer start?

  • src/pages/api/sponsor-dashboard/submission/add-payment.ts
  • src/pages/api/sponsor-dashboard/listings/verify-external-payment.ts
  • src/pages/api/sponsor-dashboard/submission/export-sheets.ts

How should this be manually tested?

  • Pay out a winner and verify an external payment. Both record the payment as before.
  • Export submissions and applications to a sheet. The columns match main.
  • pnpm check-types passes and pnpm lint reports 0 errors.

Any background context you want to provide?

Removes 69 explicit any. grants/update-application-status.ts is not changed here.

What are the relevant issues?

None.

Screenshots (if appropriate)

None.

🤖 Generated with Claude Code

Code-Parth and others added 4 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>
catch clauses are unknown and narrowed, and listing rewards, payment
details and export rows use typed shapes instead of any. Payment history
stored in an unexpected shape is now refused with an error instead of
being treated as empty and overwritten on the next payment.

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 156 files, which is 56 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: 0e39fbc5-87a1-4d88-9fac-56e60d9afd12
Commits

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

Files selected for processing: 156

  • 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-dashboard/[slug]/listing.ts
  • src/pages/api/sponsor-dashboard/[slug]/submissions.ts
  • src/pages/api/sponsor-dashboard/active-hackathons.ts
  • src/pages/api/sponsor-dashboard/application/export-sheets.ts
  • src/pages/api/sponsor-dashboard/application/export.ts
  • src/pages/api/sponsor-dashboard/grants/[slug]/applications.ts
  • src/pages/api/sponsor-dashboard/grants/[slug]/index.ts
  • src/pages/api/sponsor-dashboard/grants/[slug]/tranches.ts
  • src/pages/api/sponsor-dashboard/grants/add-tranche.ts
  • src/pages/api/sponsor-dashboard/grants/approved-grantees.ts
  • src/pages/api/sponsor-dashboard/grants/update-label.ts
  • src/pages/api/sponsor-dashboard/grants/update-notes.ts
  • src/pages/api/sponsor-dashboard/grants/update-ship-progress.ts
  • src/pages/api/sponsor-dashboard/listings/index.ts
  • src/pages/api/sponsor-dashboard/listings/is-create-allowed.ts
  • src/pages/api/sponsor-dashboard/listings/verify-external-payment.ts
  • src/pages/api/sponsor-dashboard/local-talent/export.ts
  • src/pages/api/sponsor-dashboard/local-talent/index.ts
  • src/pages/api/sponsor-dashboard/members/index.ts
  • src/pages/api/sponsor-dashboard/members/remove.ts
  • src/pages/api/sponsor-dashboard/members/update-role.ts
  • src/pages/api/sponsor-dashboard/submission/add-payment.ts
  • src/pages/api/sponsor-dashboard/submission/export-sheets.ts
  • src/pages/api/sponsor-dashboard/submission/export.ts
  • src/pages/api/sponsor-dashboard/submission/reject.ts
  • src/pages/api/sponsor-dashboard/submission/toggle-winner.ts
  • src/pages/api/sponsor-dashboard/submission/update-label.ts
  • src/pages/api/sponsor-dashboard/submission/update-notes.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: 4 of 8. Please merge after #1535; until then this diff also shows the earlier PRs' files. Next is #1537.

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