mirror of
https://github.com/yusufipk/OpenFrame.git
synced 2026-09-11 17:46:06 +00:00
Merge pull request #27 from eehkay/fix/bigint-serialization
fix: BigInt serialization 500s in video PATCH and approval decision responses
This commit is contained in:
@@ -157,10 +157,17 @@ export async function POST(request: NextRequest, { params }: RouteParams) {
|
|||||||
approver: { select: { id: true, name: true, email: true, image: true } },
|
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: {
|
version: {
|
||||||
include: {
|
select: {
|
||||||
|
id: true,
|
||||||
|
versionNumber: true,
|
||||||
|
versionLabel: true,
|
||||||
video: {
|
video: {
|
||||||
include: {
|
select: {
|
||||||
|
id: true,
|
||||||
|
title: true,
|
||||||
project: { select: { id: true, name: true } },
|
project: { select: { id: true, name: true } },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -191,12 +191,19 @@ export async function PATCH(request: NextRequest, { params }: RouteParams) {
|
|||||||
if (typeof description === 'string') updateData.description = description.trim() || null;
|
if (typeof description === 'string') updateData.description = description.trim() || null;
|
||||||
if (position !== undefined) updateData.position = position;
|
if (position !== undefined) updateData.position = position;
|
||||||
|
|
||||||
|
// Keep the response to scalar video fields: including versions would pull
|
||||||
|
// in BigInt columns (sizeBytes) that JSON.stringify cannot serialize, and
|
||||||
|
// no caller consumes the success payload beyond these fields.
|
||||||
const updatedVideo = await db.video.update({
|
const updatedVideo = await db.video.update({
|
||||||
where: { id: videoId },
|
where: { id: videoId },
|
||||||
data: updateData,
|
data: updateData,
|
||||||
include: {
|
select: {
|
||||||
versions: { orderBy: { versionNumber: 'desc' } },
|
id: true,
|
||||||
_count: { select: { versions: true } },
|
title: true,
|
||||||
|
description: true,
|
||||||
|
position: true,
|
||||||
|
projectId: true,
|
||||||
|
updatedAt: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user