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,
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)
}
});
}