fix(webhook): fix webhook logger crash and webhook logs mapping in admin dashboard
Build and Deploy (Gitea) / build-and-deploy (push) Successful in 1m15s Details

This commit is contained in:
Sidney Gomes 2026-07-23 10:20:23 -03:00
parent 9a51bc3dd0
commit 2288eb2784
1 changed files with 6 additions and 10 deletions

View File

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