fix: bigint serialization 500s in video and approval responses

Two endpoints return 500 whenever they succeed, because their success
payloads include VideoVersion rows whose sizeBytes column is a BigInt
that JSON.stringify rejects:

- PATCH /api/projects/[projectId]/videos/[videoId] included all versions;
  respond with scalar video fields only, which is all any caller reads
- POST /api/approvals/[requestId]/decision included the full version row
  in the resolved request; select the scalar fields the response and
  notifications actually use

The approval bug is reachable the first time any approver responds to a
request; the decision itself commits, but the requester sees an error.

Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
eehkay
2026-07-18 09:17:57 -07:00
co-authored by Claude Fable 5
parent 33008d33ad
commit 00589f3453
2 changed files with 19 additions and 5 deletions
@@ -157,10 +157,17 @@ export async function POST(request: NextRequest, { params }: RouteParams) {
approver: { select: { id: true, name: true, email: true, image: true } },
},
},
// Scalar fields only: the full version row carries BigInt sizeBytes,
// which JSON.stringify rejects when serializing the response.
version: {
include: {
select: {
id: true,
versionNumber: true,
versionLabel: true,
video: {
include: {
select: {
id: true,
title: true,
project: { select: { id: true, name: true } },
},
},