diff --git a/server.ts b/server.ts index 3b19060..42645d2 100644 --- a/server.ts +++ b/server.ts @@ -902,11 +902,9 @@ app.get('/api/admin/dashboard', authenticateToken, requireAdmin, async (req: Aut recentPayments: recentPaymentsFormatted, webhookLogs: webhookLogs.map(w => ({ id: w.id, - event: w.type, - paymentId: '', - customer: w.userId, - receivedAt: w.createdAt, - status: w.read ? 'READ' : 'UNREAD' + event: w.event, + payload: w.payload, + receivedAt: w.receivedAt })) }); }); @@ -1375,12 +1373,10 @@ app.post('/api/webhooks/asaas', async (req: Request, res: Response) => { const { event, payment } = req.body; if (event) { - await prisma.notification.create({ + await prisma.webhookLog.create({ data: { - userId: 'ALL', // Log events to ALL as webhookLogs - type: event, - message: JSON.stringify(req.body), - read: false + event: event, + payload: JSON.stringify(req.body) } }); }