Possible fix to callLogs api? Part 2
This commit is contained in:
parent
52726be732
commit
8441f0e5a5
12
index.js
12
index.js
|
|
@ -484,7 +484,17 @@ app.get("/api/v1/admin/callLogs", (req, res) => {
|
|||
rows = rows.map(row => {
|
||||
const newRow = {};
|
||||
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;
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue