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) {
|
||||
// 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]);
|
||||
switch (key) {
|
||||
case 'timestamp':
|
||||
newRow[key] = new Date(row[key]).toISOString();
|
||||
break;
|
||||
case 'success':
|
||||
newRow[key] = Boolean(row[key]);
|
||||
break;
|
||||
default:
|
||||
newRow[key] = new String(row[key]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return newRow;
|
||||
|
|
|
|||
Loading…
Reference in a new issue