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
Build and Deploy (Gitea) / build-and-deploy (push) Successful in 1m15s
Details
This commit is contained in:
parent
9a51bc3dd0
commit
2288eb2784
16
server.ts
16
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)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue