Repository navigation
fix(api): keep each grant approval's own amount - #1537
Code-Parth wants to merge 5 commits into
Conversation
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>
Approving several applications at once could store one application's amount on another. Updates were pushed after awaiting token prices, so array order did not match the applications, and amounts were read from the request by index even though findMany with `in` does not return rows in request order. Updates are now returned from Promise.all and amounts are matched by application id. applicationStatus is validated against the Prisma enum, so an invalid status returns 400 instead of failing inside the transaction. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@Code-Parth is attempting to deploy a commit to the Superteam Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedToo many files! This PR contains 157 files, which is 57 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.
|
What does this PR do?
Fixes grant approvals storing one application's amount on another when several are approved at once. There were two causes in
src/pages/api/sponsor-dashboard/grants/update-application-status.ts:Promise.alltogether with their application id.data[k], assumingfindMany({ id: { in } })returns rows in request order. MySQL does not guarantee that. Amounts are now looked up by application id.applicationStatusis also validated against the Prisma enum, so an invalid status returns 400 instead of failing inside the transaction.Where should the reviewer start?
src/pages/api/sponsor-dashboard/grants/update-application-status.ts, theapprovedAmountByIdmap and theupdatesarray.How should this be manually tested?
applicationStatus: "Foo"to the endpoint. It returns 400.Any background context you want to provide?
Also removes the last two explicit
anyin the API routes.What are the relevant issues?
None.
Screenshots (if appropriate)
None.
🤖 Generated with Claude Code