fix: handle BigInt serialization from PostgreSQL bigserial columns
This commit is contained in:
@@ -3,6 +3,11 @@ import cors from 'cors';
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
import { createServer } from 'http';
|
import { createServer } from 'http';
|
||||||
|
|
||||||
|
// Enable BigInt JSON serialization globally
|
||||||
|
(BigInt.prototype as any).toJSON = function () {
|
||||||
|
return this.toString();
|
||||||
|
};
|
||||||
import { config } from './config.js';
|
import { config } from './config.js';
|
||||||
import { closeDb } from './db/index.js';
|
import { closeDb } from './db/index.js';
|
||||||
import { connectionManager } from './irc/connection-manager.js';
|
import { connectionManager } from './irc/connection-manager.js';
|
||||||
|
|||||||
@@ -106,7 +106,10 @@ async function persistAndPublish(
|
|||||||
type: 'irc_event',
|
type: 'irc_event',
|
||||||
eventType: data.type,
|
eventType: data.type,
|
||||||
connectionId: ctx.connectionId,
|
connectionId: ctx.connectionId,
|
||||||
message: msg,
|
message: {
|
||||||
|
...msg,
|
||||||
|
id: msg.id.toString(),
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
await publisher.publish(`irc:events:${ctx.userId}`, JSON.stringify(event));
|
await publisher.publish(`irc:events:${ctx.userId}`, JSON.stringify(event));
|
||||||
|
|||||||
Reference in New Issue
Block a user