Possible fix to callLogs api? Part 2

This commit is contained in:
Christopher Cookman 2026-02-18 14:01:20 -07:00
parent 52726be732
commit 8441f0e5a5

View file

@ -484,7 +484,17 @@ app.get("/api/v1/admin/callLogs", (req, res) => {
rows = rows.map(row => { rows = rows.map(row => {
const newRow = {}; const newRow = {};
for (const key in row) { for (const key in row) {
newRow[key] = String(row[key]); // Convert BigInt explicitly to avoid "Cannot mix BigInt and other types" errors,
// handle Dates and null/undefined safely, otherwise coerce to string.
if (typeof row[key] === 'bigint') {
newRow[key] = row[key].toString();
} else if (row[key] instanceof Date) {
newRow[key] = row[key].toISOString();
} else if (row[key] === null || row[key] === undefined) {
newRow[key] = null;
} else {
newRow[key] = String(row[key]);
}
} }
return newRow; return newRow;
}); });