feat: multi-channel notifications (Discord/email/generic Webhook)

This commit is contained in:
2026-07-16 23:51:09 +08:00
parent ab08b1a2a9
commit 18bb8152ef
2 changed files with 46 additions and 26 deletions

View File

@@ -24,7 +24,7 @@ router.put('/:id', authenticate, requireRole('owner','admin'), async (req, res)
const fields = {};
if (req.body.name) fields.name = req.body.name;
if (req.body.webhook_url !== undefined) fields.webhook_url = req.body.webhook_url;
if (req.body.events) fields.events = req.body.events;
if (req.body.type) fields.type = req.body.type;
if (req.body.active !== undefined) fields.active = req.body.active?1:0;
if (!Object.keys(fields).length) return res.status(400).json({ error: '无更新内容' });
const sets = Object.keys(fields).map(k=>`${k}=?`).join(',');