Change some stuff to callLog api
This commit is contained in:
parent
3100125380
commit
cd6558f084
18
index.js
18
index.js
|
|
@ -486,14 +486,16 @@ app.get("/api/v1/admin/callLogs", (req, res) => {
|
||||||
for (const key in row) {
|
for (const key in row) {
|
||||||
// Convert BigInt explicitly to avoid "Cannot mix BigInt and other types" errors,
|
// Convert BigInt explicitly to avoid "Cannot mix BigInt and other types" errors,
|
||||||
// handle Dates and null/undefined safely, otherwise coerce to string.
|
// handle Dates and null/undefined safely, otherwise coerce to string.
|
||||||
if (typeof row[key] === 'bigint') {
|
switch (key) {
|
||||||
newRow[key] = row[key].toString();
|
case 'timestamp':
|
||||||
} else if (row[key] instanceof Date) {
|
newRow[key] = new Date(row[key]).toISOString();
|
||||||
newRow[key] = row[key].toISOString();
|
break;
|
||||||
} else if (row[key] === null || row[key] === undefined) {
|
case 'success':
|
||||||
newRow[key] = null;
|
newRow[key] = Boolean(row[key]);
|
||||||
} else {
|
break;
|
||||||
newRow[key] = String(row[key]);
|
default:
|
||||||
|
newRow[key] = new String(row[key]);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return newRow;
|
return newRow;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue