Possible fix to callLogs api?

This commit is contained in:
Christopher Cookman 2026-02-18 13:59:08 -07:00
parent d0445d5103
commit 52726be732

View file

@ -480,6 +480,14 @@ app.get("/api/v1/admin/callLogs", (req, res) => {
conn.query("SELECT COUNT(*) as count FROM callLogs").then((rows) => {
const totalPages = Math.ceil(rows[0].count / 100);
conn.query("SELECT * FROM callLogs ORDER BY timestamp DESC LIMIT 100 OFFSET ?", [offset]).then((rows) => {
// Turn all values in rows to strings, prevents type issues with bigints.
rows = rows.map(row => {
const newRow = {};
for (const key in row) {
newRow[key] = String(row[key]);
}
return newRow;
});
res.json({ totalPages, page, data: rows });
}).catch(err => {
console.error('Error getting call logs:', err);